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

namespace NS__Emulation {

/* Literal string constants */

extern const CHARSTRING cs_0(6, "-NSVCI"),
cs_3(8, "-NSVCemu"),
cs_4(7, "-provFR"),
cs_1(7, "-provIP"),
cs_2(19, "NS_Emulation.ttcnpp"),
cs_5(23, "Unsupported NS provider");
const unsigned char module_checksum[] = { 0x9e, 0xcf, 0x79, 0x94, 0x35, 0x6f, 0xd3, 0x34, 0xb4, 0xe2, 0x90, 0xdb, 0x58, 0x40, 0x69, 0xbd };

/* Global variable definitions */

const XERdescriptor_t       NsUnitdataRequest_bvci_xer_ = { {"bvci>\n", "bvci>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t NsUnitdataRequest_bvci_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t NsUnitdataRequest_bvci_descr_ = { "@NS_Emulation.NsUnitdataRequest.bvci", &INTEGER_ber_, &Osmocom__Types::uint16__t_raw_, &INTEGER_text_, &NsUnitdataRequest_bvci_xer_, &INTEGER_json_, &NsUnitdataRequest_bvci_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING NsUnitdataRequest_bvci_default_coding("RAW");
const XERdescriptor_t       NsUnitdataRequest_nsei_xer_ = { {"nsei>\n", "nsei>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t NsUnitdataRequest_nsei_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t NsUnitdataRequest_nsei_descr_ = { "@NS_Emulation.NsUnitdataRequest.nsei", &INTEGER_ber_, &Osmocom__Types::uint16__t_raw_, &INTEGER_text_, &NsUnitdataRequest_nsei_xer_, &INTEGER_json_, &NsUnitdataRequest_nsei_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING NsUnitdataRequest_nsei_default_coding("RAW");
const XERdescriptor_t       NsUnitdataRequest_lsp_xer_ = { {"lsp>\n", "lsp>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t NsUnitdataRequest_lsp_descr_ = { "@NS_Emulation.NsUnitdataRequest.lsp", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &NsUnitdataRequest_lsp_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
// No XER for NsUnitdataRequest
const TTCN_Typedescriptor_t NsUnitdataRequest_descr_ = { "@NS_Emulation.NsUnitdataRequest", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       NsUnitdataRequest_sdu_xer_ = { {"sdu>\n", "sdu>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED |XER_OPTIONAL, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int NsUnitdataRequest_sdu_oer_ext_arr_[0] = {};
const int NsUnitdataRequest_sdu_oer_p_[0] = {};
const TTCN_OERdescriptor_t NsUnitdataRequest_sdu_oer_ = { -1, TRUE, -1, FALSE, 0, 0, NsUnitdataRequest_sdu_oer_ext_arr_, 0, NsUnitdataRequest_sdu_oer_p_};
const TTCN_Typedescriptor_t NsUnitdataRequest_sdu_descr_ = { "@NS_Emulation.NsUnitdataRequest.sdu", &OCTETSTRING_ber_, &OCTETSTRING_raw_, &OCTETSTRING_text_, &NsUnitdataRequest_sdu_xer_, &OCTETSTRING_json_, &NsUnitdataRequest_sdu_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING NsUnitdataRequest_bssgp_default_coding("RAW");
const XERdescriptor_t       NsUnitdataIndication_bvci_xer_ = { {"bvci>\n", "bvci>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t NsUnitdataIndication_bvci_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t NsUnitdataIndication_bvci_descr_ = { "@NS_Emulation.NsUnitdataIndication.bvci", &INTEGER_ber_, &Osmocom__Types::uint16__t_raw_, &INTEGER_text_, &NsUnitdataIndication_bvci_xer_, &INTEGER_json_, &NsUnitdataIndication_bvci_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING NsUnitdataIndication_bvci_default_coding("RAW");
const XERdescriptor_t       NsUnitdataIndication_nsei_xer_ = { {"nsei>\n", "nsei>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t NsUnitdataIndication_nsei_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t NsUnitdataIndication_nsei_descr_ = { "@NS_Emulation.NsUnitdataIndication.nsei", &INTEGER_ber_, &Osmocom__Types::uint16__t_raw_, &INTEGER_text_, &NsUnitdataIndication_nsei_xer_, &INTEGER_json_, &NsUnitdataIndication_nsei_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING NsUnitdataIndication_nsei_default_coding("RAW");
const XERdescriptor_t       NsUnitdataIndication_nsvci_xer_ = { {"nsvci>\n", "nsvci>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t NsUnitdataIndication_nsvci_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t NsUnitdataIndication_nsvci_descr_ = { "@NS_Emulation.NsUnitdataIndication.nsvci", &INTEGER_ber_, &Osmocom__Types::uint16__t_raw_, &INTEGER_text_, &NsUnitdataIndication_nsvci_xer_, &INTEGER_json_, &NsUnitdataIndication_nsvci_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING NsUnitdataIndication_nsvci_default_coding("RAW");
// No XER for NsUnitdataIndication
const TTCN_Typedescriptor_t NsUnitdataIndication_descr_ = { "@NS_Emulation.NsUnitdataIndication", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       NsUnitdataIndication_sdu_xer_ = { {"sdu>\n", "sdu>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED |XER_OPTIONAL, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int NsUnitdataIndication_sdu_oer_ext_arr_[0] = {};
const int NsUnitdataIndication_sdu_oer_p_[0] = {};
const TTCN_OERdescriptor_t NsUnitdataIndication_sdu_oer_ = { -1, TRUE, -1, FALSE, 0, 0, NsUnitdataIndication_sdu_oer_ext_arr_, 0, NsUnitdataIndication_sdu_oer_p_};
const TTCN_Typedescriptor_t NsUnitdataIndication_sdu_descr_ = { "@NS_Emulation.NsUnitdataIndication.sdu", &OCTETSTRING_ber_, &OCTETSTRING_raw_, &OCTETSTRING_text_, &NsUnitdataIndication_sdu_xer_, &OCTETSTRING_json_, &NsUnitdataIndication_sdu_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING NsUnitdataIndication_bssgp_default_coding("RAW");
const XERdescriptor_t       NsStatusIndication_nsei_xer_ = { {"nsei>\n", "nsei>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t NsStatusIndication_nsei_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t NsStatusIndication_nsei_descr_ = { "@NS_Emulation.NsStatusIndication.nsei", &INTEGER_ber_, &Osmocom__Types::uint16__t_raw_, &INTEGER_text_, &NsStatusIndication_nsei_xer_, &INTEGER_json_, &NsStatusIndication_nsei_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING NsStatusIndication_nsei_default_coding("RAW");
const XERdescriptor_t       NsStatusIndication_nsvci_xer_ = { {"nsvci>\n", "nsvci>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t NsStatusIndication_nsvci_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t NsStatusIndication_nsvci_descr_ = { "@NS_Emulation.NsStatusIndication.nsvci", &INTEGER_ber_, &Osmocom__Types::uint16__t_raw_, &INTEGER_text_, &NsStatusIndication_nsvci_xer_, &INTEGER_json_, &NsStatusIndication_nsvci_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING NsStatusIndication_nsvci_default_coding("RAW");
// No XER for NsvcState
const TTCN_Typedescriptor_t NsvcState_descr_ = { "@NS_Emulation.NsvcState", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       NsStatusIndication_first__or__last_xer_ = { {"first_or_last>\n", "first_or_last>\n"}, {15, 15}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int NsStatusIndication_first__or__last_oer_ext_arr_[0] = {};
const int NsStatusIndication_first__or__last_oer_p_[0] = {};
const TTCN_OERdescriptor_t NsStatusIndication_first__or__last_oer_ = { -1, TRUE, -1, FALSE, 0, 0, NsStatusIndication_first__or__last_oer_ext_arr_, 0, NsStatusIndication_first__or__last_oer_p_};
const TTCN_Typedescriptor_t NsStatusIndication_first__or__last_descr_ = { "@NS_Emulation.NsStatusIndication.first_or_last", &BOOLEAN_ber_, &BOOLEAN_raw_, &BOOLEAN_text_, &NsStatusIndication_first__or__last_xer_, &BOOLEAN_json_, &NsStatusIndication_first__or__last_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
// No XER for NsStatusIndication
const TTCN_Typedescriptor_t NsStatusIndication_descr_ = { "@NS_Emulation.NsStatusIndication", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
INTEGER_template template_tr__NsStsInd_nsei_defval;
const INTEGER_template& tr__NsStsInd_nsei_defval = template_tr__NsStsInd_nsei_defval;
INTEGER_template template_tr__NsStsInd_nsvci_defval;
const INTEGER_template& tr__NsStsInd_nsvci_defval = template_tr__NsStsInd_nsvci_defval;
NsvcState_template template_tr__NsStsInd_old__state_defval;
const NsvcState_template& tr__NsStsInd_old__state_defval = template_tr__NsStsInd_old__state_defval;
NsvcState_template template_tr__NsStsInd_state_defval;
const NsvcState_template& tr__NsStsInd_state_defval = template_tr__NsStsInd_state_defval;
BOOLEAN_template template_tr__NsStsInd_first__or__last_defval;
const BOOLEAN_template& tr__NsStsInd_first__or__last_defval = template_tr__NsStsInd_first__or__last_defval;
BOOLEAN const_ts__NsStsInd_first__or__last_defval;
const BOOLEAN& ts__NsStsInd_first__or__last_defval = const_ts__NsStsInd_first__or__last_defval;
const XERdescriptor_t       NsDisableVcRequest_nsvci_xer_ = { {"nsvci>\n", "nsvci>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t NsDisableVcRequest_nsvci_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t NsDisableVcRequest_nsvci_descr_ = { "@NS_Emulation.NsDisableVcRequest.nsvci", &INTEGER_ber_, &Osmocom__Types::uint16__t_raw_, &INTEGER_text_, &NsDisableVcRequest_nsvci_xer_, &INTEGER_json_, &NsDisableVcRequest_nsvci_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING NsDisableVcRequest_nsvci_default_coding("RAW");
// No XER for NsDisableVcRequest
const TTCN_Typedescriptor_t NsDisableVcRequest_descr_ = { "@NS_Emulation.NsDisableVcRequest", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       NsEnableVcRequest_nsvci_xer_ = { {"nsvci>\n", "nsvci>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t NsEnableVcRequest_nsvci_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t NsEnableVcRequest_nsvci_descr_ = { "@NS_Emulation.NsEnableVcRequest.nsvci", &INTEGER_ber_, &Osmocom__Types::uint16__t_raw_, &INTEGER_text_, &NsEnableVcRequest_nsvci_xer_, &INTEGER_json_, &NsEnableVcRequest_nsvci_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING NsEnableVcRequest_nsvci_default_coding("RAW");
// No XER for NsEnableVcRequest
const TTCN_Typedescriptor_t NsEnableVcRequest_descr_ = { "@NS_Emulation.NsEnableVcRequest", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const TTCN_Typedescriptor_t& NS__Provider__CT_descr_ = COMPONENT_descr_;
NS__PROVIDER__PT NS__Provider__CT_component_NSE("NSE");
// No XER for NS__Provider__LinkStatus
const TTCN_Typedescriptor_t NS__Provider__LinkStatus_descr_ = { "@NS_Emulation.NS_Provider_LinkStatus", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
// No XER for NS__Provider__Evt
const TTCN_Typedescriptor_t NS__Provider__Evt_descr_ = { "@NS_Emulation.NS_Provider_Evt", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING NSVCConfigurationIP_address__family_default_coding("RAW");
const XERdescriptor_t       NSVCConfigurationIP_local__udp__port_xer_ = { {"local_udp_port>\n", "local_udp_port>\n"}, {16, 16}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t NSVCConfigurationIP_local__udp__port_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t NSVCConfigurationIP_local__udp__port_descr_ = { "@NS_Emulation.NSVCConfigurationIP.local_udp_port", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &NSVCConfigurationIP_local__udp__port_xer_, &INTEGER_json_, &NSVCConfigurationIP_local__udp__port_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       NSVCConfigurationIP_local__ip_xer_ = { {"local_ip>\n", "local_ip>\n"}, {10, 10}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t NSVCConfigurationIP_local__ip_descr_ = { "@NS_Emulation.NSVCConfigurationIP.local_ip", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &NSVCConfigurationIP_local__ip_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       NSVCConfigurationIP_remote__udp__port_xer_ = { {"remote_udp_port>\n", "remote_udp_port>\n"}, {17, 17}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t NSVCConfigurationIP_remote__udp__port_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t NSVCConfigurationIP_remote__udp__port_descr_ = { "@NS_Emulation.NSVCConfigurationIP.remote_udp_port", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &NSVCConfigurationIP_remote__udp__port_xer_, &INTEGER_json_, &NSVCConfigurationIP_remote__udp__port_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       NSVCConfigurationIP_remote__ip_xer_ = { {"remote_ip>\n", "remote_ip>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t NSVCConfigurationIP_remote__ip_descr_ = { "@NS_Emulation.NSVCConfigurationIP.remote_ip", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &NSVCConfigurationIP_remote__ip_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       NSVCConfigurationIP_data__weight_xer_ = { {"data_weight>\n", "data_weight>\n"}, {13, 13}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t NSVCConfigurationIP_data__weight_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t NSVCConfigurationIP_data__weight_descr_ = { "@NS_Emulation.NSVCConfigurationIP.data_weight", &INTEGER_ber_, &Osmocom__Types::uint8__t_raw_, &INTEGER_text_, &NSVCConfigurationIP_data__weight_xer_, &INTEGER_json_, &NSVCConfigurationIP_data__weight_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING NSVCConfigurationIP_data__weight_default_coding("RAW");
const XERdescriptor_t       NSVCConfigurationIP_signalling__weight_xer_ = { {"signalling_weight>\n", "signalling_weight>\n"}, {19, 19}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t NSVCConfigurationIP_signalling__weight_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t NSVCConfigurationIP_signalling__weight_descr_ = { "@NS_Emulation.NSVCConfigurationIP.signalling_weight", &INTEGER_ber_, &Osmocom__Types::uint8__t_raw_, &INTEGER_text_, &NSVCConfigurationIP_signalling__weight_xer_, &INTEGER_json_, &NSVCConfigurationIP_signalling__weight_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING NSVCConfigurationIP_signalling__weight_default_coding("RAW");
// No XER for NSVCConfigurationIP
const TTCN_Typedescriptor_t NSVCConfigurationIP_descr_ = { "@NS_Emulation.NSVCConfigurationIP", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       NSVCConfigurationFR_netdev_xer_ = { {"netdev>\n", "netdev>\n"}, {8, 8}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t NSVCConfigurationFR_netdev_descr_ = { "@NS_Emulation.NSVCConfigurationFR.netdev", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &NSVCConfigurationFR_netdev_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       NSVCConfigurationFR_dlci_xer_ = { {"dlci>\n", "dlci>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t NSVCConfigurationFR_dlci_descr_ = { "@NS_Emulation.NSVCConfigurationFR.dlci", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &NSVCConfigurationFR_dlci_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
// No XER for NSVCConfigurationFR
const TTCN_Typedescriptor_t NSVCConfigurationFR_descr_ = { "@NS_Emulation.NSVCConfigurationFR", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
// No XER for NSVCConfigurationP
const TTCN_Typedescriptor_t NSVCConfigurationP_descr_ = { "@NS_Emulation.NSVCConfigurationP", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       NSVCConfiguration_nsvci_xer_ = { {"nsvci>\n", "nsvci>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t NSVCConfiguration_nsvci_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t NSVCConfiguration_nsvci_descr_ = { "@NS_Emulation.NSVCConfiguration.nsvci", &INTEGER_ber_, &Osmocom__Types::uint16__t_raw_, &INTEGER_text_, &NSVCConfiguration_nsvci_xer_, &INTEGER_json_, &NSVCConfiguration_nsvci_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING NSVCConfiguration_nsvci_default_coding("RAW");
// No XER for NSVCConfiguration
const TTCN_Typedescriptor_t NSVCConfiguration_descr_ = { "@NS_Emulation.NSVCConfiguration", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
// No XER for NSVCConfigurations
const TTCN_Typedescriptor_t NSVCConfigurations_descr_ = { "@NS_Emulation.NSVCConfigurations", NULL, NULL, NULL, NULL, NULL, NULL, NULL, &NSVCConfiguration_descr_, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       NSConfiguration_nsei_xer_ = { {"nsei>\n", "nsei>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t NSConfiguration_nsei_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t NSConfiguration_nsei_descr_ = { "@NS_Emulation.NSConfiguration.nsei", &INTEGER_ber_, &Osmocom__Types::uint16__t_raw_, &INTEGER_text_, &NSConfiguration_nsei_xer_, &INTEGER_json_, &NSConfiguration_nsei_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING NSConfiguration_nsei_default_coding("RAW");
const XERdescriptor_t       NSConfiguration_role__sgsn_xer_ = { {"role_sgsn>\n", "role_sgsn>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int NSConfiguration_role__sgsn_oer_ext_arr_[0] = {};
const int NSConfiguration_role__sgsn_oer_p_[0] = {};
const TTCN_OERdescriptor_t NSConfiguration_role__sgsn_oer_ = { -1, TRUE, -1, FALSE, 0, 0, NSConfiguration_role__sgsn_oer_ext_arr_, 0, NSConfiguration_role__sgsn_oer_p_};
const TTCN_Typedescriptor_t NSConfiguration_role__sgsn_descr_ = { "@NS_Emulation.NSConfiguration.role_sgsn", &BOOLEAN_ber_, &BOOLEAN_raw_, &BOOLEAN_text_, &NSConfiguration_role__sgsn_xer_, &BOOLEAN_json_, &NSConfiguration_role__sgsn_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       NSConfiguration_handle__sns_xer_ = { {"handle_sns>\n", "handle_sns>\n"}, {12, 12}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int NSConfiguration_handle__sns_oer_ext_arr_[0] = {};
const int NSConfiguration_handle__sns_oer_p_[0] = {};
const TTCN_OERdescriptor_t NSConfiguration_handle__sns_oer_ = { -1, TRUE, -1, FALSE, 0, 0, NSConfiguration_handle__sns_oer_ext_arr_, 0, NSConfiguration_handle__sns_oer_p_};
const TTCN_Typedescriptor_t NSConfiguration_handle__sns_descr_ = { "@NS_Emulation.NSConfiguration.handle_sns", &BOOLEAN_ber_, &BOOLEAN_raw_, &BOOLEAN_text_, &NSConfiguration_handle__sns_xer_, &BOOLEAN_json_, &NSConfiguration_handle__sns_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
// No XER for NSConfiguration
const TTCN_Typedescriptor_t NSConfiguration_descr_ = { "@NS_Emulation.NSConfiguration", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const TTCN_Typedescriptor_t& NS__CT_descr_ = COMPONENT_descr_;
NS__SP__PT NS__CT_component_NS__SP("NS_SP");
NSint__PT NS__CT_component_NSVC("NSVC");
NS__CTRL__SP__PT NS__CT_component_NS__CTRL("NS_CTRL");
NSConfiguration NS__CT_component_g__config;
CHARSTRING NS__CT_component_g__id;
// No XER for IpEndpointTable
const TTCN_Typedescriptor_t IpEndpointTable_descr_ = { "@NS_Emulation.IpEndpointTable", NULL, NULL, NULL, NULL, NULL, NULL, NULL, &IpEndpointTableEntry_descr_, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING IpEndpointTableEntry_address__family_default_coding("RAW");
const XERdescriptor_t       IpEndpointTableEntry_local__udp__port_xer_ = { {"local_udp_port>\n", "local_udp_port>\n"}, {16, 16}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t IpEndpointTableEntry_local__udp__port_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t IpEndpointTableEntry_local__udp__port_descr_ = { "@NS_Emulation.IpEndpointTableEntry.local_udp_port", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &IpEndpointTableEntry_local__udp__port_xer_, &INTEGER_json_, &IpEndpointTableEntry_local__udp__port_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       IpEndpointTableEntry_local__ip_xer_ = { {"local_ip>\n", "local_ip>\n"}, {10, 10}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t IpEndpointTableEntry_local__ip_descr_ = { "@NS_Emulation.IpEndpointTableEntry.local_ip", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &IpEndpointTableEntry_local__ip_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       IpEndpointTableEntry_data__weight_xer_ = { {"data_weight>\n", "data_weight>\n"}, {13, 13}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t IpEndpointTableEntry_data__weight_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t IpEndpointTableEntry_data__weight_descr_ = { "@NS_Emulation.IpEndpointTableEntry.data_weight", &INTEGER_ber_, &Osmocom__Types::uint8__t_raw_, &INTEGER_text_, &IpEndpointTableEntry_data__weight_xer_, &INTEGER_json_, &IpEndpointTableEntry_data__weight_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING IpEndpointTableEntry_data__weight_default_coding("RAW");
const XERdescriptor_t       IpEndpointTableEntry_signalling__weight_xer_ = { {"signalling_weight>\n", "signalling_weight>\n"}, {19, 19}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t IpEndpointTableEntry_signalling__weight_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t IpEndpointTableEntry_signalling__weight_descr_ = { "@NS_Emulation.IpEndpointTableEntry.signalling_weight", &INTEGER_ber_, &Osmocom__Types::uint8__t_raw_, &INTEGER_text_, &IpEndpointTableEntry_signalling__weight_xer_, &INTEGER_json_, &IpEndpointTableEntry_signalling__weight_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING IpEndpointTableEntry_signalling__weight_default_coding("RAW");
// No XER for IpEndpointTableEntry
const TTCN_Typedescriptor_t IpEndpointTableEntry_descr_ = { "@NS_Emulation.IpEndpointTableEntry", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
IpEndpointTable NS__CT_component_g__ip__endpoints;
NS__Provider__IPL4::NSPIP__PROC__PT NS__CT_component_NSPIP__PROC("NSPIP_PROC");
// No XER for NsvcTable
const TTCN_Typedescriptor_t NsvcTable_descr_ = { "@NS_Emulation.NsvcTable", NULL, NULL, NULL, NULL, NULL, NULL, NULL, &NsvcTableEntry_descr_, TTCN_Typedescriptor_t::DONTCARE };
const TTCN_Typedescriptor_t& NSVC__CT_descr_ = COMPONENT_descr_;
// No XER for NsvcTableEntry
const TTCN_Typedescriptor_t NsvcTableEntry_descr_ = { "@NS_Emulation.NsvcTableEntry", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
NsvcTable NS__CT_component_g__nsvcs;
Osmocom__Types::ro__integer NS__CT_component_g__unblocked__nsvcs__sig;
Osmocom__Types::ro__integer NS__CT_component_g__unblocked__nsvcs__data;
const XERdescriptor_t       SnsIndication_nsvci_xer_ = { {"nsvci>\n", "nsvci>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t SnsIndication_nsvci_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t SnsIndication_nsvci_descr_ = { "@NS_Emulation.SnsIndication.nsvci", &INTEGER_ber_, &Osmocom__Types::uint16__t_raw_, &INTEGER_text_, &SnsIndication_nsvci_xer_, &INTEGER_json_, &SnsIndication_nsvci_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING SnsIndication_nsvci_default_coding("RAW");
UNIVERSAL_CHARSTRING SnsIndication_ns_default_coding("RAW");
// No XER for SnsIndication
const TTCN_Typedescriptor_t SnsIndication_descr_ = { "@NS_Emulation.SnsIndication", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       SnsRequest_nsvci_xer_ = { {"nsvci>\n", "nsvci>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t SnsRequest_nsvci_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t SnsRequest_nsvci_descr_ = { "@NS_Emulation.SnsRequest.nsvci", &INTEGER_ber_, &Osmocom__Types::uint16__t_raw_, &INTEGER_text_, &SnsRequest_nsvci_xer_, &INTEGER_json_, &SnsRequest_nsvci_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING SnsRequest_nsvci_default_coding("RAW");
UNIVERSAL_CHARSTRING SnsRequest_ns_default_coding("RAW");
// No XER for SnsRequest
const TTCN_Typedescriptor_t SnsRequest_descr_ = { "@NS_Emulation.SnsRequest", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
// No XER for NsCtrlRequest
const TTCN_Typedescriptor_t NsCtrlRequest_descr_ = { "@NS_Emulation.NsCtrlRequest", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
CHARSTRING const_NSStart_id_defval;
const CHARSTRING& NSStart_id_defval = const_NSStart_id_defval;
NsvcState_template template_f__count__nsvcs__in__state_state_defval;
const NsvcState_template& f__count__nsvcs__in__state_state_defval = template_f__count__nsvcs__in__state_state_defval;
INTEGER const_f__sns__outbound__size__config_idx_defval;
const INTEGER& f__sns__outbound__size__config_idx_defval = const_f__sns__outbound__size__config_idx_defval;
NS__PROVIDER__PT NSVC__CT_component_NSCP("NSCP");
COMPONENT NSVC__CT_component_vc__NSP__IP;
COMPONENT NSVC__CT_component_vc__NSP__FR;
NSint__SP__PT NSVC__CT_component_NS__SP("NS_SP");
NSVCConfiguration NSVC__CT_component_g__nsvc__config;
NSConfiguration NSVC__CT_component_g__config;
NsvcState NSVC__CT_component_vc__state;
TIMER NSVC__CT_component_Tns__alive("Tns_alive", 3.0);
TIMER NSVC__CT_component_Tns__test("Tns_test", 1.0e1);
TIMER NSVC__CT_component_Tns__block("Tns_block", 1.0e1);
TIMER NSVC__CT_component_Tns__reset("Tns_reset", 1.0e1);
CHARSTRING const_NSVCStart_id_defval;
const CHARSTRING& NSVCStart_id_defval = const_NSVCStart_id_defval;
COMPONENT const_NSVCStart_nsp__ip_defval;
const COMPONENT& NSVCStart_nsp__ip_defval = const_NSVCStart_nsp__ip_defval;
TTCN_Module module_object("NS_Emulation", __DATE__, __TIME__, module_checksum, pre_init_module, NULL, 0U, 4294967295U, 4294967295U, 4294967295U, NULL, 0LU, 0, post_init_module, NULL, NULL, NULL, init_comp_type, init_system_port, start_ptc_function, 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 */

NsUnitdataRequest::NsUnitdataRequest()
{
}

NsUnitdataRequest::NsUnitdataRequest(const INTEGER& par_bvci,
    const INTEGER& par_nsei,
    const INTEGER& par_lsp,
    const OPTIONAL< OCTETSTRING >& par_sdu,
    const OPTIONAL< BSSGP__Types::PDU__BSSGP >& par_bssgp)
  :   field_bvci(par_bvci),
  field_nsei(par_nsei),
  field_lsp(par_lsp),
  field_sdu(par_sdu),
  field_bssgp(par_bssgp)
{
}

NsUnitdataRequest::NsUnitdataRequest(const NsUnitdataRequest& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @NS_Emulation.NsUnitdataRequest.");
if (other_value.bvci().is_bound()) field_bvci = other_value.bvci();
else field_bvci.clean_up();
if (other_value.nsei().is_bound()) field_nsei = other_value.nsei();
else field_nsei.clean_up();
if (other_value.lsp().is_bound()) field_lsp = other_value.lsp();
else field_lsp.clean_up();
if (other_value.sdu().is_bound()) field_sdu = other_value.sdu();
else field_sdu.clean_up();
if (other_value.bssgp().is_bound()) field_bssgp = other_value.bssgp();
else field_bssgp.clean_up();
}

void NsUnitdataRequest::clean_up()
{
field_bvci.clean_up();
field_nsei.clean_up();
field_lsp.clean_up();
field_sdu.clean_up();
field_bssgp.clean_up();
}

const TTCN_Typedescriptor_t* NsUnitdataRequest::get_descriptor() const { return &NsUnitdataRequest_descr_; }
NsUnitdataRequest& NsUnitdataRequest::operator=(const NsUnitdataRequest& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @NS_Emulation.NsUnitdataRequest.");
  if (other_value.bvci().is_bound()) field_bvci = other_value.bvci();
  else field_bvci.clean_up();
  if (other_value.nsei().is_bound()) field_nsei = other_value.nsei();
  else field_nsei.clean_up();
  if (other_value.lsp().is_bound()) field_lsp = other_value.lsp();
  else field_lsp.clean_up();
  if (other_value.sdu().is_bound()) field_sdu = other_value.sdu();
  else field_sdu.clean_up();
  if (other_value.bssgp().is_bound()) field_bssgp = other_value.bssgp();
  else field_bssgp.clean_up();
}
return *this;
}

boolean NsUnitdataRequest::operator==(const NsUnitdataRequest& other_value) const
{
return field_bvci==other_value.field_bvci
  && field_nsei==other_value.field_nsei
  && field_lsp==other_value.field_lsp
  && field_sdu==other_value.field_sdu
  && field_bssgp==other_value.field_bssgp;
}

boolean NsUnitdataRequest::is_bound() const
{
return (field_bvci.is_bound())
  || (field_nsei.is_bound())
  || (field_lsp.is_bound())
  || (OPTIONAL_OMIT == field_sdu.get_selection() || field_sdu.is_bound())
  || (OPTIONAL_OMIT == field_bssgp.get_selection() || field_bssgp.is_bound());
}
boolean NsUnitdataRequest::is_value() const
{
return field_bvci.is_value()
  && field_nsei.is_value()
  && field_lsp.is_value()
  && (OPTIONAL_OMIT == field_sdu.get_selection() || field_sdu.is_value())
  && (OPTIONAL_OMIT == field_bssgp.get_selection() || field_bssgp.is_value());
}
int NsUnitdataRequest::size_of() const
{
  int ret_val = 3;
  if (field_sdu.ispresent()) ret_val++;
  if (field_bssgp.ispresent()) ret_val++;
  return ret_val;
}

void NsUnitdataRequest::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ bvci := ");
field_bvci.log();
TTCN_Logger::log_event_str(", nsei := ");
field_nsei.log();
TTCN_Logger::log_event_str(", lsp := ");
field_lsp.log();
TTCN_Logger::log_event_str(", sdu := ");
field_sdu.log();
TTCN_Logger::log_event_str(", bssgp := ");
field_bssgp.log();
TTCN_Logger::log_event_str(" }");
}

void NsUnitdataRequest::set_implicit_omit()
{
if (bvci().is_bound()) bvci().set_implicit_omit();
if (nsei().is_bound()) nsei().set_implicit_omit();
if (lsp().is_bound()) lsp().set_implicit_omit();
if (!sdu().is_bound()) sdu() = OMIT_VALUE;
else sdu().set_implicit_omit();
if (!bssgp().is_bound()) bssgp() = OMIT_VALUE;
else bssgp().set_implicit_omit();
}

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

void NsUnitdataRequest::encode_text(Text_Buf& text_buf) const
{
field_bvci.encode_text(text_buf);
field_nsei.encode_text(text_buf);
field_lsp.encode_text(text_buf);
field_sdu.encode_text(text_buf);
field_bssgp.encode_text(text_buf);
}

void NsUnitdataRequest::decode_text(Text_Buf& text_buf)
{
field_bvci.decode_text(text_buf);
field_nsei.decode_text(text_buf);
field_lsp.decode_text(text_buf);
field_sdu.decode_text(text_buf);
field_bssgp.decode_text(text_buf);
}

struct NsUnitdataRequest_template::single_value_struct {
INTEGER_template field_bvci;
INTEGER_template field_nsei;
INTEGER_template field_lsp;
OCTETSTRING_template field_sdu;
BSSGP__Types::PDU__BSSGP_template field_bssgp;
};

void NsUnitdataRequest_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_bvci = ANY_VALUE;
single_value->field_nsei = ANY_VALUE;
single_value->field_lsp = ANY_VALUE;
single_value->field_sdu = ANY_OR_OMIT;
single_value->field_bssgp = ANY_OR_OMIT;
}
}
}

void NsUnitdataRequest_template::copy_value(const NsUnitdataRequest& other_value)
{
single_value = new single_value_struct;
if (other_value.bvci().is_bound()) {
  single_value->field_bvci = other_value.bvci();
} else {
  single_value->field_bvci.clean_up();
}
if (other_value.nsei().is_bound()) {
  single_value->field_nsei = other_value.nsei();
} else {
  single_value->field_nsei.clean_up();
}
if (other_value.lsp().is_bound()) {
  single_value->field_lsp = other_value.lsp();
} else {
  single_value->field_lsp.clean_up();
}
if (other_value.sdu().is_bound()) {
  if (other_value.sdu().ispresent()) single_value->field_sdu = other_value.sdu()();
  else single_value->field_sdu = OMIT_VALUE;
} else {
  single_value->field_sdu.clean_up();
}
if (other_value.bssgp().is_bound()) {
  if (other_value.bssgp().ispresent()) single_value->field_bssgp = other_value.bssgp()();
  else single_value->field_bssgp = OMIT_VALUE;
} else {
  single_value->field_bssgp.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void NsUnitdataRequest_template::copy_template(const NsUnitdataRequest_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.bvci().get_selection()) {
single_value->field_bvci = other_value.bvci();
} else {
single_value->field_bvci.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.nsei().get_selection()) {
single_value->field_nsei = other_value.nsei();
} else {
single_value->field_nsei.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lsp().get_selection()) {
single_value->field_lsp = other_value.lsp();
} else {
single_value->field_lsp.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.sdu().get_selection()) {
single_value->field_sdu = other_value.sdu();
} else {
single_value->field_sdu.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.bssgp().get_selection()) {
single_value->field_bssgp = other_value.bssgp();
} else {
single_value->field_bssgp.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 NsUnitdataRequest_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 NsUnitdataRequest_template(*other_value.implication_.precondition);
implication_.implied_template = new NsUnitdataRequest_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 @NS_Emulation.NsUnitdataRequest.");
break;
}
set_selection(other_value);
}

NsUnitdataRequest_template::NsUnitdataRequest_template()
{
}

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

NsUnitdataRequest_template::NsUnitdataRequest_template(const NsUnitdataRequest& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean NsUnitdataRequest_template::match(const NsUnitdataRequest& 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.bvci().is_bound()) return FALSE;
if(!single_value->field_bvci.match(other_value.bvci(), legacy))return FALSE;
if(!other_value.nsei().is_bound()) return FALSE;
if(!single_value->field_nsei.match(other_value.nsei(), legacy))return FALSE;
if(!other_value.lsp().is_bound()) return FALSE;
if(!single_value->field_lsp.match(other_value.lsp(), legacy))return FALSE;
if(!other_value.sdu().is_bound()) return FALSE;
if((other_value.sdu().ispresent() ? !single_value->field_sdu.match((const OCTETSTRING&)other_value.sdu(), legacy) : !single_value->field_sdu.match_omit(legacy)))return FALSE;
if(!other_value.bssgp().is_bound()) return FALSE;
if((other_value.bssgp().ispresent() ? !single_value->field_bssgp.match((const BSSGP__Types::PDU__BSSGP&)other_value.bssgp(), legacy) : !single_value->field_bssgp.match_omit(legacy)))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @NS_Emulation.NsUnitdataRequest.");
}
return FALSE;
}

boolean NsUnitdataRequest_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_bvci.is_bound()
 || single_value->field_nsei.is_bound()
 || single_value->field_lsp.is_bound()
 || (single_value->field_sdu.is_omit() || single_value->field_sdu.is_bound())
 || (single_value->field_bssgp.is_omit() || single_value->field_bssgp.is_bound());
}

boolean NsUnitdataRequest_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_bvci.is_value()
 && single_value->field_nsei.is_value()
 && single_value->field_lsp.is_value()
 && (single_value->field_sdu.is_omit() || single_value->field_sdu.is_value())
 && (single_value->field_bssgp.is_omit() || single_value->field_bssgp.is_value());
}

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

NsUnitdataRequest NsUnitdataRequest_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 @NS_Emulation.NsUnitdataRequest.");
NsUnitdataRequest ret_val;
if (single_value->field_bvci.is_bound()) {
ret_val.bvci() = single_value->field_bvci.valueof();
}
if (single_value->field_nsei.is_bound()) {
ret_val.nsei() = single_value->field_nsei.valueof();
}
if (single_value->field_lsp.is_bound()) {
ret_val.lsp() = single_value->field_lsp.valueof();
}
if (single_value->field_sdu.is_omit()) ret_val.sdu() = OMIT_VALUE;
else if (single_value->field_sdu.is_bound()) {
ret_val.sdu() = single_value->field_sdu.valueof();
}
if (single_value->field_bssgp.is_omit()) ret_val.bssgp() = OMIT_VALUE;
else if (single_value->field_bssgp.is_bound()) {
ret_val.bssgp() = single_value->field_bssgp.valueof();
}
return ret_val;
}

void NsUnitdataRequest_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 @NS_Emulation.NsUnitdataRequest.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new NsUnitdataRequest_template[list_length];
}

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

INTEGER_template& NsUnitdataRequest_template::bvci()
{
set_specific();
return single_value->field_bvci;
}

const INTEGER_template& NsUnitdataRequest_template::bvci() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field bvci of a non-specific template of type @NS_Emulation.NsUnitdataRequest.");
return single_value->field_bvci;
}

INTEGER_template& NsUnitdataRequest_template::nsei()
{
set_specific();
return single_value->field_nsei;
}

const INTEGER_template& NsUnitdataRequest_template::nsei() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field nsei of a non-specific template of type @NS_Emulation.NsUnitdataRequest.");
return single_value->field_nsei;
}

INTEGER_template& NsUnitdataRequest_template::lsp()
{
set_specific();
return single_value->field_lsp;
}

const INTEGER_template& NsUnitdataRequest_template::lsp() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lsp of a non-specific template of type @NS_Emulation.NsUnitdataRequest.");
return single_value->field_lsp;
}

OCTETSTRING_template& NsUnitdataRequest_template::sdu()
{
set_specific();
return single_value->field_sdu;
}

const OCTETSTRING_template& NsUnitdataRequest_template::sdu() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field sdu of a non-specific template of type @NS_Emulation.NsUnitdataRequest.");
return single_value->field_sdu;
}

BSSGP__Types::PDU__BSSGP_template& NsUnitdataRequest_template::bssgp()
{
set_specific();
return single_value->field_bssgp;
}

const BSSGP__Types::PDU__BSSGP_template& NsUnitdataRequest_template::bssgp() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field bssgp of a non-specific template of type @NS_Emulation.NsUnitdataRequest.");
return single_value->field_bssgp;
}

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

void NsUnitdataRequest_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ bvci := ");
single_value->field_bvci.log();
TTCN_Logger::log_event_str(", nsei := ");
single_value->field_nsei.log();
TTCN_Logger::log_event_str(", lsp := ");
single_value->field_lsp.log();
TTCN_Logger::log_event_str(", sdu := ");
single_value->field_sdu.log();
TTCN_Logger::log_event_str(", bssgp := ");
single_value->field_bssgp.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 NsUnitdataRequest_template::log_match(const NsUnitdataRequest& 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_bvci.match(match_value.bvci(), legacy)){
TTCN_Logger::log_logmatch_info(".bvci");
single_value->field_bvci.log_match(match_value.bvci(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_nsei.match(match_value.nsei(), legacy)){
TTCN_Logger::log_logmatch_info(".nsei");
single_value->field_nsei.log_match(match_value.nsei(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lsp.match(match_value.lsp(), legacy)){
TTCN_Logger::log_logmatch_info(".lsp");
single_value->field_lsp.log_match(match_value.lsp(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.sdu().ispresent()){
if(!single_value->field_sdu.match(match_value.sdu(), legacy)){
TTCN_Logger::log_logmatch_info(".sdu");
single_value->field_sdu.log_match(match_value.sdu(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_sdu.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".sdu := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_sdu.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.bssgp().ispresent()){
if(!single_value->field_bssgp.match(match_value.bssgp(), legacy)){
TTCN_Logger::log_logmatch_info(".bssgp");
single_value->field_bssgp.log_match(match_value.bssgp(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_bssgp.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".bssgp := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_bssgp.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ bvci := ");
single_value->field_bvci.log_match(match_value.bvci(), legacy);
TTCN_Logger::log_event_str(", nsei := ");
single_value->field_nsei.log_match(match_value.nsei(), legacy);
TTCN_Logger::log_event_str(", lsp := ");
single_value->field_lsp.log_match(match_value.lsp(), legacy);
TTCN_Logger::log_event_str(", sdu := ");
if (match_value.sdu().ispresent()) {
single_value->field_sdu.log_match(match_value.sdu(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_sdu.log();
if (single_value->field_sdu.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", bssgp := ");
if (match_value.bssgp().ispresent()) {
single_value->field_bssgp.log_match(match_value.bssgp(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_bssgp.log();
if (single_value->field_bssgp.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(" }");
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void NsUnitdataRequest_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (bvci().is_bound()) bvci().set_implicit_omit();
if (nsei().is_bound()) nsei().set_implicit_omit();
if (lsp().is_bound()) lsp().set_implicit_omit();
if (!sdu().is_bound()) sdu() = OMIT_VALUE;
else sdu().set_implicit_omit();
if (!bssgp().is_bound()) bssgp() = OMIT_VALUE;
else bssgp().set_implicit_omit();
}

void NsUnitdataRequest_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_bvci.encode_text(text_buf);
single_value->field_nsei.encode_text(text_buf);
single_value->field_lsp.encode_text(text_buf);
single_value->field_sdu.encode_text(text_buf);
single_value->field_bssgp.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 @NS_Emulation.NsUnitdataRequest.");
}
}

void NsUnitdataRequest_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_bvci.decode_text(text_buf);
single_value->field_nsei.decode_text(text_buf);
single_value->field_lsp.decode_text(text_buf);
single_value->field_sdu.decode_text(text_buf);
single_value->field_bssgp.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 NsUnitdataRequest_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 @NS_Emulation.NsUnitdataRequest.");
}
}

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

void NsUnitdataRequest_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_bvci.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NsUnitdataRequest");
single_value->field_nsei.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NsUnitdataRequest");
single_value->field_lsp.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NsUnitdataRequest");
single_value->field_sdu.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NsUnitdataRequest");
single_value->field_bssgp.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NsUnitdataRequest");
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 : "@NS_Emulation.NsUnitdataRequest");
}

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

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

NsUnitdataIndication::NsUnitdataIndication()
{
}

NsUnitdataIndication::NsUnitdataIndication(const INTEGER& par_bvci,
    const INTEGER& par_nsei,
    const INTEGER& par_nsvci,
    const OPTIONAL< OCTETSTRING >& par_sdu,
    const OPTIONAL< BSSGP__Types::PDU__BSSGP >& par_bssgp)
  :   field_bvci(par_bvci),
  field_nsei(par_nsei),
  field_nsvci(par_nsvci),
  field_sdu(par_sdu),
  field_bssgp(par_bssgp)
{
}

NsUnitdataIndication::NsUnitdataIndication(const NsUnitdataIndication& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @NS_Emulation.NsUnitdataIndication.");
if (other_value.bvci().is_bound()) field_bvci = other_value.bvci();
else field_bvci.clean_up();
if (other_value.nsei().is_bound()) field_nsei = other_value.nsei();
else field_nsei.clean_up();
if (other_value.nsvci().is_bound()) field_nsvci = other_value.nsvci();
else field_nsvci.clean_up();
if (other_value.sdu().is_bound()) field_sdu = other_value.sdu();
else field_sdu.clean_up();
if (other_value.bssgp().is_bound()) field_bssgp = other_value.bssgp();
else field_bssgp.clean_up();
}

void NsUnitdataIndication::clean_up()
{
field_bvci.clean_up();
field_nsei.clean_up();
field_nsvci.clean_up();
field_sdu.clean_up();
field_bssgp.clean_up();
}

const TTCN_Typedescriptor_t* NsUnitdataIndication::get_descriptor() const { return &NsUnitdataIndication_descr_; }
NsUnitdataIndication& NsUnitdataIndication::operator=(const NsUnitdataIndication& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @NS_Emulation.NsUnitdataIndication.");
  if (other_value.bvci().is_bound()) field_bvci = other_value.bvci();
  else field_bvci.clean_up();
  if (other_value.nsei().is_bound()) field_nsei = other_value.nsei();
  else field_nsei.clean_up();
  if (other_value.nsvci().is_bound()) field_nsvci = other_value.nsvci();
  else field_nsvci.clean_up();
  if (other_value.sdu().is_bound()) field_sdu = other_value.sdu();
  else field_sdu.clean_up();
  if (other_value.bssgp().is_bound()) field_bssgp = other_value.bssgp();
  else field_bssgp.clean_up();
}
return *this;
}

boolean NsUnitdataIndication::operator==(const NsUnitdataIndication& other_value) const
{
return field_bvci==other_value.field_bvci
  && field_nsei==other_value.field_nsei
  && field_nsvci==other_value.field_nsvci
  && field_sdu==other_value.field_sdu
  && field_bssgp==other_value.field_bssgp;
}

boolean NsUnitdataIndication::is_bound() const
{
return (field_bvci.is_bound())
  || (field_nsei.is_bound())
  || (field_nsvci.is_bound())
  || (OPTIONAL_OMIT == field_sdu.get_selection() || field_sdu.is_bound())
  || (OPTIONAL_OMIT == field_bssgp.get_selection() || field_bssgp.is_bound());
}
boolean NsUnitdataIndication::is_value() const
{
return field_bvci.is_value()
  && field_nsei.is_value()
  && field_nsvci.is_value()
  && (OPTIONAL_OMIT == field_sdu.get_selection() || field_sdu.is_value())
  && (OPTIONAL_OMIT == field_bssgp.get_selection() || field_bssgp.is_value());
}
int NsUnitdataIndication::size_of() const
{
  int ret_val = 3;
  if (field_sdu.ispresent()) ret_val++;
  if (field_bssgp.ispresent()) ret_val++;
  return ret_val;
}

void NsUnitdataIndication::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ bvci := ");
field_bvci.log();
TTCN_Logger::log_event_str(", nsei := ");
field_nsei.log();
TTCN_Logger::log_event_str(", nsvci := ");
field_nsvci.log();
TTCN_Logger::log_event_str(", sdu := ");
field_sdu.log();
TTCN_Logger::log_event_str(", bssgp := ");
field_bssgp.log();
TTCN_Logger::log_event_str(" }");
}

void NsUnitdataIndication::set_implicit_omit()
{
if (bvci().is_bound()) bvci().set_implicit_omit();
if (nsei().is_bound()) nsei().set_implicit_omit();
if (nsvci().is_bound()) nsvci().set_implicit_omit();
if (!sdu().is_bound()) sdu() = OMIT_VALUE;
else sdu().set_implicit_omit();
if (!bssgp().is_bound()) bssgp() = OMIT_VALUE;
else bssgp().set_implicit_omit();
}

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

void NsUnitdataIndication::encode_text(Text_Buf& text_buf) const
{
field_bvci.encode_text(text_buf);
field_nsei.encode_text(text_buf);
field_nsvci.encode_text(text_buf);
field_sdu.encode_text(text_buf);
field_bssgp.encode_text(text_buf);
}

void NsUnitdataIndication::decode_text(Text_Buf& text_buf)
{
field_bvci.decode_text(text_buf);
field_nsei.decode_text(text_buf);
field_nsvci.decode_text(text_buf);
field_sdu.decode_text(text_buf);
field_bssgp.decode_text(text_buf);
}

struct NsUnitdataIndication_template::single_value_struct {
INTEGER_template field_bvci;
INTEGER_template field_nsei;
INTEGER_template field_nsvci;
OCTETSTRING_template field_sdu;
BSSGP__Types::PDU__BSSGP_template field_bssgp;
};

void NsUnitdataIndication_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_bvci = ANY_VALUE;
single_value->field_nsei = ANY_VALUE;
single_value->field_nsvci = ANY_VALUE;
single_value->field_sdu = ANY_OR_OMIT;
single_value->field_bssgp = ANY_OR_OMIT;
}
}
}

void NsUnitdataIndication_template::copy_value(const NsUnitdataIndication& other_value)
{
single_value = new single_value_struct;
if (other_value.bvci().is_bound()) {
  single_value->field_bvci = other_value.bvci();
} else {
  single_value->field_bvci.clean_up();
}
if (other_value.nsei().is_bound()) {
  single_value->field_nsei = other_value.nsei();
} else {
  single_value->field_nsei.clean_up();
}
if (other_value.nsvci().is_bound()) {
  single_value->field_nsvci = other_value.nsvci();
} else {
  single_value->field_nsvci.clean_up();
}
if (other_value.sdu().is_bound()) {
  if (other_value.sdu().ispresent()) single_value->field_sdu = other_value.sdu()();
  else single_value->field_sdu = OMIT_VALUE;
} else {
  single_value->field_sdu.clean_up();
}
if (other_value.bssgp().is_bound()) {
  if (other_value.bssgp().ispresent()) single_value->field_bssgp = other_value.bssgp()();
  else single_value->field_bssgp = OMIT_VALUE;
} else {
  single_value->field_bssgp.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void NsUnitdataIndication_template::copy_template(const NsUnitdataIndication_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.bvci().get_selection()) {
single_value->field_bvci = other_value.bvci();
} else {
single_value->field_bvci.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.nsei().get_selection()) {
single_value->field_nsei = other_value.nsei();
} else {
single_value->field_nsei.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.nsvci().get_selection()) {
single_value->field_nsvci = other_value.nsvci();
} else {
single_value->field_nsvci.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.sdu().get_selection()) {
single_value->field_sdu = other_value.sdu();
} else {
single_value->field_sdu.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.bssgp().get_selection()) {
single_value->field_bssgp = other_value.bssgp();
} else {
single_value->field_bssgp.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 NsUnitdataIndication_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 NsUnitdataIndication_template(*other_value.implication_.precondition);
implication_.implied_template = new NsUnitdataIndication_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 @NS_Emulation.NsUnitdataIndication.");
break;
}
set_selection(other_value);
}

NsUnitdataIndication_template::NsUnitdataIndication_template()
{
}

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

NsUnitdataIndication_template::NsUnitdataIndication_template(const NsUnitdataIndication& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean NsUnitdataIndication_template::match(const NsUnitdataIndication& 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.bvci().is_bound()) return FALSE;
if(!single_value->field_bvci.match(other_value.bvci(), legacy))return FALSE;
if(!other_value.nsei().is_bound()) return FALSE;
if(!single_value->field_nsei.match(other_value.nsei(), legacy))return FALSE;
if(!other_value.nsvci().is_bound()) return FALSE;
if(!single_value->field_nsvci.match(other_value.nsvci(), legacy))return FALSE;
if(!other_value.sdu().is_bound()) return FALSE;
if((other_value.sdu().ispresent() ? !single_value->field_sdu.match((const OCTETSTRING&)other_value.sdu(), legacy) : !single_value->field_sdu.match_omit(legacy)))return FALSE;
if(!other_value.bssgp().is_bound()) return FALSE;
if((other_value.bssgp().ispresent() ? !single_value->field_bssgp.match((const BSSGP__Types::PDU__BSSGP&)other_value.bssgp(), legacy) : !single_value->field_bssgp.match_omit(legacy)))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @NS_Emulation.NsUnitdataIndication.");
}
return FALSE;
}

boolean NsUnitdataIndication_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_bvci.is_bound()
 || single_value->field_nsei.is_bound()
 || single_value->field_nsvci.is_bound()
 || (single_value->field_sdu.is_omit() || single_value->field_sdu.is_bound())
 || (single_value->field_bssgp.is_omit() || single_value->field_bssgp.is_bound());
}

boolean NsUnitdataIndication_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_bvci.is_value()
 && single_value->field_nsei.is_value()
 && single_value->field_nsvci.is_value()
 && (single_value->field_sdu.is_omit() || single_value->field_sdu.is_value())
 && (single_value->field_bssgp.is_omit() || single_value->field_bssgp.is_value());
}

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

NsUnitdataIndication NsUnitdataIndication_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 @NS_Emulation.NsUnitdataIndication.");
NsUnitdataIndication ret_val;
if (single_value->field_bvci.is_bound()) {
ret_val.bvci() = single_value->field_bvci.valueof();
}
if (single_value->field_nsei.is_bound()) {
ret_val.nsei() = single_value->field_nsei.valueof();
}
if (single_value->field_nsvci.is_bound()) {
ret_val.nsvci() = single_value->field_nsvci.valueof();
}
if (single_value->field_sdu.is_omit()) ret_val.sdu() = OMIT_VALUE;
else if (single_value->field_sdu.is_bound()) {
ret_val.sdu() = single_value->field_sdu.valueof();
}
if (single_value->field_bssgp.is_omit()) ret_val.bssgp() = OMIT_VALUE;
else if (single_value->field_bssgp.is_bound()) {
ret_val.bssgp() = single_value->field_bssgp.valueof();
}
return ret_val;
}

void NsUnitdataIndication_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 @NS_Emulation.NsUnitdataIndication.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new NsUnitdataIndication_template[list_length];
}

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

INTEGER_template& NsUnitdataIndication_template::bvci()
{
set_specific();
return single_value->field_bvci;
}

const INTEGER_template& NsUnitdataIndication_template::bvci() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field bvci of a non-specific template of type @NS_Emulation.NsUnitdataIndication.");
return single_value->field_bvci;
}

INTEGER_template& NsUnitdataIndication_template::nsei()
{
set_specific();
return single_value->field_nsei;
}

const INTEGER_template& NsUnitdataIndication_template::nsei() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field nsei of a non-specific template of type @NS_Emulation.NsUnitdataIndication.");
return single_value->field_nsei;
}

INTEGER_template& NsUnitdataIndication_template::nsvci()
{
set_specific();
return single_value->field_nsvci;
}

const INTEGER_template& NsUnitdataIndication_template::nsvci() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field nsvci of a non-specific template of type @NS_Emulation.NsUnitdataIndication.");
return single_value->field_nsvci;
}

OCTETSTRING_template& NsUnitdataIndication_template::sdu()
{
set_specific();
return single_value->field_sdu;
}

const OCTETSTRING_template& NsUnitdataIndication_template::sdu() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field sdu of a non-specific template of type @NS_Emulation.NsUnitdataIndication.");
return single_value->field_sdu;
}

BSSGP__Types::PDU__BSSGP_template& NsUnitdataIndication_template::bssgp()
{
set_specific();
return single_value->field_bssgp;
}

const BSSGP__Types::PDU__BSSGP_template& NsUnitdataIndication_template::bssgp() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field bssgp of a non-specific template of type @NS_Emulation.NsUnitdataIndication.");
return single_value->field_bssgp;
}

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

void NsUnitdataIndication_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ bvci := ");
single_value->field_bvci.log();
TTCN_Logger::log_event_str(", nsei := ");
single_value->field_nsei.log();
TTCN_Logger::log_event_str(", nsvci := ");
single_value->field_nsvci.log();
TTCN_Logger::log_event_str(", sdu := ");
single_value->field_sdu.log();
TTCN_Logger::log_event_str(", bssgp := ");
single_value->field_bssgp.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 NsUnitdataIndication_template::log_match(const NsUnitdataIndication& 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_bvci.match(match_value.bvci(), legacy)){
TTCN_Logger::log_logmatch_info(".bvci");
single_value->field_bvci.log_match(match_value.bvci(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_nsei.match(match_value.nsei(), legacy)){
TTCN_Logger::log_logmatch_info(".nsei");
single_value->field_nsei.log_match(match_value.nsei(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_nsvci.match(match_value.nsvci(), legacy)){
TTCN_Logger::log_logmatch_info(".nsvci");
single_value->field_nsvci.log_match(match_value.nsvci(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.sdu().ispresent()){
if(!single_value->field_sdu.match(match_value.sdu(), legacy)){
TTCN_Logger::log_logmatch_info(".sdu");
single_value->field_sdu.log_match(match_value.sdu(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_sdu.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".sdu := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_sdu.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.bssgp().ispresent()){
if(!single_value->field_bssgp.match(match_value.bssgp(), legacy)){
TTCN_Logger::log_logmatch_info(".bssgp");
single_value->field_bssgp.log_match(match_value.bssgp(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_bssgp.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".bssgp := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_bssgp.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ bvci := ");
single_value->field_bvci.log_match(match_value.bvci(), legacy);
TTCN_Logger::log_event_str(", nsei := ");
single_value->field_nsei.log_match(match_value.nsei(), legacy);
TTCN_Logger::log_event_str(", nsvci := ");
single_value->field_nsvci.log_match(match_value.nsvci(), legacy);
TTCN_Logger::log_event_str(", sdu := ");
if (match_value.sdu().ispresent()) {
single_value->field_sdu.log_match(match_value.sdu(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_sdu.log();
if (single_value->field_sdu.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", bssgp := ");
if (match_value.bssgp().ispresent()) {
single_value->field_bssgp.log_match(match_value.bssgp(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_bssgp.log();
if (single_value->field_bssgp.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(" }");
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void NsUnitdataIndication_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (bvci().is_bound()) bvci().set_implicit_omit();
if (nsei().is_bound()) nsei().set_implicit_omit();
if (nsvci().is_bound()) nsvci().set_implicit_omit();
if (!sdu().is_bound()) sdu() = OMIT_VALUE;
else sdu().set_implicit_omit();
if (!bssgp().is_bound()) bssgp() = OMIT_VALUE;
else bssgp().set_implicit_omit();
}

void NsUnitdataIndication_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_bvci.encode_text(text_buf);
single_value->field_nsei.encode_text(text_buf);
single_value->field_nsvci.encode_text(text_buf);
single_value->field_sdu.encode_text(text_buf);
single_value->field_bssgp.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 @NS_Emulation.NsUnitdataIndication.");
}
}

void NsUnitdataIndication_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_bvci.decode_text(text_buf);
single_value->field_nsei.decode_text(text_buf);
single_value->field_nsvci.decode_text(text_buf);
single_value->field_sdu.decode_text(text_buf);
single_value->field_bssgp.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 NsUnitdataIndication_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 @NS_Emulation.NsUnitdataIndication.");
}
}

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

void NsUnitdataIndication_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_bvci.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NsUnitdataIndication");
single_value->field_nsei.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NsUnitdataIndication");
single_value->field_nsvci.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NsUnitdataIndication");
single_value->field_sdu.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NsUnitdataIndication");
single_value->field_bssgp.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NsUnitdataIndication");
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 : "@NS_Emulation.NsUnitdataIndication");
}

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

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

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

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

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

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

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

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

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

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

boolean NsvcState::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 @NS_Emulation.NsvcState.");
return enum_value == other_value;
}

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

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

boolean NsvcState::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 @NS_Emulation.NsvcState.");
return enum_value < other_value;
}

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

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

boolean NsvcState::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 @NS_Emulation.NsvcState.");
return enum_value > other_value;
}

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

const char *NsvcState::enum_to_str(enum_type enum_par)
{
switch (enum_par) {
case NSVC__S__DISABLED: return "NSVC_S_DISABLED";
case NSVC__S__DEAD__BLOCKED: return "NSVC_S_DEAD_BLOCKED";
case NSVC__S__WAIT__RESET: return "NSVC_S_WAIT_RESET";
case NSVC__S__ALIVE__BLOCKED: return "NSVC_S_ALIVE_BLOCKED";
case NSVC__S__ALIVE__UNBLOCKED: return "NSVC_S_ALIVE_UNBLOCKED";
default:
return "<unknown>";
}
}

NsvcState::enum_type NsvcState::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, "NSVC_S_DISABLED")) return NSVC__S__DISABLED;
if (!strcmp(str_par, "NSVC_S_DEAD_BLOCKED")) return NSVC__S__DEAD__BLOCKED;
if (!strcmp(str_par, "NSVC_S_WAIT_RESET")) return NSVC__S__WAIT__RESET;
if (!strcmp(str_par, "NSVC_S_ALIVE_BLOCKED")) return NSVC__S__ALIVE__BLOCKED;
if (!strcmp(str_par, "NSVC_S_ALIVE_UNBLOCKED")) return NSVC__S__ALIVE__UNBLOCKED;
}
return UNKNOWN_VALUE;
}

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

int NsvcState::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 @NS_Emulation.NsvcState.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par;
}

int NsvcState::enum2int(const NsvcState& 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 @NS_Emulation.NsvcState.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par.enum_value;
}

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

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

void NsvcState::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 NsvcState::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", "@NS_Emulation.NsvcState");
  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 @NS_Emulation.NsvcState.");
  }
}

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

void NsvcState::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 @NS_Emulation.NsvcState.", enum_value);
}

void NsvcState_template::copy_template(const NsvcState_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 NsvcState_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 NsvcState_template(*other_value.implication_.precondition);
implication_.implied_template = new NsvcState_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 @NS_Emulation.NsvcState.");
}
}

NsvcState_template::NsvcState_template()
{
}

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

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

NsvcState_template::NsvcState_template(NsvcState::enum_type other_value)
 : Base_Template(SPECIFIC_VALUE)
{
single_value = other_value;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

NsvcState_template& NsvcState_template::operator=(const OPTIONAL<NsvcState>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (NsvcState::enum_type)(const NsvcState&)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 @NS_Emulation.NsvcState.");
}
return *this;
}

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

boolean NsvcState_template::match(NsvcState::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 @NS_Emulation.NsvcState.");
}
return FALSE;
}

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

NsvcState::enum_type NsvcState_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 @NS_Emulation.NsvcState.");
return single_value;
}

void NsvcState_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 NsvcState_template[list_length];
break;
default:
TTCN_error("Setting an invalid type for a template of enumerated type @NS_Emulation.NsvcState.");
}
}

NsvcState_template& NsvcState_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 @NS_Emulation.NsvcState.");
if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @NS_Emulation.NsvcState.");
return value_list.list_value[list_index];
}

void NsvcState_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_enum(NsvcState::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 NsvcState_template::log_match(const NsvcState& 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 NsvcState_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 @NS_Emulation.NsvcState.");
}
}

void NsvcState_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = (NsvcState::enum_type)text_buf.pull_int().get_val();
if (!NsvcState::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @NS_Emulation.NsvcState.", 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 NsvcState_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 @NS_Emulation.NsvcState.");
}
}

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

boolean NsvcState_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 NsvcState_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: {
    NsvcState_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: {
    NsvcState::enum_type enum_val = NsvcState::str_to_enum(m_p->get_enumerated(), m_p->get_enumerated_value());
    if (!NsvcState::is_valid_enum(enum_val)) {
      param.error("Invalid enumerated value for type @NS_Emulation.NsvcState.");
    }
    *this = enum_val;
  } break;
  case Module_Param::MP_Implication_Template: {
    NsvcState_template* precondition = new NsvcState_template;
    precondition->set_param(*m_p->get_elem(0));
    NsvcState_template* implied_template = new NsvcState_template;
    implied_template->set_param(*m_p->get_elem(1));
    *this = NsvcState_template(precondition, implied_template);
  } break;
  default:
    param.type_error("enumerated template", "@NS_Emulation.NsvcState");
  }
  is_ifpresent = param.get_ifpresent();
}

void NsvcState_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 : "@NS_Emulation.NsvcState");
}

NsStatusIndication::NsStatusIndication()
{
}

NsStatusIndication::NsStatusIndication(const INTEGER& par_nsei,
    const INTEGER& par_nsvci,
    const NsvcState& par_old__state,
    const NsvcState& par_new__state,
    const BOOLEAN& par_first__or__last)
  :   field_nsei(par_nsei),
  field_nsvci(par_nsvci),
  field_old__state(par_old__state),
  field_new__state(par_new__state),
  field_first__or__last(par_first__or__last)
{
}

NsStatusIndication::NsStatusIndication(const NsStatusIndication& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @NS_Emulation.NsStatusIndication.");
if (other_value.nsei().is_bound()) field_nsei = other_value.nsei();
else field_nsei.clean_up();
if (other_value.nsvci().is_bound()) field_nsvci = other_value.nsvci();
else field_nsvci.clean_up();
if (other_value.old__state().is_bound()) field_old__state = other_value.old__state();
else field_old__state.clean_up();
if (other_value.new__state().is_bound()) field_new__state = other_value.new__state();
else field_new__state.clean_up();
if (other_value.first__or__last().is_bound()) field_first__or__last = other_value.first__or__last();
else field_first__or__last.clean_up();
}

void NsStatusIndication::clean_up()
{
field_nsei.clean_up();
field_nsvci.clean_up();
field_old__state.clean_up();
field_new__state.clean_up();
field_first__or__last.clean_up();
}

const TTCN_Typedescriptor_t* NsStatusIndication::get_descriptor() const { return &NsStatusIndication_descr_; }
NsStatusIndication& NsStatusIndication::operator=(const NsStatusIndication& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @NS_Emulation.NsStatusIndication.");
  if (other_value.nsei().is_bound()) field_nsei = other_value.nsei();
  else field_nsei.clean_up();
  if (other_value.nsvci().is_bound()) field_nsvci = other_value.nsvci();
  else field_nsvci.clean_up();
  if (other_value.old__state().is_bound()) field_old__state = other_value.old__state();
  else field_old__state.clean_up();
  if (other_value.new__state().is_bound()) field_new__state = other_value.new__state();
  else field_new__state.clean_up();
  if (other_value.first__or__last().is_bound()) field_first__or__last = other_value.first__or__last();
  else field_first__or__last.clean_up();
}
return *this;
}

boolean NsStatusIndication::operator==(const NsStatusIndication& other_value) const
{
return field_nsei==other_value.field_nsei
  && field_nsvci==other_value.field_nsvci
  && field_old__state==other_value.field_old__state
  && field_new__state==other_value.field_new__state
  && field_first__or__last==other_value.field_first__or__last;
}

boolean NsStatusIndication::is_bound() const
{
return (field_nsei.is_bound())
  || (field_nsvci.is_bound())
  || (field_old__state.is_bound())
  || (field_new__state.is_bound())
  || (field_first__or__last.is_bound());
}
boolean NsStatusIndication::is_value() const
{
return field_nsei.is_value()
  && field_nsvci.is_value()
  && field_old__state.is_value()
  && field_new__state.is_value()
  && field_first__or__last.is_value();
}
void NsStatusIndication::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ nsei := ");
field_nsei.log();
TTCN_Logger::log_event_str(", nsvci := ");
field_nsvci.log();
TTCN_Logger::log_event_str(", old_state := ");
field_old__state.log();
TTCN_Logger::log_event_str(", new_state := ");
field_new__state.log();
TTCN_Logger::log_event_str(", first_or_last := ");
field_first__or__last.log();
TTCN_Logger::log_event_str(" }");
}

void NsStatusIndication::set_implicit_omit()
{
if (nsei().is_bound()) nsei().set_implicit_omit();
if (nsvci().is_bound()) nsvci().set_implicit_omit();
if (old__state().is_bound()) old__state().set_implicit_omit();
if (new__state().is_bound()) new__state().set_implicit_omit();
if (first__or__last().is_bound()) first__or__last().set_implicit_omit();
}

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

void NsStatusIndication::encode_text(Text_Buf& text_buf) const
{
field_nsei.encode_text(text_buf);
field_nsvci.encode_text(text_buf);
field_old__state.encode_text(text_buf);
field_new__state.encode_text(text_buf);
field_first__or__last.encode_text(text_buf);
}

void NsStatusIndication::decode_text(Text_Buf& text_buf)
{
field_nsei.decode_text(text_buf);
field_nsvci.decode_text(text_buf);
field_old__state.decode_text(text_buf);
field_new__state.decode_text(text_buf);
field_first__or__last.decode_text(text_buf);
}

struct NsStatusIndication_template::single_value_struct {
INTEGER_template field_nsei;
INTEGER_template field_nsvci;
NsvcState_template field_old__state;
NsvcState_template field_new__state;
BOOLEAN_template field_first__or__last;
};

void NsStatusIndication_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_nsei = ANY_VALUE;
single_value->field_nsvci = ANY_VALUE;
single_value->field_old__state = ANY_VALUE;
single_value->field_new__state = ANY_VALUE;
single_value->field_first__or__last = ANY_VALUE;
}
}
}

void NsStatusIndication_template::copy_value(const NsStatusIndication& other_value)
{
single_value = new single_value_struct;
if (other_value.nsei().is_bound()) {
  single_value->field_nsei = other_value.nsei();
} else {
  single_value->field_nsei.clean_up();
}
if (other_value.nsvci().is_bound()) {
  single_value->field_nsvci = other_value.nsvci();
} else {
  single_value->field_nsvci.clean_up();
}
if (other_value.old__state().is_bound()) {
  single_value->field_old__state = other_value.old__state();
} else {
  single_value->field_old__state.clean_up();
}
if (other_value.new__state().is_bound()) {
  single_value->field_new__state = other_value.new__state();
} else {
  single_value->field_new__state.clean_up();
}
if (other_value.first__or__last().is_bound()) {
  single_value->field_first__or__last = other_value.first__or__last();
} else {
  single_value->field_first__or__last.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void NsStatusIndication_template::copy_template(const NsStatusIndication_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.nsei().get_selection()) {
single_value->field_nsei = other_value.nsei();
} else {
single_value->field_nsei.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.nsvci().get_selection()) {
single_value->field_nsvci = other_value.nsvci();
} else {
single_value->field_nsvci.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.old__state().get_selection()) {
single_value->field_old__state = other_value.old__state();
} else {
single_value->field_old__state.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.new__state().get_selection()) {
single_value->field_new__state = other_value.new__state();
} else {
single_value->field_new__state.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.first__or__last().get_selection()) {
single_value->field_first__or__last = other_value.first__or__last();
} else {
single_value->field_first__or__last.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 NsStatusIndication_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 NsStatusIndication_template(*other_value.implication_.precondition);
implication_.implied_template = new NsStatusIndication_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 @NS_Emulation.NsStatusIndication.");
break;
}
set_selection(other_value);
}

NsStatusIndication_template::NsStatusIndication_template()
{
}

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

NsStatusIndication_template::NsStatusIndication_template(const NsStatusIndication& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean NsStatusIndication_template::match(const NsStatusIndication& 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.nsei().is_bound()) return FALSE;
if(!single_value->field_nsei.match(other_value.nsei(), legacy))return FALSE;
if(!other_value.nsvci().is_bound()) return FALSE;
if(!single_value->field_nsvci.match(other_value.nsvci(), legacy))return FALSE;
if(!other_value.old__state().is_bound()) return FALSE;
if(!single_value->field_old__state.match(other_value.old__state(), legacy))return FALSE;
if(!other_value.new__state().is_bound()) return FALSE;
if(!single_value->field_new__state.match(other_value.new__state(), legacy))return FALSE;
if(!other_value.first__or__last().is_bound()) return FALSE;
if(!single_value->field_first__or__last.match(other_value.first__or__last(), 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 @NS_Emulation.NsStatusIndication.");
}
return FALSE;
}

boolean NsStatusIndication_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_nsei.is_bound()
 || single_value->field_nsvci.is_bound()
 || single_value->field_old__state.is_bound()
 || single_value->field_new__state.is_bound()
 || single_value->field_first__or__last.is_bound();
}

boolean NsStatusIndication_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_nsei.is_value()
 && single_value->field_nsvci.is_value()
 && single_value->field_old__state.is_value()
 && single_value->field_new__state.is_value()
 && single_value->field_first__or__last.is_value();
}

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

NsStatusIndication NsStatusIndication_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 @NS_Emulation.NsStatusIndication.");
NsStatusIndication ret_val;
if (single_value->field_nsei.is_bound()) {
ret_val.nsei() = single_value->field_nsei.valueof();
}
if (single_value->field_nsvci.is_bound()) {
ret_val.nsvci() = single_value->field_nsvci.valueof();
}
if (single_value->field_old__state.is_bound()) {
ret_val.old__state() = single_value->field_old__state.valueof();
}
if (single_value->field_new__state.is_bound()) {
ret_val.new__state() = single_value->field_new__state.valueof();
}
if (single_value->field_first__or__last.is_bound()) {
ret_val.first__or__last() = single_value->field_first__or__last.valueof();
}
return ret_val;
}

void NsStatusIndication_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 @NS_Emulation.NsStatusIndication.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new NsStatusIndication_template[list_length];
}

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

INTEGER_template& NsStatusIndication_template::nsei()
{
set_specific();
return single_value->field_nsei;
}

const INTEGER_template& NsStatusIndication_template::nsei() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field nsei of a non-specific template of type @NS_Emulation.NsStatusIndication.");
return single_value->field_nsei;
}

INTEGER_template& NsStatusIndication_template::nsvci()
{
set_specific();
return single_value->field_nsvci;
}

const INTEGER_template& NsStatusIndication_template::nsvci() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field nsvci of a non-specific template of type @NS_Emulation.NsStatusIndication.");
return single_value->field_nsvci;
}

NsvcState_template& NsStatusIndication_template::old__state()
{
set_specific();
return single_value->field_old__state;
}

const NsvcState_template& NsStatusIndication_template::old__state() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field old_state of a non-specific template of type @NS_Emulation.NsStatusIndication.");
return single_value->field_old__state;
}

NsvcState_template& NsStatusIndication_template::new__state()
{
set_specific();
return single_value->field_new__state;
}

const NsvcState_template& NsStatusIndication_template::new__state() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field new_state of a non-specific template of type @NS_Emulation.NsStatusIndication.");
return single_value->field_new__state;
}

BOOLEAN_template& NsStatusIndication_template::first__or__last()
{
set_specific();
return single_value->field_first__or__last;
}

const BOOLEAN_template& NsStatusIndication_template::first__or__last() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field first_or_last of a non-specific template of type @NS_Emulation.NsStatusIndication.");
return single_value->field_first__or__last;
}

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

void NsStatusIndication_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ nsei := ");
single_value->field_nsei.log();
TTCN_Logger::log_event_str(", nsvci := ");
single_value->field_nsvci.log();
TTCN_Logger::log_event_str(", old_state := ");
single_value->field_old__state.log();
TTCN_Logger::log_event_str(", new_state := ");
single_value->field_new__state.log();
TTCN_Logger::log_event_str(", first_or_last := ");
single_value->field_first__or__last.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 NsStatusIndication_template::log_match(const NsStatusIndication& 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_nsei.match(match_value.nsei(), legacy)){
TTCN_Logger::log_logmatch_info(".nsei");
single_value->field_nsei.log_match(match_value.nsei(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_nsvci.match(match_value.nsvci(), legacy)){
TTCN_Logger::log_logmatch_info(".nsvci");
single_value->field_nsvci.log_match(match_value.nsvci(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_old__state.match(match_value.old__state(), legacy)){
TTCN_Logger::log_logmatch_info(".old_state");
single_value->field_old__state.log_match(match_value.old__state(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_new__state.match(match_value.new__state(), legacy)){
TTCN_Logger::log_logmatch_info(".new_state");
single_value->field_new__state.log_match(match_value.new__state(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_first__or__last.match(match_value.first__or__last(), legacy)){
TTCN_Logger::log_logmatch_info(".first_or_last");
single_value->field_first__or__last.log_match(match_value.first__or__last(), 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("{ nsei := ");
single_value->field_nsei.log_match(match_value.nsei(), legacy);
TTCN_Logger::log_event_str(", nsvci := ");
single_value->field_nsvci.log_match(match_value.nsvci(), legacy);
TTCN_Logger::log_event_str(", old_state := ");
single_value->field_old__state.log_match(match_value.old__state(), legacy);
TTCN_Logger::log_event_str(", new_state := ");
single_value->field_new__state.log_match(match_value.new__state(), legacy);
TTCN_Logger::log_event_str(", first_or_last := ");
single_value->field_first__or__last.log_match(match_value.first__or__last(), 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 NsStatusIndication_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (nsei().is_bound()) nsei().set_implicit_omit();
if (nsvci().is_bound()) nsvci().set_implicit_omit();
if (old__state().is_bound()) old__state().set_implicit_omit();
if (new__state().is_bound()) new__state().set_implicit_omit();
if (first__or__last().is_bound()) first__or__last().set_implicit_omit();
}

void NsStatusIndication_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_nsei.encode_text(text_buf);
single_value->field_nsvci.encode_text(text_buf);
single_value->field_old__state.encode_text(text_buf);
single_value->field_new__state.encode_text(text_buf);
single_value->field_first__or__last.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 @NS_Emulation.NsStatusIndication.");
}
}

void NsStatusIndication_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_nsei.decode_text(text_buf);
single_value->field_nsvci.decode_text(text_buf);
single_value->field_old__state.decode_text(text_buf);
single_value->field_new__state.decode_text(text_buf);
single_value->field_first__or__last.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 NsStatusIndication_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 @NS_Emulation.NsStatusIndication.");
}
}

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

void NsStatusIndication_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_nsei.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NsStatusIndication");
single_value->field_nsvci.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NsStatusIndication");
single_value->field_old__state.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NsStatusIndication");
single_value->field_new__state.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NsStatusIndication");
single_value->field_first__or__last.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NsStatusIndication");
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 : "@NS_Emulation.NsStatusIndication");
}

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

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

void NS__SP__PT::remove_msg_queue_head()
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
switch (my_head->item_selection) {
case MESSAGE_0:
delete (my_head)->message_0;
break;
default:
TTCN_error("Internal error: Invalid message selector in the queue of port %s.", port_name);
}
msg_queue_item_base *next_item = msg_queue_head->next_item;
delete (msg_queue_item*)msg_queue_head;
msg_queue_head = next_item;
if (next_item == NULL) msg_queue_tail = NULL;
TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::extract__msg, port_name, 0, ++msg_head_count, CHARSTRING(0,NULL), CHARSTRING(0,NULL));}

void NS__SP__PT::clear_queue()
{
while (msg_queue_head != NULL) remove_msg_queue_head();
}

NS__SP__PT::NS__SP__PT(const char *par_port_name)
 : PORT(par_port_name)
{
msg_queue_head = NULL;
msg_queue_tail = NULL;
}

NS__SP__PT::~NS__SP__PT()
{
clear_queue();
}

void NS__SP__PT::send(const NsUnitdataIndication& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name);
if (!destination_component.is_bound()) TTCN_error("Unbound component reference in the to clause of send operation.");
const TTCN_Logger::Severity log_sev = destination_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMSEND:TTCN_Logger::PORTEVENT_MCSEND;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_send(port_name, destination_component,
(TTCN_Logger::begin_event(log_sev, TRUE), TTCN_Logger::log_event_str(" @NS_Emulation.NsUnitdataIndication : "),
send_par.log(), TTCN_Logger::end_event_log2str()));
}
if (destination_component == SYSTEM_COMPREF) TTCN_error("Message cannot be sent to system on internal port %s.", port_name);
else {
Text_Buf text_buf;
prepare_message(text_buf, "@NS_Emulation.NsUnitdataIndication");
send_par.encode_text(text_buf);
send_data(text_buf, destination_component);
}
}

void NS__SP__PT::send(const NsUnitdataIndication& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect)
{
for (size_t i = 0; i < nof_components; ++i) send(send_par, destination_components[i], timestamp_redirect);
}

void NS__SP__PT::send(const NsUnitdataIndication& send_par, boolean broadcast, FLOAT* timestamp_redirect)
{
if (broadcast) {
if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name);
Text_Buf text_buf;
prepare_message(text_buf, "@NS_Emulation.NsUnitdataIndication");
send_par.encode_text(text_buf);
send_data_broadcast(text_buf, PORT::OMT_SEND, (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MCSEND, TRUE),
TTCN_Logger::log_event_str(" @NS_Emulation.NsUnitdataIndication : "), send_par.log(), TTCN_Logger::end_event_log2str()));
}
else send(send_par, COMPONENT(get_default_destination()), timestamp_redirect);
}

void NS__SP__PT::send(const NsUnitdataIndication_template& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
const NsUnitdataIndication& send_par_value = NsUnitdataIndication(send_par.valueof());
send(send_par_value, destination_component, timestamp_redirect);
}

void NS__SP__PT::send(const NsUnitdataIndication_template& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect)
{
const NsUnitdataIndication& send_par_value = NsUnitdataIndication(send_par.valueof());
send(send_par_value, nof_components, destination_components, timestamp_redirect);
}

void NS__SP__PT::send(const NsUnitdataIndication_template& send_par, boolean broadcast, FLOAT* timestamp_redirect)
{
const NsUnitdataIndication& send_par_value = NsUnitdataIndication(send_par.valueof());
send(send_par_value, broadcast, timestamp_redirect);
}

void NS__SP__PT::send(const NsStatusIndication& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name);
if (!destination_component.is_bound()) TTCN_error("Unbound component reference in the to clause of send operation.");
const TTCN_Logger::Severity log_sev = destination_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMSEND:TTCN_Logger::PORTEVENT_MCSEND;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_send(port_name, destination_component,
(TTCN_Logger::begin_event(log_sev, TRUE), TTCN_Logger::log_event_str(" @NS_Emulation.NsStatusIndication : "),
send_par.log(), TTCN_Logger::end_event_log2str()));
}
if (destination_component == SYSTEM_COMPREF) TTCN_error("Message cannot be sent to system on internal port %s.", port_name);
else {
Text_Buf text_buf;
prepare_message(text_buf, "@NS_Emulation.NsStatusIndication");
send_par.encode_text(text_buf);
send_data(text_buf, destination_component);
}
}

void NS__SP__PT::send(const NsStatusIndication& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect)
{
for (size_t i = 0; i < nof_components; ++i) send(send_par, destination_components[i], timestamp_redirect);
}

void NS__SP__PT::send(const NsStatusIndication& send_par, boolean broadcast, FLOAT* timestamp_redirect)
{
if (broadcast) {
if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name);
Text_Buf text_buf;
prepare_message(text_buf, "@NS_Emulation.NsStatusIndication");
send_par.encode_text(text_buf);
send_data_broadcast(text_buf, PORT::OMT_SEND, (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MCSEND, TRUE),
TTCN_Logger::log_event_str(" @NS_Emulation.NsStatusIndication : "), send_par.log(), TTCN_Logger::end_event_log2str()));
}
else send(send_par, COMPONENT(get_default_destination()), timestamp_redirect);
}

void NS__SP__PT::send(const NsStatusIndication_template& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
const NsStatusIndication& send_par_value = NsStatusIndication(send_par.valueof());
send(send_par_value, destination_component, timestamp_redirect);
}

void NS__SP__PT::send(const NsStatusIndication_template& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect)
{
const NsStatusIndication& send_par_value = NsStatusIndication(send_par.valueof());
send(send_par_value, nof_components, destination_components, timestamp_redirect);
}

void NS__SP__PT::send(const NsStatusIndication_template& send_par, boolean broadcast, FLOAT* timestamp_redirect)
{
const NsStatusIndication& send_par_value = NsStatusIndication(send_par.valueof());
send(send_par_value, broadcast, timestamp_redirect);
}

alt_status NS__SP__PT::receive(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else {
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS, "Matching on port %s succeeded.", port_name);
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
switch (my_head->item_selection) {
case MESSAGE_0:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsUnitdataRequest: "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
default:
TTCN_error("Internal error: unknown message");
}
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NS__SP__PT::check_receive(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else {
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS, "Matching on port %s succeeded.", port_name);
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
switch (my_head->item_selection) {
case MESSAGE_0:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsUnitdataRequest: "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
default:
TTCN_error("Internal error: unknown message");
}
}
return ALT_YES;
}
}

alt_status NS__SP__PT::trigger(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s will drop a message: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
remove_msg_queue_head();
return ALT_REPEAT;
} else {
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS, "Matching on port %s succeeded.", port_name);
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
switch (my_head->item_selection) {
case MESSAGE_0:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsUnitdataRequest: "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
default:
TTCN_error("Internal error: unknown message");
}
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NS__SP__PT::receive(const NsUnitdataRequest_template& value_template, NsUnitdataRequest *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_0) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @NS_Emulation.NsUnitdataRequest.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_0)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_0;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsUnitdataRequest : "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NS__SP__PT::check_receive(const NsUnitdataRequest_template& value_template, NsUnitdataRequest *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Check-receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_0) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @NS_Emulation.NsUnitdataRequest.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_0)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_0;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsUnitdataRequest : "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
return ALT_YES;
}
}

alt_status NS__SP__PT::trigger(const NsUnitdataRequest_template& value_template, NsUnitdataRequest *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Trigger operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s will drop a message: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
remove_msg_queue_head();
return ALT_REPEAT;
} else if (my_head->item_selection != MESSAGE_0) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s will drop a message: Type of the first message in the queue is not @NS_Emulation.NsUnitdataRequest.", port_name);
remove_msg_queue_head();
return ALT_REPEAT;
} else if (!value_template.match(*my_head->message_0)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
remove_msg_queue_head();
return ALT_REPEAT;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_0;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsUnitdataRequest : "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

void NS__SP__PT::incoming_message(const NsUnitdataRequest& incoming_par, component sender_component)
{
if (!is_started) {
if (is_halted) {
TTCN_warning("A message that arrived on port %s has been discarded, because the port is not started.", port_name);
return;
}
else {
TTCN_error("Port %s is not started but a message has arrived on it.", port_name);
}
}
msg_tail_count++;
if (TTCN_Logger::log_this_event(TTCN_Logger::PORTEVENT_MQUEUE)) {
TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::enqueue__msg, port_name, sender_component, msg_tail_count,
CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MQUEUE, TRUE), TTCN_Logger::log_event_str(" @NS_Emulation.NsUnitdataRequest : "), incoming_par.log(), TTCN_Logger::end_event_log2str()));
}
msg_queue_item *new_item = new msg_queue_item;
new_item->item_selection = MESSAGE_0;
new_item->message_0 = new NsUnitdataRequest(incoming_par);
new_item->sender_component = sender_component;
append_to_msg_queue(new_item);
}

boolean NS__SP__PT::process_message(const char *message_type, Text_Buf& incoming_buf, component sender_component, OCTETSTRING&)
{
if (!strcmp(message_type, "@NS_Emulation.NsUnitdataRequest")) {
NsUnitdataRequest incoming_par;
incoming_par.decode_text(incoming_buf);
incoming_message(incoming_par, sender_component);
return TRUE;
} else return FALSE;
}

void NS__PT::remove_msg_queue_head()
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
switch (my_head->item_selection) {
case MESSAGE_0:
delete (my_head)->message_0;
break;
case MESSAGE_1:
delete (my_head)->message_1;
break;
case MESSAGE_2:
delete (my_head)->message_2;
break;
default:
TTCN_error("Internal error: Invalid message selector in the queue of port %s.", port_name);
}
msg_queue_item_base *next_item = msg_queue_head->next_item;
delete (msg_queue_item*)msg_queue_head;
msg_queue_head = next_item;
if (next_item == NULL) msg_queue_tail = NULL;
TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::extract__msg, port_name, 0, ++msg_head_count, CHARSTRING(0,NULL), CHARSTRING(0,NULL));}

void NS__PT::clear_queue()
{
while (msg_queue_head != NULL) remove_msg_queue_head();
}

NS__PT::NS__PT(const char *par_port_name)
 : PORT(par_port_name)
{
msg_queue_head = NULL;
msg_queue_tail = NULL;
}

NS__PT::~NS__PT()
{
clear_queue();
}

void NS__PT::send(const NsUnitdataRequest& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name);
if (!destination_component.is_bound()) TTCN_error("Unbound component reference in the to clause of send operation.");
const TTCN_Logger::Severity log_sev = destination_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMSEND:TTCN_Logger::PORTEVENT_MCSEND;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_send(port_name, destination_component,
(TTCN_Logger::begin_event(log_sev, TRUE), TTCN_Logger::log_event_str(" @NS_Emulation.NsUnitdataRequest : "),
send_par.log(), TTCN_Logger::end_event_log2str()));
}
if (destination_component == SYSTEM_COMPREF) TTCN_error("Message cannot be sent to system on internal port %s.", port_name);
else {
Text_Buf text_buf;
prepare_message(text_buf, "@NS_Emulation.NsUnitdataRequest");
send_par.encode_text(text_buf);
send_data(text_buf, destination_component);
}
}

void NS__PT::send(const NsUnitdataRequest& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect)
{
for (size_t i = 0; i < nof_components; ++i) send(send_par, destination_components[i], timestamp_redirect);
}

void NS__PT::send(const NsUnitdataRequest& send_par, boolean broadcast, FLOAT* timestamp_redirect)
{
if (broadcast) {
if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name);
Text_Buf text_buf;
prepare_message(text_buf, "@NS_Emulation.NsUnitdataRequest");
send_par.encode_text(text_buf);
send_data_broadcast(text_buf, PORT::OMT_SEND, (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MCSEND, TRUE),
TTCN_Logger::log_event_str(" @NS_Emulation.NsUnitdataRequest : "), send_par.log(), TTCN_Logger::end_event_log2str()));
}
else send(send_par, COMPONENT(get_default_destination()), timestamp_redirect);
}

void NS__PT::send(const NsUnitdataRequest_template& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
const NsUnitdataRequest& send_par_value = NsUnitdataRequest(send_par.valueof());
send(send_par_value, destination_component, timestamp_redirect);
}

void NS__PT::send(const NsUnitdataRequest_template& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect)
{
const NsUnitdataRequest& send_par_value = NsUnitdataRequest(send_par.valueof());
send(send_par_value, nof_components, destination_components, timestamp_redirect);
}

void NS__PT::send(const NsUnitdataRequest_template& send_par, boolean broadcast, FLOAT* timestamp_redirect)
{
const NsUnitdataRequest& send_par_value = NsUnitdataRequest(send_par.valueof());
send(send_par_value, broadcast, timestamp_redirect);
}

alt_status NS__PT::receive(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else {
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS, "Matching on port %s succeeded.", port_name);
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
switch (my_head->item_selection) {
case MESSAGE_0:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @Socket_API_Definitions.PortEvent: "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
case MESSAGE_1:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsStatusIndication: "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
case MESSAGE_2:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsUnitdataIndication: "),
my_head->message_2->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
default:
TTCN_error("Internal error: unknown message");
}
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NS__PT::check_receive(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else {
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS, "Matching on port %s succeeded.", port_name);
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
switch (my_head->item_selection) {
case MESSAGE_0:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @Socket_API_Definitions.PortEvent: "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
case MESSAGE_1:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsStatusIndication: "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
case MESSAGE_2:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsUnitdataIndication: "),
my_head->message_2->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
default:
TTCN_error("Internal error: unknown message");
}
}
return ALT_YES;
}
}

alt_status NS__PT::trigger(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s will drop a message: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
remove_msg_queue_head();
return ALT_REPEAT;
} else {
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS, "Matching on port %s succeeded.", port_name);
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
switch (my_head->item_selection) {
case MESSAGE_0:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @Socket_API_Definitions.PortEvent: "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
case MESSAGE_1:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsStatusIndication: "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
case MESSAGE_2:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsUnitdataIndication: "),
my_head->message_2->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
default:
TTCN_error("Internal error: unknown message");
}
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NS__PT::receive(const Socket__API__Definitions::PortEvent_template& value_template, Socket__API__Definitions::PortEvent *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_0) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @Socket_API_Definitions.PortEvent.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_0)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_0;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @Socket_API_Definitions.PortEvent : "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NS__PT::check_receive(const Socket__API__Definitions::PortEvent_template& value_template, Socket__API__Definitions::PortEvent *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Check-receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_0) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @Socket_API_Definitions.PortEvent.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_0)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_0;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @Socket_API_Definitions.PortEvent : "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
return ALT_YES;
}
}

alt_status NS__PT::trigger(const Socket__API__Definitions::PortEvent_template& value_template, Socket__API__Definitions::PortEvent *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Trigger operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s will drop a message: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
remove_msg_queue_head();
return ALT_REPEAT;
} else if (my_head->item_selection != MESSAGE_0) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s will drop a message: Type of the first message in the queue is not @Socket_API_Definitions.PortEvent.", port_name);
remove_msg_queue_head();
return ALT_REPEAT;
} else if (!value_template.match(*my_head->message_0)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
remove_msg_queue_head();
return ALT_REPEAT;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_0;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @Socket_API_Definitions.PortEvent : "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NS__PT::receive(const NsStatusIndication_template& value_template, NsStatusIndication *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_1) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @NS_Emulation.NsStatusIndication.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_1)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_1;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsStatusIndication : "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NS__PT::check_receive(const NsStatusIndication_template& value_template, NsStatusIndication *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Check-receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_1) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @NS_Emulation.NsStatusIndication.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_1)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_1;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsStatusIndication : "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
return ALT_YES;
}
}

alt_status NS__PT::trigger(const NsStatusIndication_template& value_template, NsStatusIndication *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Trigger operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s will drop a message: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
remove_msg_queue_head();
return ALT_REPEAT;
} else if (my_head->item_selection != MESSAGE_1) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s will drop a message: Type of the first message in the queue is not @NS_Emulation.NsStatusIndication.", port_name);
remove_msg_queue_head();
return ALT_REPEAT;
} else if (!value_template.match(*my_head->message_1)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
remove_msg_queue_head();
return ALT_REPEAT;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_1;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsStatusIndication : "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NS__PT::receive(const NsUnitdataIndication_template& value_template, NsUnitdataIndication *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_2) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @NS_Emulation.NsUnitdataIndication.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_2)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_2),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_2;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_2),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsUnitdataIndication : "),
my_head->message_2->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NS__PT::check_receive(const NsUnitdataIndication_template& value_template, NsUnitdataIndication *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Check-receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_2) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @NS_Emulation.NsUnitdataIndication.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_2)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_2),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_2;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_2),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsUnitdataIndication : "),
my_head->message_2->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
return ALT_YES;
}
}

alt_status NS__PT::trigger(const NsUnitdataIndication_template& value_template, NsUnitdataIndication *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Trigger operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s will drop a message: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
remove_msg_queue_head();
return ALT_REPEAT;
} else if (my_head->item_selection != MESSAGE_2) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s will drop a message: Type of the first message in the queue is not @NS_Emulation.NsUnitdataIndication.", port_name);
remove_msg_queue_head();
return ALT_REPEAT;
} else if (!value_template.match(*my_head->message_2)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_2),
 TTCN_Logger::end_event_log2str()));
}
remove_msg_queue_head();
return ALT_REPEAT;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_2;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_2),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsUnitdataIndication : "),
my_head->message_2->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

void NS__PT::incoming_message(const Socket__API__Definitions::PortEvent& incoming_par, component sender_component)
{
if (!is_started) {
if (is_halted) {
TTCN_warning("A message that arrived on port %s has been discarded, because the port is not started.", port_name);
return;
}
else {
TTCN_error("Port %s is not started but a message has arrived on it.", port_name);
}
}
msg_tail_count++;
if (TTCN_Logger::log_this_event(TTCN_Logger::PORTEVENT_MQUEUE)) {
TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::enqueue__msg, port_name, sender_component, msg_tail_count,
CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MQUEUE, TRUE), TTCN_Logger::log_event_str(" @Socket_API_Definitions.PortEvent : "), incoming_par.log(), TTCN_Logger::end_event_log2str()));
}
msg_queue_item *new_item = new msg_queue_item;
new_item->item_selection = MESSAGE_0;
new_item->message_0 = new Socket__API__Definitions::PortEvent(incoming_par);
new_item->sender_component = sender_component;
append_to_msg_queue(new_item);
}

void NS__PT::incoming_message(const NsStatusIndication& incoming_par, component sender_component)
{
if (!is_started) {
if (is_halted) {
TTCN_warning("A message that arrived on port %s has been discarded, because the port is not started.", port_name);
return;
}
else {
TTCN_error("Port %s is not started but a message has arrived on it.", port_name);
}
}
msg_tail_count++;
if (TTCN_Logger::log_this_event(TTCN_Logger::PORTEVENT_MQUEUE)) {
TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::enqueue__msg, port_name, sender_component, msg_tail_count,
CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MQUEUE, TRUE), TTCN_Logger::log_event_str(" @NS_Emulation.NsStatusIndication : "), incoming_par.log(), TTCN_Logger::end_event_log2str()));
}
msg_queue_item *new_item = new msg_queue_item;
new_item->item_selection = MESSAGE_1;
new_item->message_1 = new NsStatusIndication(incoming_par);
new_item->sender_component = sender_component;
append_to_msg_queue(new_item);
}

void NS__PT::incoming_message(const NsUnitdataIndication& incoming_par, component sender_component)
{
if (!is_started) {
if (is_halted) {
TTCN_warning("A message that arrived on port %s has been discarded, because the port is not started.", port_name);
return;
}
else {
TTCN_error("Port %s is not started but a message has arrived on it.", port_name);
}
}
msg_tail_count++;
if (TTCN_Logger::log_this_event(TTCN_Logger::PORTEVENT_MQUEUE)) {
TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::enqueue__msg, port_name, sender_component, msg_tail_count,
CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MQUEUE, TRUE), TTCN_Logger::log_event_str(" @NS_Emulation.NsUnitdataIndication : "), incoming_par.log(), TTCN_Logger::end_event_log2str()));
}
msg_queue_item *new_item = new msg_queue_item;
new_item->item_selection = MESSAGE_2;
new_item->message_2 = new NsUnitdataIndication(incoming_par);
new_item->sender_component = sender_component;
append_to_msg_queue(new_item);
}

boolean NS__PT::process_message(const char *message_type, Text_Buf& incoming_buf, component sender_component, OCTETSTRING&)
{
if (!strcmp(message_type, "@Socket_API_Definitions.PortEvent")) {
Socket__API__Definitions::PortEvent incoming_par;
incoming_par.decode_text(incoming_buf);
incoming_message(incoming_par, sender_component);
return TRUE;
} else if (!strcmp(message_type, "@NS_Emulation.NsStatusIndication")) {
NsStatusIndication incoming_par;
incoming_par.decode_text(incoming_buf);
incoming_message(incoming_par, sender_component);
return TRUE;
} else if (!strcmp(message_type, "@NS_Emulation.NsUnitdataIndication")) {
NsUnitdataIndication incoming_par;
incoming_par.decode_text(incoming_buf);
incoming_message(incoming_par, sender_component);
return TRUE;
} else return FALSE;
}

void NS__CTRL__SP__PT::remove_msg_queue_head()
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
switch (my_head->item_selection) {
case MESSAGE_0:
delete (my_head)->message_0;
break;
case MESSAGE_1:
delete (my_head)->message_1;
break;
default:
TTCN_error("Internal error: Invalid message selector in the queue of port %s.", port_name);
}
msg_queue_item_base *next_item = msg_queue_head->next_item;
delete (msg_queue_item*)msg_queue_head;
msg_queue_head = next_item;
if (next_item == NULL) msg_queue_tail = NULL;
TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::extract__msg, port_name, 0, ++msg_head_count, CHARSTRING(0,NULL), CHARSTRING(0,NULL));}

void NS__CTRL__SP__PT::clear_queue()
{
while (msg_queue_head != NULL) remove_msg_queue_head();
}

NS__CTRL__SP__PT::NS__CTRL__SP__PT(const char *par_port_name)
 : PORT(par_port_name)
{
msg_queue_head = NULL;
msg_queue_tail = NULL;
}

NS__CTRL__SP__PT::~NS__CTRL__SP__PT()
{
clear_queue();
}

alt_status NS__CTRL__SP__PT::receive(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else {
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS, "Matching on port %s succeeded.", port_name);
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
switch (my_head->item_selection) {
case MESSAGE_0:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsDisableVcRequest: "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
case MESSAGE_1:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsEnableVcRequest: "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
default:
TTCN_error("Internal error: unknown message");
}
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NS__CTRL__SP__PT::check_receive(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else {
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS, "Matching on port %s succeeded.", port_name);
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
switch (my_head->item_selection) {
case MESSAGE_0:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsDisableVcRequest: "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
case MESSAGE_1:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsEnableVcRequest: "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
default:
TTCN_error("Internal error: unknown message");
}
}
return ALT_YES;
}
}

alt_status NS__CTRL__SP__PT::trigger(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s will drop a message: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
remove_msg_queue_head();
return ALT_REPEAT;
} else {
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS, "Matching on port %s succeeded.", port_name);
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
switch (my_head->item_selection) {
case MESSAGE_0:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsDisableVcRequest: "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
case MESSAGE_1:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsEnableVcRequest: "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
default:
TTCN_error("Internal error: unknown message");
}
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NS__CTRL__SP__PT::receive(const NsDisableVcRequest_template& value_template, NsDisableVcRequest *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_0) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @NS_Emulation.NsDisableVcRequest.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_0)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_0;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsDisableVcRequest : "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NS__CTRL__SP__PT::check_receive(const NsDisableVcRequest_template& value_template, NsDisableVcRequest *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Check-receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_0) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @NS_Emulation.NsDisableVcRequest.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_0)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_0;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsDisableVcRequest : "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
return ALT_YES;
}
}

alt_status NS__CTRL__SP__PT::trigger(const NsDisableVcRequest_template& value_template, NsDisableVcRequest *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Trigger operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s will drop a message: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
remove_msg_queue_head();
return ALT_REPEAT;
} else if (my_head->item_selection != MESSAGE_0) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s will drop a message: Type of the first message in the queue is not @NS_Emulation.NsDisableVcRequest.", port_name);
remove_msg_queue_head();
return ALT_REPEAT;
} else if (!value_template.match(*my_head->message_0)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
remove_msg_queue_head();
return ALT_REPEAT;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_0;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsDisableVcRequest : "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NS__CTRL__SP__PT::receive(const NsEnableVcRequest_template& value_template, NsEnableVcRequest *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_1) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @NS_Emulation.NsEnableVcRequest.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_1)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_1;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsEnableVcRequest : "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NS__CTRL__SP__PT::check_receive(const NsEnableVcRequest_template& value_template, NsEnableVcRequest *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Check-receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_1) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @NS_Emulation.NsEnableVcRequest.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_1)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_1;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsEnableVcRequest : "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
return ALT_YES;
}
}

alt_status NS__CTRL__SP__PT::trigger(const NsEnableVcRequest_template& value_template, NsEnableVcRequest *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Trigger operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s will drop a message: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
remove_msg_queue_head();
return ALT_REPEAT;
} else if (my_head->item_selection != MESSAGE_1) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s will drop a message: Type of the first message in the queue is not @NS_Emulation.NsEnableVcRequest.", port_name);
remove_msg_queue_head();
return ALT_REPEAT;
} else if (!value_template.match(*my_head->message_1)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
remove_msg_queue_head();
return ALT_REPEAT;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_1;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsEnableVcRequest : "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

void NS__CTRL__SP__PT::incoming_message(const NsDisableVcRequest& incoming_par, component sender_component)
{
if (!is_started) {
if (is_halted) {
TTCN_warning("A message that arrived on port %s has been discarded, because the port is not started.", port_name);
return;
}
else {
TTCN_error("Port %s is not started but a message has arrived on it.", port_name);
}
}
msg_tail_count++;
if (TTCN_Logger::log_this_event(TTCN_Logger::PORTEVENT_MQUEUE)) {
TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::enqueue__msg, port_name, sender_component, msg_tail_count,
CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MQUEUE, TRUE), TTCN_Logger::log_event_str(" @NS_Emulation.NsDisableVcRequest : "), incoming_par.log(), TTCN_Logger::end_event_log2str()));
}
msg_queue_item *new_item = new msg_queue_item;
new_item->item_selection = MESSAGE_0;
new_item->message_0 = new NsDisableVcRequest(incoming_par);
new_item->sender_component = sender_component;
append_to_msg_queue(new_item);
}

void NS__CTRL__SP__PT::incoming_message(const NsEnableVcRequest& incoming_par, component sender_component)
{
if (!is_started) {
if (is_halted) {
TTCN_warning("A message that arrived on port %s has been discarded, because the port is not started.", port_name);
return;
}
else {
TTCN_error("Port %s is not started but a message has arrived on it.", port_name);
}
}
msg_tail_count++;
if (TTCN_Logger::log_this_event(TTCN_Logger::PORTEVENT_MQUEUE)) {
TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::enqueue__msg, port_name, sender_component, msg_tail_count,
CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MQUEUE, TRUE), TTCN_Logger::log_event_str(" @NS_Emulation.NsEnableVcRequest : "), incoming_par.log(), TTCN_Logger::end_event_log2str()));
}
msg_queue_item *new_item = new msg_queue_item;
new_item->item_selection = MESSAGE_1;
new_item->message_1 = new NsEnableVcRequest(incoming_par);
new_item->sender_component = sender_component;
append_to_msg_queue(new_item);
}

boolean NS__CTRL__SP__PT::process_message(const char *message_type, Text_Buf& incoming_buf, component sender_component, OCTETSTRING&)
{
if (!strcmp(message_type, "@NS_Emulation.NsDisableVcRequest")) {
NsDisableVcRequest incoming_par;
incoming_par.decode_text(incoming_buf);
incoming_message(incoming_par, sender_component);
return TRUE;
} else if (!strcmp(message_type, "@NS_Emulation.NsEnableVcRequest")) {
NsEnableVcRequest incoming_par;
incoming_par.decode_text(incoming_buf);
incoming_message(incoming_par, sender_component);
return TRUE;
} else return FALSE;
}

NS__CTRL__PT::NS__CTRL__PT(const char *par_port_name)
 : PORT(par_port_name)
{
}

void NS__CTRL__PT::send(const NsEnableVcRequest& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name);
if (!destination_component.is_bound()) TTCN_error("Unbound component reference in the to clause of send operation.");
const TTCN_Logger::Severity log_sev = destination_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMSEND:TTCN_Logger::PORTEVENT_MCSEND;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_send(port_name, destination_component,
(TTCN_Logger::begin_event(log_sev, TRUE), TTCN_Logger::log_event_str(" @NS_Emulation.NsEnableVcRequest : "),
send_par.log(), TTCN_Logger::end_event_log2str()));
}
if (destination_component == SYSTEM_COMPREF) TTCN_error("Message cannot be sent to system on internal port %s.", port_name);
else {
Text_Buf text_buf;
prepare_message(text_buf, "@NS_Emulation.NsEnableVcRequest");
send_par.encode_text(text_buf);
send_data(text_buf, destination_component);
}
}

void NS__CTRL__PT::send(const NsEnableVcRequest& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect)
{
for (size_t i = 0; i < nof_components; ++i) send(send_par, destination_components[i], timestamp_redirect);
}

void NS__CTRL__PT::send(const NsEnableVcRequest& send_par, boolean broadcast, FLOAT* timestamp_redirect)
{
if (broadcast) {
if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name);
Text_Buf text_buf;
prepare_message(text_buf, "@NS_Emulation.NsEnableVcRequest");
send_par.encode_text(text_buf);
send_data_broadcast(text_buf, PORT::OMT_SEND, (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MCSEND, TRUE),
TTCN_Logger::log_event_str(" @NS_Emulation.NsEnableVcRequest : "), send_par.log(), TTCN_Logger::end_event_log2str()));
}
else send(send_par, COMPONENT(get_default_destination()), timestamp_redirect);
}

void NS__CTRL__PT::send(const NsEnableVcRequest_template& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
const NsEnableVcRequest& send_par_value = NsEnableVcRequest(send_par.valueof());
send(send_par_value, destination_component, timestamp_redirect);
}

void NS__CTRL__PT::send(const NsEnableVcRequest_template& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect)
{
const NsEnableVcRequest& send_par_value = NsEnableVcRequest(send_par.valueof());
send(send_par_value, nof_components, destination_components, timestamp_redirect);
}

void NS__CTRL__PT::send(const NsEnableVcRequest_template& send_par, boolean broadcast, FLOAT* timestamp_redirect)
{
const NsEnableVcRequest& send_par_value = NsEnableVcRequest(send_par.valueof());
send(send_par_value, broadcast, timestamp_redirect);
}

void NS__CTRL__PT::send(const NsDisableVcRequest& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name);
if (!destination_component.is_bound()) TTCN_error("Unbound component reference in the to clause of send operation.");
const TTCN_Logger::Severity log_sev = destination_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMSEND:TTCN_Logger::PORTEVENT_MCSEND;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_send(port_name, destination_component,
(TTCN_Logger::begin_event(log_sev, TRUE), TTCN_Logger::log_event_str(" @NS_Emulation.NsDisableVcRequest : "),
send_par.log(), TTCN_Logger::end_event_log2str()));
}
if (destination_component == SYSTEM_COMPREF) TTCN_error("Message cannot be sent to system on internal port %s.", port_name);
else {
Text_Buf text_buf;
prepare_message(text_buf, "@NS_Emulation.NsDisableVcRequest");
send_par.encode_text(text_buf);
send_data(text_buf, destination_component);
}
}

void NS__CTRL__PT::send(const NsDisableVcRequest& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect)
{
for (size_t i = 0; i < nof_components; ++i) send(send_par, destination_components[i], timestamp_redirect);
}

void NS__CTRL__PT::send(const NsDisableVcRequest& send_par, boolean broadcast, FLOAT* timestamp_redirect)
{
if (broadcast) {
if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name);
Text_Buf text_buf;
prepare_message(text_buf, "@NS_Emulation.NsDisableVcRequest");
send_par.encode_text(text_buf);
send_data_broadcast(text_buf, PORT::OMT_SEND, (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MCSEND, TRUE),
TTCN_Logger::log_event_str(" @NS_Emulation.NsDisableVcRequest : "), send_par.log(), TTCN_Logger::end_event_log2str()));
}
else send(send_par, COMPONENT(get_default_destination()), timestamp_redirect);
}

void NS__CTRL__PT::send(const NsDisableVcRequest_template& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
const NsDisableVcRequest& send_par_value = NsDisableVcRequest(send_par.valueof());
send(send_par_value, destination_component, timestamp_redirect);
}

void NS__CTRL__PT::send(const NsDisableVcRequest_template& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect)
{
const NsDisableVcRequest& send_par_value = NsDisableVcRequest(send_par.valueof());
send(send_par_value, nof_components, destination_components, timestamp_redirect);
}

void NS__CTRL__PT::send(const NsDisableVcRequest_template& send_par, boolean broadcast, FLOAT* timestamp_redirect)
{
const NsDisableVcRequest& send_par_value = NsDisableVcRequest(send_par.valueof());
send(send_par_value, broadcast, timestamp_redirect);
}

NsDisableVcRequest::NsDisableVcRequest()
{
}

NsDisableVcRequest::NsDisableVcRequest(const INTEGER& par_nsvci)
  :   field_nsvci(par_nsvci)
{
}

NsDisableVcRequest::NsDisableVcRequest(const NsDisableVcRequest& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @NS_Emulation.NsDisableVcRequest.");
if (other_value.nsvci().is_bound()) field_nsvci = other_value.nsvci();
else field_nsvci.clean_up();
}

void NsDisableVcRequest::clean_up()
{
field_nsvci.clean_up();
}

const TTCN_Typedescriptor_t* NsDisableVcRequest::get_descriptor() const { return &NsDisableVcRequest_descr_; }
NsDisableVcRequest& NsDisableVcRequest::operator=(const NsDisableVcRequest& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @NS_Emulation.NsDisableVcRequest.");
  if (other_value.nsvci().is_bound()) field_nsvci = other_value.nsvci();
  else field_nsvci.clean_up();
}
return *this;
}

boolean NsDisableVcRequest::operator==(const NsDisableVcRequest& other_value) const
{
return field_nsvci==other_value.field_nsvci;
}

boolean NsDisableVcRequest::is_bound() const
{
return (field_nsvci.is_bound());
}
boolean NsDisableVcRequest::is_value() const
{
return field_nsvci.is_value();
}
void NsDisableVcRequest::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ nsvci := ");
field_nsvci.log();
TTCN_Logger::log_event_str(" }");
}

void NsDisableVcRequest::set_implicit_omit()
{
if (nsvci().is_bound()) nsvci().set_implicit_omit();
}

void NsDisableVcRequest::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 (1<param.get_size()) {
      param.error("record value of type @NS_Emulation.NsDisableVcRequest has 1 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) nsvci().set_param(*param.get_elem(0));
    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(), "nsvci")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nsvci().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 @NS_Emulation.NsDisableVcRequest: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@NS_Emulation.NsDisableVcRequest");
  }
}

void NsDisableVcRequest::encode_text(Text_Buf& text_buf) const
{
field_nsvci.encode_text(text_buf);
}

void NsDisableVcRequest::decode_text(Text_Buf& text_buf)
{
field_nsvci.decode_text(text_buf);
}

struct NsDisableVcRequest_template::single_value_struct {
INTEGER_template field_nsvci;
};

void NsDisableVcRequest_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_nsvci = ANY_VALUE;
}
}
}

void NsDisableVcRequest_template::copy_value(const NsDisableVcRequest& other_value)
{
single_value = new single_value_struct;
if (other_value.nsvci().is_bound()) {
  single_value->field_nsvci = other_value.nsvci();
} else {
  single_value->field_nsvci.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void NsDisableVcRequest_template::copy_template(const NsDisableVcRequest_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.nsvci().get_selection()) {
single_value->field_nsvci = other_value.nsvci();
} else {
single_value->field_nsvci.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 NsDisableVcRequest_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 NsDisableVcRequest_template(*other_value.implication_.precondition);
implication_.implied_template = new NsDisableVcRequest_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 @NS_Emulation.NsDisableVcRequest.");
break;
}
set_selection(other_value);
}

NsDisableVcRequest_template::NsDisableVcRequest_template()
{
}

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

NsDisableVcRequest_template::NsDisableVcRequest_template(const NsDisableVcRequest& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean NsDisableVcRequest_template::match(const NsDisableVcRequest& 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.nsvci().is_bound()) return FALSE;
if(!single_value->field_nsvci.match(other_value.nsvci(), 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 @NS_Emulation.NsDisableVcRequest.");
}
return FALSE;
}

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

boolean NsDisableVcRequest_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_nsvci.is_value();
}

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

NsDisableVcRequest NsDisableVcRequest_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 @NS_Emulation.NsDisableVcRequest.");
NsDisableVcRequest ret_val;
if (single_value->field_nsvci.is_bound()) {
ret_val.nsvci() = single_value->field_nsvci.valueof();
}
return ret_val;
}

void NsDisableVcRequest_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 @NS_Emulation.NsDisableVcRequest.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new NsDisableVcRequest_template[list_length];
}

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

INTEGER_template& NsDisableVcRequest_template::nsvci()
{
set_specific();
return single_value->field_nsvci;
}

const INTEGER_template& NsDisableVcRequest_template::nsvci() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field nsvci of a non-specific template of type @NS_Emulation.NsDisableVcRequest.");
return single_value->field_nsvci;
}

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

void NsDisableVcRequest_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ nsvci := ");
single_value->field_nsvci.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 NsDisableVcRequest_template::log_match(const NsDisableVcRequest& 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_nsvci.match(match_value.nsvci(), legacy)){
TTCN_Logger::log_logmatch_info(".nsvci");
single_value->field_nsvci.log_match(match_value.nsvci(), 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("{ nsvci := ");
single_value->field_nsvci.log_match(match_value.nsvci(), 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 NsDisableVcRequest_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (nsvci().is_bound()) nsvci().set_implicit_omit();
}

void NsDisableVcRequest_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_nsvci.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 @NS_Emulation.NsDisableVcRequest.");
}
}

void NsDisableVcRequest_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_nsvci.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 NsDisableVcRequest_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 @NS_Emulation.NsDisableVcRequest.");
}
}

void NsDisableVcRequest_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: {
    NsDisableVcRequest_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 (1<param.get_size()) {
      param.error("record template of type @NS_Emulation.NsDisableVcRequest has 1 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) nsvci().set_param(*param.get_elem(0));
    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(), "nsvci")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nsvci().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 @NS_Emulation.NsDisableVcRequest: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    NsDisableVcRequest_template* precondition = new NsDisableVcRequest_template;
    precondition->set_param(*param.get_elem(0));
    NsDisableVcRequest_template* implied_template = new NsDisableVcRequest_template;
    implied_template->set_param(*param.get_elem(1));
    *this = NsDisableVcRequest_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@NS_Emulation.NsDisableVcRequest");
  }
  is_ifpresent = param.get_ifpresent();
}

void NsDisableVcRequest_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_nsvci.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NsDisableVcRequest");
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 : "@NS_Emulation.NsDisableVcRequest");
}

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

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

NsEnableVcRequest::NsEnableVcRequest()
{
}

NsEnableVcRequest::NsEnableVcRequest(const INTEGER& par_nsvci)
  :   field_nsvci(par_nsvci)
{
}

NsEnableVcRequest::NsEnableVcRequest(const NsEnableVcRequest& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @NS_Emulation.NsEnableVcRequest.");
if (other_value.nsvci().is_bound()) field_nsvci = other_value.nsvci();
else field_nsvci.clean_up();
}

void NsEnableVcRequest::clean_up()
{
field_nsvci.clean_up();
}

const TTCN_Typedescriptor_t* NsEnableVcRequest::get_descriptor() const { return &NsEnableVcRequest_descr_; }
NsEnableVcRequest& NsEnableVcRequest::operator=(const NsEnableVcRequest& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @NS_Emulation.NsEnableVcRequest.");
  if (other_value.nsvci().is_bound()) field_nsvci = other_value.nsvci();
  else field_nsvci.clean_up();
}
return *this;
}

boolean NsEnableVcRequest::operator==(const NsEnableVcRequest& other_value) const
{
return field_nsvci==other_value.field_nsvci;
}

boolean NsEnableVcRequest::is_bound() const
{
return (field_nsvci.is_bound());
}
boolean NsEnableVcRequest::is_value() const
{
return field_nsvci.is_value();
}
void NsEnableVcRequest::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ nsvci := ");
field_nsvci.log();
TTCN_Logger::log_event_str(" }");
}

void NsEnableVcRequest::set_implicit_omit()
{
if (nsvci().is_bound()) nsvci().set_implicit_omit();
}

void NsEnableVcRequest::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 (1<param.get_size()) {
      param.error("record value of type @NS_Emulation.NsEnableVcRequest has 1 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) nsvci().set_param(*param.get_elem(0));
    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(), "nsvci")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nsvci().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 @NS_Emulation.NsEnableVcRequest: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@NS_Emulation.NsEnableVcRequest");
  }
}

void NsEnableVcRequest::encode_text(Text_Buf& text_buf) const
{
field_nsvci.encode_text(text_buf);
}

void NsEnableVcRequest::decode_text(Text_Buf& text_buf)
{
field_nsvci.decode_text(text_buf);
}

struct NsEnableVcRequest_template::single_value_struct {
INTEGER_template field_nsvci;
};

void NsEnableVcRequest_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_nsvci = ANY_VALUE;
}
}
}

void NsEnableVcRequest_template::copy_value(const NsEnableVcRequest& other_value)
{
single_value = new single_value_struct;
if (other_value.nsvci().is_bound()) {
  single_value->field_nsvci = other_value.nsvci();
} else {
  single_value->field_nsvci.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void NsEnableVcRequest_template::copy_template(const NsEnableVcRequest_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.nsvci().get_selection()) {
single_value->field_nsvci = other_value.nsvci();
} else {
single_value->field_nsvci.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 NsEnableVcRequest_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 NsEnableVcRequest_template(*other_value.implication_.precondition);
implication_.implied_template = new NsEnableVcRequest_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 @NS_Emulation.NsEnableVcRequest.");
break;
}
set_selection(other_value);
}

NsEnableVcRequest_template::NsEnableVcRequest_template()
{
}

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

NsEnableVcRequest_template::NsEnableVcRequest_template(const NsEnableVcRequest& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean NsEnableVcRequest_template::match(const NsEnableVcRequest& 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.nsvci().is_bound()) return FALSE;
if(!single_value->field_nsvci.match(other_value.nsvci(), 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 @NS_Emulation.NsEnableVcRequest.");
}
return FALSE;
}

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

boolean NsEnableVcRequest_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_nsvci.is_value();
}

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

NsEnableVcRequest NsEnableVcRequest_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 @NS_Emulation.NsEnableVcRequest.");
NsEnableVcRequest ret_val;
if (single_value->field_nsvci.is_bound()) {
ret_val.nsvci() = single_value->field_nsvci.valueof();
}
return ret_val;
}

void NsEnableVcRequest_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 @NS_Emulation.NsEnableVcRequest.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new NsEnableVcRequest_template[list_length];
}

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

INTEGER_template& NsEnableVcRequest_template::nsvci()
{
set_specific();
return single_value->field_nsvci;
}

const INTEGER_template& NsEnableVcRequest_template::nsvci() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field nsvci of a non-specific template of type @NS_Emulation.NsEnableVcRequest.");
return single_value->field_nsvci;
}

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

void NsEnableVcRequest_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ nsvci := ");
single_value->field_nsvci.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 NsEnableVcRequest_template::log_match(const NsEnableVcRequest& 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_nsvci.match(match_value.nsvci(), legacy)){
TTCN_Logger::log_logmatch_info(".nsvci");
single_value->field_nsvci.log_match(match_value.nsvci(), 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("{ nsvci := ");
single_value->field_nsvci.log_match(match_value.nsvci(), 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 NsEnableVcRequest_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (nsvci().is_bound()) nsvci().set_implicit_omit();
}

void NsEnableVcRequest_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_nsvci.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 @NS_Emulation.NsEnableVcRequest.");
}
}

void NsEnableVcRequest_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_nsvci.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 NsEnableVcRequest_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 @NS_Emulation.NsEnableVcRequest.");
}
}

void NsEnableVcRequest_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: {
    NsEnableVcRequest_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 (1<param.get_size()) {
      param.error("record template of type @NS_Emulation.NsEnableVcRequest has 1 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) nsvci().set_param(*param.get_elem(0));
    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(), "nsvci")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nsvci().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 @NS_Emulation.NsEnableVcRequest: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    NsEnableVcRequest_template* precondition = new NsEnableVcRequest_template;
    precondition->set_param(*param.get_elem(0));
    NsEnableVcRequest_template* implied_template = new NsEnableVcRequest_template;
    implied_template->set_param(*param.get_elem(1));
    *this = NsEnableVcRequest_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@NS_Emulation.NsEnableVcRequest");
  }
  is_ifpresent = param.get_ifpresent();
}

void NsEnableVcRequest_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_nsvci.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NsEnableVcRequest");
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 : "@NS_Emulation.NsEnableVcRequest");
}

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

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

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

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

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

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

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

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

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

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

boolean NS__Provider__LinkStatus::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 @NS_Emulation.NS_Provider_LinkStatus.");
return enum_value == other_value;
}

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

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

boolean NS__Provider__LinkStatus::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 @NS_Emulation.NS_Provider_LinkStatus.");
return enum_value < other_value;
}

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

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

boolean NS__Provider__LinkStatus::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 @NS_Emulation.NS_Provider_LinkStatus.");
return enum_value > other_value;
}

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

const char *NS__Provider__LinkStatus::enum_to_str(enum_type enum_par)
{
switch (enum_par) {
case NS__PROV__LINK__STATUS__UP: return "NS_PROV_LINK_STATUS_UP";
case NS__PROV__LINK__STATUS__DOWN: return "NS_PROV_LINK_STATUS_DOWN";
default:
return "<unknown>";
}
}

NS__Provider__LinkStatus::enum_type NS__Provider__LinkStatus::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, "NS_PROV_LINK_STATUS_UP")) return NS__PROV__LINK__STATUS__UP;
if (!strcmp(str_par, "NS_PROV_LINK_STATUS_DOWN")) return NS__PROV__LINK__STATUS__DOWN;
}
return UNKNOWN_VALUE;
}

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

int NS__Provider__LinkStatus::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 @NS_Emulation.NS_Provider_LinkStatus.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par;
}

int NS__Provider__LinkStatus::enum2int(const NS__Provider__LinkStatus& 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 @NS_Emulation.NS_Provider_LinkStatus.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par.enum_value;
}

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

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

void NS__Provider__LinkStatus::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 NS__Provider__LinkStatus::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", "@NS_Emulation.NS_Provider_LinkStatus");
  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 @NS_Emulation.NS_Provider_LinkStatus.");
  }
}

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

void NS__Provider__LinkStatus::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 @NS_Emulation.NS_Provider_LinkStatus.", enum_value);
}

void NS__Provider__LinkStatus_template::copy_template(const NS__Provider__LinkStatus_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 NS__Provider__LinkStatus_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 NS__Provider__LinkStatus_template(*other_value.implication_.precondition);
implication_.implied_template = new NS__Provider__LinkStatus_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 @NS_Emulation.NS_Provider_LinkStatus.");
}
}

NS__Provider__LinkStatus_template::NS__Provider__LinkStatus_template()
{
}

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

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

NS__Provider__LinkStatus_template::NS__Provider__LinkStatus_template(NS__Provider__LinkStatus::enum_type other_value)
 : Base_Template(SPECIFIC_VALUE)
{
single_value = other_value;
}

NS__Provider__LinkStatus_template::NS__Provider__LinkStatus_template(const NS__Provider__LinkStatus& other_value)
 : Base_Template(SPECIFIC_VALUE)
{
if (other_value.enum_value == NS__Provider__LinkStatus::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @NS_Emulation.NS_Provider_LinkStatus.");
single_value = other_value.enum_value;
}

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

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

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

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

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

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

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

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

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

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

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

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

NS__Provider__LinkStatus_template& NS__Provider__LinkStatus_template::operator=(const OPTIONAL<NS__Provider__LinkStatus>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (NS__Provider__LinkStatus::enum_type)(const NS__Provider__LinkStatus&)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 @NS_Emulation.NS_Provider_LinkStatus.");
}
return *this;
}

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

boolean NS__Provider__LinkStatus_template::match(NS__Provider__LinkStatus::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 @NS_Emulation.NS_Provider_LinkStatus.");
}
return FALSE;
}

boolean NS__Provider__LinkStatus_template::match(const NS__Provider__LinkStatus& other_value, boolean) const
{
if (other_value.enum_value == NS__Provider__LinkStatus::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @NS_Emulation.NS_Provider_LinkStatus with an unbound value.");
return match(other_value.enum_value);
}

NS__Provider__LinkStatus::enum_type NS__Provider__LinkStatus_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 @NS_Emulation.NS_Provider_LinkStatus.");
return single_value;
}

void NS__Provider__LinkStatus_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 NS__Provider__LinkStatus_template[list_length];
break;
default:
TTCN_error("Setting an invalid type for a template of enumerated type @NS_Emulation.NS_Provider_LinkStatus.");
}
}

NS__Provider__LinkStatus_template& NS__Provider__LinkStatus_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 @NS_Emulation.NS_Provider_LinkStatus.");
if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @NS_Emulation.NS_Provider_LinkStatus.");
return value_list.list_value[list_index];
}

void NS__Provider__LinkStatus_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_enum(NS__Provider__LinkStatus::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 NS__Provider__LinkStatus_template::log_match(const NS__Provider__LinkStatus& 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 NS__Provider__LinkStatus_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 @NS_Emulation.NS_Provider_LinkStatus.");
}
}

void NS__Provider__LinkStatus_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = (NS__Provider__LinkStatus::enum_type)text_buf.pull_int().get_val();
if (!NS__Provider__LinkStatus::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @NS_Emulation.NS_Provider_LinkStatus.", 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 NS__Provider__LinkStatus_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 @NS_Emulation.NS_Provider_LinkStatus.");
}
}

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

boolean NS__Provider__LinkStatus_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 NS__Provider__LinkStatus_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: {
    NS__Provider__LinkStatus_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: {
    NS__Provider__LinkStatus::enum_type enum_val = NS__Provider__LinkStatus::str_to_enum(m_p->get_enumerated(), m_p->get_enumerated_value());
    if (!NS__Provider__LinkStatus::is_valid_enum(enum_val)) {
      param.error("Invalid enumerated value for type @NS_Emulation.NS_Provider_LinkStatus.");
    }
    *this = enum_val;
  } break;
  case Module_Param::MP_Implication_Template: {
    NS__Provider__LinkStatus_template* precondition = new NS__Provider__LinkStatus_template;
    precondition->set_param(*m_p->get_elem(0));
    NS__Provider__LinkStatus_template* implied_template = new NS__Provider__LinkStatus_template;
    implied_template->set_param(*m_p->get_elem(1));
    *this = NS__Provider__LinkStatus_template(precondition, implied_template);
  } break;
  default:
    param.type_error("enumerated template", "@NS_Emulation.NS_Provider_LinkStatus");
  }
  is_ifpresent = param.get_ifpresent();
}

void NS__Provider__LinkStatus_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 : "@NS_Emulation.NS_Provider_LinkStatus");
}

void NS__Provider__Evt::copy_value(const NS__Provider__Evt& other_value)
{
switch (other_value.union_selection) {
case ALT_link__status:
field_link__status = new NS__Provider__LinkStatus(*other_value.field_link__status);
break;
default:
TTCN_error("Assignment of an unbound union value of type @NS_Emulation.NS_Provider_Evt.");
}
union_selection = other_value.union_selection;
}

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

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

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

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

boolean NS__Provider__Evt::operator==(const NS__Provider__Evt& other_value) const
{
if (union_selection == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of union type @NS_Emulation.NS_Provider_Evt.");
if (other_value.union_selection == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of union type @NS_Emulation.NS_Provider_Evt.");
if (union_selection != other_value.union_selection) return FALSE;
switch (union_selection) {
case ALT_link__status:
return *field_link__status == *other_value.field_link__status;
default:
return FALSE;
}
}

NS__Provider__LinkStatus& NS__Provider__Evt::link__status()
{
if (union_selection != ALT_link__status) {
clean_up();
field_link__status = new NS__Provider__LinkStatus;
union_selection = ALT_link__status;
}
return *field_link__status;
}

const NS__Provider__LinkStatus& NS__Provider__Evt::link__status() const
{
if (union_selection != ALT_link__status) TTCN_error("Using non-selected field link_status in a value of union type @NS_Emulation.NS_Provider_Evt.");
return *field_link__status;
}

boolean NS__Provider__Evt::ischosen(union_selection_type checked_selection) const
{
if (checked_selection == UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @NS_Emulation.NS_Provider_Evt.");
return union_selection == checked_selection;
}

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

boolean NS__Provider__Evt::is_value() const
{
switch (union_selection) {
case UNBOUND_VALUE: return FALSE;
case ALT_link__status: return field_link__status->is_value();
default: TTCN_error("Invalid selection in union is_bound");}
}

void NS__Provider__Evt::clean_up()
{
switch (union_selection) {
case ALT_link__status:
  delete field_link__status;
  break;
default:
  break;
}
union_selection = UNBOUND_VALUE;
}

void NS__Provider__Evt::log() const
{
switch (union_selection) {
case ALT_link__status:
TTCN_Logger::log_event_str("{ link_status := ");
field_link__status->log();
TTCN_Logger::log_event_str(" }");
break;
default:
TTCN_Logger::log_event_unbound();
}
}

void NS__Provider__Evt::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "union value");
  Module_Param_Ptr m_p = &param;
  if (m_p->get_type()==Module_Param::MP_Value_List && m_p->get_size()==0) return;
  if (m_p->get_type()!=Module_Param::MP_Assignment_List) {
    param.error("union value with field name was expected");
  }
  Module_Param* mp_last = m_p->get_elem(m_p->get_size()-1);
  char* last_name = mp_last->get_id()->get_name();
  if (!strcmp(last_name, "link_status")) {
    link__status().set_param(*mp_last);
    if (!link__status().is_bound()) clean_up();
    return;
  }
  mp_last->error("Field %s does not exist in type @NS_Emulation.NS_Provider_Evt.", last_name);
}

void NS__Provider__Evt::set_implicit_omit()
{
switch (union_selection) {
case ALT_link__status:
field_link__status->set_implicit_omit(); break;
default: break;
}
}

void NS__Provider__Evt::encode_text(Text_Buf& text_buf) const
{
text_buf.push_int(union_selection);
switch (union_selection) {
case ALT_link__status:
field_link__status->encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an unbound value of union type @NS_Emulation.NS_Provider_Evt.");
}
}

void NS__Provider__Evt::decode_text(Text_Buf& text_buf)
{
switch ((union_selection_type)text_buf.pull_int().get_val()) {
case ALT_link__status:
link__status().decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized union selector was received for type @NS_Emulation.NS_Provider_Evt.");
}
}

void NS__Provider__Evt_template::copy_value(const NS__Provider__Evt& other_value)
{
single_value.union_selection = other_value.get_selection();
switch (single_value.union_selection) {
case NS__Provider__Evt::ALT_link__status:
single_value.field_link__status = new NS__Provider__LinkStatus_template(other_value.link__status());
break;
default:
TTCN_error("Initializing a template with an unbound value of type @NS_Emulation.NS_Provider_Evt.");
}
set_selection(SPECIFIC_VALUE);
}

void NS__Provider__Evt_template::copy_template(const NS__Provider__Evt_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value.union_selection = other_value.single_value.union_selection;
switch (single_value.union_selection) {
case NS__Provider__Evt::ALT_link__status:
single_value.field_link__status = new NS__Provider__LinkStatus_template(*other_value.single_value.field_link__status);
break;
default:
TTCN_error("Internal error: Invalid union selector in a specific value when copying a template of type @NS_Emulation.NS_Provider_Evt.");
}
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 NS__Provider__Evt_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 NS__Provider__Evt_template(*other_value.implication_.precondition);
implication_.implied_template = new NS__Provider__Evt_template(*other_value.implication_.implied_template);
break;
case DYNAMIC_MATCH:
dyn_match = other_value.dyn_match;
dyn_match->ref_count++;
break;
default:
TTCN_error("Copying an uninitialized template of union type @NS_Emulation.NS_Provider_Evt.");
}
set_selection(other_value);
}

NS__Provider__Evt_template::NS__Provider__Evt_template()
{
}

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

NS__Provider__Evt_template::NS__Provider__Evt_template(const NS__Provider__Evt& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

NS__Provider__Evt_template& NS__Provider__Evt_template::operator=(const OPTIONAL<NS__Provider__Evt>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const NS__Provider__Evt&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of union type @NS_Emulation.NS_Provider_Evt.");
}
return *this;
}

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

boolean NS__Provider__Evt_template::match(const NS__Provider__Evt& 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:
{
NS__Provider__Evt::union_selection_type value_selection = other_value.get_selection();
if (value_selection == NS__Provider__Evt::UNBOUND_VALUE) return FALSE;
if (value_selection != single_value.union_selection) return FALSE;
switch (value_selection) {
case NS__Provider__Evt::ALT_link__status:
return single_value.field_link__status->match(other_value.link__status(), legacy);
default:
TTCN_error("Internal error: Invalid selector in a specific value when matching a template of union type @NS_Emulation.NS_Provider_Evt.");
}
}
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error ("Matching an uninitialized template of union type @NS_Emulation.NS_Provider_Evt.");
}
return FALSE;
}

boolean NS__Provider__Evt_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
switch (single_value.union_selection) {
case NS__Provider__Evt::ALT_link__status:
return single_value.field_link__status->is_value();
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing is_value operation on a template of union type @NS_Emulation.NS_Provider_Evt.");
}
}

NS__Provider__Evt NS__Provider__Evt_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent)
TTCN_error("Performing a valueof or send operation on a non-specific template of union type @NS_Emulation.NS_Provider_Evt.");
NS__Provider__Evt ret_val;
switch (single_value.union_selection) {
case NS__Provider__Evt::ALT_link__status:
ret_val.link__status() = single_value.field_link__status->valueof();
break;
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing valueof operation on a template of union type @NS_Emulation.NS_Provider_Evt.");
}
return ret_val;
}

NS__Provider__Evt_template& NS__Provider__Evt_template::list_item(unsigned int list_index) const
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Internal error: Accessing a list element of a non-list template of union type @NS_Emulation.NS_Provider_Evt.");
if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of union type @NS_Emulation.NS_Provider_Evt.");
return value_list.list_value[list_index];
}
void NS__Provider__Evt_template::set_type(template_sel template_type, unsigned int list_length)
{
if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error ("Internal error: Setting an invalid list for a template of union type @NS_Emulation.NS_Provider_Evt.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new NS__Provider__Evt_template[list_length];
}

NS__Provider__LinkStatus_template& NS__Provider__Evt_template::link__status()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != NS__Provider__Evt::ALT_link__status) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_link__status = new NS__Provider__LinkStatus_template(ANY_VALUE);
else single_value.field_link__status = new NS__Provider__LinkStatus_template;
single_value.union_selection = NS__Provider__Evt::ALT_link__status;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_link__status;
}

const NS__Provider__LinkStatus_template& NS__Provider__Evt_template::link__status() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field link_status in a non-specific template of union type @NS_Emulation.NS_Provider_Evt.");
if (single_value.union_selection != NS__Provider__Evt::ALT_link__status) TTCN_error("Accessing non-selected field link_status in a template of union type @NS_Emulation.NS_Provider_Evt.");
return *single_value.field_link__status;
}

boolean NS__Provider__Evt_template::ischosen(NS__Provider__Evt::union_selection_type checked_selection) const
{
if (checked_selection == NS__Provider__Evt::UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @NS_Emulation.NS_Provider_Evt.");
switch (template_selection) {
case SPECIFIC_VALUE:
if (single_value.union_selection == NS__Provider__Evt::UNBOUND_VALUE) TTCN_error("Internal error: Invalid selector in a specific value when performing ischosen() operation on a template of union type @NS_Emulation.NS_Provider_Evt.");
return single_value.union_selection == checked_selection;
case VALUE_LIST:
{
if (value_list.n_values < 1)
TTCN_error("Internal error: Performing ischosen() operation on a template of union type @NS_Emulation.NS_Provider_Evt containing an empty list.");
boolean ret_val = value_list.list_value[0].ischosen(checked_selection);
for (unsigned int list_count = 1; ret_val == TRUE && list_count < value_list.n_values; list_count++) {
ret_val = value_list.list_value[list_count].ischosen(checked_selection);
}
return ret_val;
}
default:
return FALSE;
}
return FALSE;
}

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

void NS__Provider__Evt_template::log_match(const NS__Provider__Evt& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity() && match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
return;
}
if (template_selection == SPECIFIC_VALUE && single_value.union_selection == match_value.get_selection()) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
switch (single_value.union_selection) {
case NS__Provider__Evt::ALT_link__status:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".link_status");
single_value.field_link__status->log_match(match_value.link__status(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ link_status := ");
single_value.field_link__status->log_match(match_value.link__status(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
default:
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str("<invalid selector>");
}
} else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void NS__Provider__Evt_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
switch (single_value.union_selection) {
case NS__Provider__Evt::ALT_link__status:
single_value.field_link__status->set_implicit_omit(); break;
default: break;
}
}

void NS__Provider__Evt_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
text_buf.push_int(single_value.union_selection);
switch (single_value.union_selection) {
case NS__Provider__Evt::ALT_link__status:
single_value.field_link__status->encode_text(text_buf);
break;
default:
TTCN_error("Internal error: Invalid selector in a specific value when encoding a template of union type @NS_Emulation.NS_Provider_Evt.");
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
text_buf.push_int(value_list.n_values);
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized template of type @NS_Emulation.NS_Provider_Evt.");
}
}

void NS__Provider__Evt_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
{
single_value.union_selection = NS__Provider__Evt::UNBOUND_VALUE;
NS__Provider__Evt::union_selection_type new_selection = (NS__Provider__Evt::union_selection_type)text_buf.pull_int().get_val();
switch (new_selection) {
case NS__Provider__Evt::ALT_link__status:
single_value.field_link__status = new NS__Provider__LinkStatus_template;
single_value.field_link__status->decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized union selector was received for a template of type @NS_Emulation.NS_Provider_Evt.");
}
single_value.union_selection = new_selection;
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new NS__Provider__Evt_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized selector was received in a template of type @NS_Emulation.NS_Provider_Evt.");
}
}

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

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

void NS__Provider__Evt_template::set_param(Module_Param& param)
{
  if (dynamic_cast<Module_Param_Name*>(param.get_id()) != NULL &&
      param.get_id()->next_name()) {
    char* param_field = param.get_id()->get_current_name();
    if (param_field[0] >= '0' && param_field[0] <= '9') {
      param.error("Unexpected array index in module parameter, expected a valid field"
        " name for union template type `@NS_Emulation.NS_Provider_Evt'");
    }
    if (strcmp("link_status", param_field) == 0) {
      link__status().set_param(param);
      return;
    } else param.error("Field `%s' not found in union template type `@NS_Emulation.NS_Provider_Evt'", param_field);
  }
  param.basic_check(Module_Param::BC_TEMPLATE, "union template");
  Module_Param_Ptr m_p = &param;
  switch (m_p->get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    NS__Provider__Evt_template new_temp;
    new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size());
    for (size_t p_i=0; p_i<m_p->get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (m_p->get_size()==0) break;
    param.type_error("union template", "@NS_Emulation.NS_Provider_Evt");
    break;
  case Module_Param::MP_Assignment_List: {
    Module_Param* mp_last = m_p->get_elem(m_p->get_size()-1);
    char* last_name = mp_last->get_id()->get_name();
    if (!strcmp(last_name, "link_status")) {
      link__status().set_param(*mp_last);
      break;
    }
    mp_last->error("Field %s does not exist in type @NS_Emulation.NS_Provider_Evt.", last_name);
  } break;
  case Module_Param::MP_Implication_Template: {
    NS__Provider__Evt_template* precondition = new NS__Provider__Evt_template;
    precondition->set_param(*m_p->get_elem(0));
    NS__Provider__Evt_template* implied_template = new NS__Provider__Evt_template;
    implied_template->set_param(*m_p->get_elem(1));
    *this = NS__Provider__Evt_template(precondition, implied_template);
  } break;
  default:
    param.type_error("union template", "@NS_Emulation.NS_Provider_Evt");
  }
  is_ifpresent = param.get_ifpresent();
}

void NS__Provider__Evt_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
switch (single_value.union_selection) {
case NS__Provider__Evt::ALT_link__status:
single_value.field_link__status->check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NS_Provider_Evt");
return;
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing check_restriction operation on a template of union type @NS_Emulation.NS_Provider_Evt.");
}
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 : "@NS_Emulation.NS_Provider_Evt");
}

void NS__PROVIDER__PT::remove_msg_queue_head()
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
switch (my_head->item_selection) {
case MESSAGE_0:
delete (my_head)->message_0;
break;
case MESSAGE_1:
delete (my_head)->message_1;
break;
default:
TTCN_error("Internal error: Invalid message selector in the queue of port %s.", port_name);
}
msg_queue_item_base *next_item = msg_queue_head->next_item;
delete (msg_queue_item*)msg_queue_head;
msg_queue_head = next_item;
if (next_item == NULL) msg_queue_tail = NULL;
TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::extract__msg, port_name, 0, ++msg_head_count, CHARSTRING(0,NULL), CHARSTRING(0,NULL));}

void NS__PROVIDER__PT::clear_queue()
{
while (msg_queue_head != NULL) remove_msg_queue_head();
}

NS__PROVIDER__PT::NS__PROVIDER__PT(const char *par_port_name)
 : PORT(par_port_name)
{
msg_queue_head = NULL;
msg_queue_tail = NULL;
}

NS__PROVIDER__PT::~NS__PROVIDER__PT()
{
clear_queue();
}

void NS__PROVIDER__PT::send(const NS__Types::PDU__NS& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name);
if (!destination_component.is_bound()) TTCN_error("Unbound component reference in the to clause of send operation.");
const TTCN_Logger::Severity log_sev = destination_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMSEND:TTCN_Logger::PORTEVENT_MCSEND;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_send(port_name, destination_component,
(TTCN_Logger::begin_event(log_sev, TRUE), TTCN_Logger::log_event_str(" @NS_Types.PDU_NS : "),
send_par.log(), TTCN_Logger::end_event_log2str()));
}
if (destination_component == SYSTEM_COMPREF) TTCN_error("Message cannot be sent to system on internal port %s.", port_name);
else {
Text_Buf text_buf;
prepare_message(text_buf, "@NS_Types.PDU_NS");
send_par.encode_text(text_buf);
send_data(text_buf, destination_component);
}
}

void NS__PROVIDER__PT::send(const NS__Types::PDU__NS& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect)
{
for (size_t i = 0; i < nof_components; ++i) send(send_par, destination_components[i], timestamp_redirect);
}

void NS__PROVIDER__PT::send(const NS__Types::PDU__NS& send_par, boolean broadcast, FLOAT* timestamp_redirect)
{
if (broadcast) {
if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name);
Text_Buf text_buf;
prepare_message(text_buf, "@NS_Types.PDU_NS");
send_par.encode_text(text_buf);
send_data_broadcast(text_buf, PORT::OMT_SEND, (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MCSEND, TRUE),
TTCN_Logger::log_event_str(" @NS_Types.PDU_NS : "), send_par.log(), TTCN_Logger::end_event_log2str()));
}
else send(send_par, COMPONENT(get_default_destination()), timestamp_redirect);
}

void NS__PROVIDER__PT::send(const NS__Types::PDU__NS_template& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
const NS__Types::PDU__NS& send_par_value = NS__Types::PDU__NS(send_par.valueof());
send(send_par_value, destination_component, timestamp_redirect);
}

void NS__PROVIDER__PT::send(const NS__Types::PDU__NS_template& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect)
{
const NS__Types::PDU__NS& send_par_value = NS__Types::PDU__NS(send_par.valueof());
send(send_par_value, nof_components, destination_components, timestamp_redirect);
}

void NS__PROVIDER__PT::send(const NS__Types::PDU__NS_template& send_par, boolean broadcast, FLOAT* timestamp_redirect)
{
const NS__Types::PDU__NS& send_par_value = NS__Types::PDU__NS(send_par.valueof());
send(send_par_value, broadcast, timestamp_redirect);
}

void NS__PROVIDER__PT::send(const NS__Provider__Evt& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name);
if (!destination_component.is_bound()) TTCN_error("Unbound component reference in the to clause of send operation.");
const TTCN_Logger::Severity log_sev = destination_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMSEND:TTCN_Logger::PORTEVENT_MCSEND;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_send(port_name, destination_component,
(TTCN_Logger::begin_event(log_sev, TRUE), TTCN_Logger::log_event_str(" @NS_Emulation.NS_Provider_Evt : "),
send_par.log(), TTCN_Logger::end_event_log2str()));
}
if (destination_component == SYSTEM_COMPREF) TTCN_error("Message cannot be sent to system on internal port %s.", port_name);
else {
Text_Buf text_buf;
prepare_message(text_buf, "@NS_Emulation.NS_Provider_Evt");
send_par.encode_text(text_buf);
send_data(text_buf, destination_component);
}
}

void NS__PROVIDER__PT::send(const NS__Provider__Evt& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect)
{
for (size_t i = 0; i < nof_components; ++i) send(send_par, destination_components[i], timestamp_redirect);
}

void NS__PROVIDER__PT::send(const NS__Provider__Evt& send_par, boolean broadcast, FLOAT* timestamp_redirect)
{
if (broadcast) {
if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name);
Text_Buf text_buf;
prepare_message(text_buf, "@NS_Emulation.NS_Provider_Evt");
send_par.encode_text(text_buf);
send_data_broadcast(text_buf, PORT::OMT_SEND, (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MCSEND, TRUE),
TTCN_Logger::log_event_str(" @NS_Emulation.NS_Provider_Evt : "), send_par.log(), TTCN_Logger::end_event_log2str()));
}
else send(send_par, COMPONENT(get_default_destination()), timestamp_redirect);
}

void NS__PROVIDER__PT::send(const NS__Provider__Evt_template& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
const NS__Provider__Evt& send_par_value = NS__Provider__Evt(send_par.valueof());
send(send_par_value, destination_component, timestamp_redirect);
}

void NS__PROVIDER__PT::send(const NS__Provider__Evt_template& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect)
{
const NS__Provider__Evt& send_par_value = NS__Provider__Evt(send_par.valueof());
send(send_par_value, nof_components, destination_components, timestamp_redirect);
}

void NS__PROVIDER__PT::send(const NS__Provider__Evt_template& send_par, boolean broadcast, FLOAT* timestamp_redirect)
{
const NS__Provider__Evt& send_par_value = NS__Provider__Evt(send_par.valueof());
send(send_par_value, broadcast, timestamp_redirect);
}

alt_status NS__PROVIDER__PT::receive(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else {
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS, "Matching on port %s succeeded.", port_name);
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
switch (my_head->item_selection) {
case MESSAGE_0:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Types.PDU_NS: "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
case MESSAGE_1:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NS_Provider_Evt: "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
default:
TTCN_error("Internal error: unknown message");
}
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NS__PROVIDER__PT::check_receive(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else {
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS, "Matching on port %s succeeded.", port_name);
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
switch (my_head->item_selection) {
case MESSAGE_0:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Types.PDU_NS: "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
case MESSAGE_1:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NS_Provider_Evt: "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
default:
TTCN_error("Internal error: unknown message");
}
}
return ALT_YES;
}
}

alt_status NS__PROVIDER__PT::trigger(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s will drop a message: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
remove_msg_queue_head();
return ALT_REPEAT;
} else {
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS, "Matching on port %s succeeded.", port_name);
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
switch (my_head->item_selection) {
case MESSAGE_0:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Types.PDU_NS: "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
case MESSAGE_1:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NS_Provider_Evt: "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
default:
TTCN_error("Internal error: unknown message");
}
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NS__PROVIDER__PT::receive(const NS__Types::PDU__NS_template& value_template, NS__Types::PDU__NS *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_0) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @NS_Types.PDU_NS.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_0)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_0;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Types.PDU_NS : "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NS__PROVIDER__PT::check_receive(const NS__Types::PDU__NS_template& value_template, NS__Types::PDU__NS *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Check-receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_0) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @NS_Types.PDU_NS.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_0)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_0;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Types.PDU_NS : "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
return ALT_YES;
}
}

alt_status NS__PROVIDER__PT::trigger(const NS__Types::PDU__NS_template& value_template, NS__Types::PDU__NS *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Trigger operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s will drop a message: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
remove_msg_queue_head();
return ALT_REPEAT;
} else if (my_head->item_selection != MESSAGE_0) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s will drop a message: Type of the first message in the queue is not @NS_Types.PDU_NS.", port_name);
remove_msg_queue_head();
return ALT_REPEAT;
} else if (!value_template.match(*my_head->message_0)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
remove_msg_queue_head();
return ALT_REPEAT;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_0;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Types.PDU_NS : "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NS__PROVIDER__PT::receive(const NS__Provider__Evt_template& value_template, NS__Provider__Evt *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_1) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @NS_Emulation.NS_Provider_Evt.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_1)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_1;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NS_Provider_Evt : "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NS__PROVIDER__PT::check_receive(const NS__Provider__Evt_template& value_template, NS__Provider__Evt *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Check-receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_1) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @NS_Emulation.NS_Provider_Evt.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_1)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_1;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NS_Provider_Evt : "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
return ALT_YES;
}
}

alt_status NS__PROVIDER__PT::trigger(const NS__Provider__Evt_template& value_template, NS__Provider__Evt *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Trigger operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s will drop a message: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
remove_msg_queue_head();
return ALT_REPEAT;
} else if (my_head->item_selection != MESSAGE_1) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s will drop a message: Type of the first message in the queue is not @NS_Emulation.NS_Provider_Evt.", port_name);
remove_msg_queue_head();
return ALT_REPEAT;
} else if (!value_template.match(*my_head->message_1)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
remove_msg_queue_head();
return ALT_REPEAT;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_1;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NS_Provider_Evt : "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

void NS__PROVIDER__PT::incoming_message(const NS__Types::PDU__NS& incoming_par, component sender_component)
{
if (!is_started) {
if (is_halted) {
TTCN_warning("A message that arrived on port %s has been discarded, because the port is not started.", port_name);
return;
}
else {
TTCN_error("Port %s is not started but a message has arrived on it.", port_name);
}
}
msg_tail_count++;
if (TTCN_Logger::log_this_event(TTCN_Logger::PORTEVENT_MQUEUE)) {
TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::enqueue__msg, port_name, sender_component, msg_tail_count,
CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MQUEUE, TRUE), TTCN_Logger::log_event_str(" @NS_Types.PDU_NS : "), incoming_par.log(), TTCN_Logger::end_event_log2str()));
}
msg_queue_item *new_item = new msg_queue_item;
new_item->item_selection = MESSAGE_0;
new_item->message_0 = new NS__Types::PDU__NS(incoming_par);
new_item->sender_component = sender_component;
append_to_msg_queue(new_item);
}

void NS__PROVIDER__PT::incoming_message(const NS__Provider__Evt& incoming_par, component sender_component)
{
if (!is_started) {
if (is_halted) {
TTCN_warning("A message that arrived on port %s has been discarded, because the port is not started.", port_name);
return;
}
else {
TTCN_error("Port %s is not started but a message has arrived on it.", port_name);
}
}
msg_tail_count++;
if (TTCN_Logger::log_this_event(TTCN_Logger::PORTEVENT_MQUEUE)) {
TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::enqueue__msg, port_name, sender_component, msg_tail_count,
CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MQUEUE, TRUE), TTCN_Logger::log_event_str(" @NS_Emulation.NS_Provider_Evt : "), incoming_par.log(), TTCN_Logger::end_event_log2str()));
}
msg_queue_item *new_item = new msg_queue_item;
new_item->item_selection = MESSAGE_1;
new_item->message_1 = new NS__Provider__Evt(incoming_par);
new_item->sender_component = sender_component;
append_to_msg_queue(new_item);
}

boolean NS__PROVIDER__PT::process_message(const char *message_type, Text_Buf& incoming_buf, component sender_component, OCTETSTRING&)
{
if (!strcmp(message_type, "@NS_Types.PDU_NS")) {
NS__Types::PDU__NS incoming_par;
incoming_par.decode_text(incoming_buf);
incoming_message(incoming_par, sender_component);
return TRUE;
} else if (!strcmp(message_type, "@NS_Emulation.NS_Provider_Evt")) {
NS__Provider__Evt incoming_par;
incoming_par.decode_text(incoming_buf);
incoming_message(incoming_par, sender_component);
return TRUE;
} else return FALSE;
}

NSVCConfigurationIP::NSVCConfigurationIP()
{
}

NSVCConfigurationIP::NSVCConfigurationIP(const Osmocom__Types::AddressFamily& par_address__family,
    const INTEGER& par_local__udp__port,
    const CHARSTRING& par_local__ip,
    const INTEGER& par_remote__udp__port,
    const CHARSTRING& par_remote__ip,
    const INTEGER& par_data__weight,
    const INTEGER& par_signalling__weight)
  :   field_address__family(par_address__family),
  field_local__udp__port(par_local__udp__port),
  field_local__ip(par_local__ip),
  field_remote__udp__port(par_remote__udp__port),
  field_remote__ip(par_remote__ip),
  field_data__weight(par_data__weight),
  field_signalling__weight(par_signalling__weight)
{
}

NSVCConfigurationIP::NSVCConfigurationIP(const NSVCConfigurationIP& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @NS_Emulation.NSVCConfigurationIP.");
if (other_value.address__family().is_bound()) field_address__family = other_value.address__family();
else field_address__family.clean_up();
if (other_value.local__udp__port().is_bound()) field_local__udp__port = other_value.local__udp__port();
else field_local__udp__port.clean_up();
if (other_value.local__ip().is_bound()) field_local__ip = other_value.local__ip();
else field_local__ip.clean_up();
if (other_value.remote__udp__port().is_bound()) field_remote__udp__port = other_value.remote__udp__port();
else field_remote__udp__port.clean_up();
if (other_value.remote__ip().is_bound()) field_remote__ip = other_value.remote__ip();
else field_remote__ip.clean_up();
if (other_value.data__weight().is_bound()) field_data__weight = other_value.data__weight();
else field_data__weight.clean_up();
if (other_value.signalling__weight().is_bound()) field_signalling__weight = other_value.signalling__weight();
else field_signalling__weight.clean_up();
}

void NSVCConfigurationIP::clean_up()
{
field_address__family.clean_up();
field_local__udp__port.clean_up();
field_local__ip.clean_up();
field_remote__udp__port.clean_up();
field_remote__ip.clean_up();
field_data__weight.clean_up();
field_signalling__weight.clean_up();
}

const TTCN_Typedescriptor_t* NSVCConfigurationIP::get_descriptor() const { return &NSVCConfigurationIP_descr_; }
NSVCConfigurationIP& NSVCConfigurationIP::operator=(const NSVCConfigurationIP& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @NS_Emulation.NSVCConfigurationIP.");
  if (other_value.address__family().is_bound()) field_address__family = other_value.address__family();
  else field_address__family.clean_up();
  if (other_value.local__udp__port().is_bound()) field_local__udp__port = other_value.local__udp__port();
  else field_local__udp__port.clean_up();
  if (other_value.local__ip().is_bound()) field_local__ip = other_value.local__ip();
  else field_local__ip.clean_up();
  if (other_value.remote__udp__port().is_bound()) field_remote__udp__port = other_value.remote__udp__port();
  else field_remote__udp__port.clean_up();
  if (other_value.remote__ip().is_bound()) field_remote__ip = other_value.remote__ip();
  else field_remote__ip.clean_up();
  if (other_value.data__weight().is_bound()) field_data__weight = other_value.data__weight();
  else field_data__weight.clean_up();
  if (other_value.signalling__weight().is_bound()) field_signalling__weight = other_value.signalling__weight();
  else field_signalling__weight.clean_up();
}
return *this;
}

boolean NSVCConfigurationIP::operator==(const NSVCConfigurationIP& other_value) const
{
return field_address__family==other_value.field_address__family
  && field_local__udp__port==other_value.field_local__udp__port
  && field_local__ip==other_value.field_local__ip
  && field_remote__udp__port==other_value.field_remote__udp__port
  && field_remote__ip==other_value.field_remote__ip
  && field_data__weight==other_value.field_data__weight
  && field_signalling__weight==other_value.field_signalling__weight;
}

boolean NSVCConfigurationIP::is_bound() const
{
return (field_address__family.is_bound())
  || (field_local__udp__port.is_bound())
  || (field_local__ip.is_bound())
  || (field_remote__udp__port.is_bound())
  || (field_remote__ip.is_bound())
  || (field_data__weight.is_bound())
  || (field_signalling__weight.is_bound());
}
boolean NSVCConfigurationIP::is_value() const
{
return field_address__family.is_value()
  && field_local__udp__port.is_value()
  && field_local__ip.is_value()
  && field_remote__udp__port.is_value()
  && field_remote__ip.is_value()
  && field_data__weight.is_value()
  && field_signalling__weight.is_value();
}
void NSVCConfigurationIP::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ address_family := ");
field_address__family.log();
TTCN_Logger::log_event_str(", local_udp_port := ");
field_local__udp__port.log();
TTCN_Logger::log_event_str(", local_ip := ");
field_local__ip.log();
TTCN_Logger::log_event_str(", remote_udp_port := ");
field_remote__udp__port.log();
TTCN_Logger::log_event_str(", remote_ip := ");
field_remote__ip.log();
TTCN_Logger::log_event_str(", data_weight := ");
field_data__weight.log();
TTCN_Logger::log_event_str(", signalling_weight := ");
field_signalling__weight.log();
TTCN_Logger::log_event_str(" }");
}

void NSVCConfigurationIP::set_implicit_omit()
{
if (address__family().is_bound()) address__family().set_implicit_omit();
if (local__udp__port().is_bound()) local__udp__port().set_implicit_omit();
if (local__ip().is_bound()) local__ip().set_implicit_omit();
if (remote__udp__port().is_bound()) remote__udp__port().set_implicit_omit();
if (remote__ip().is_bound()) remote__ip().set_implicit_omit();
if (data__weight().is_bound()) data__weight().set_implicit_omit();
if (signalling__weight().is_bound()) signalling__weight().set_implicit_omit();
}

void NSVCConfigurationIP::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (7<param.get_size()) {
      param.error("record value of type @NS_Emulation.NSVCConfigurationIP has 7 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) address__family().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) local__udp__port().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) local__ip().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) remote__udp__port().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) remote__ip().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) data__weight().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) signalling__weight().set_param(*param.get_elem(6));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "address_family")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          address__family().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "local_udp_port")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          local__udp__port().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "local_ip")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          local__ip().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "remote_udp_port")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          remote__udp__port().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "remote_ip")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          remote__ip().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "data_weight")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          data__weight().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "signalling_weight")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          signalling__weight().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 @NS_Emulation.NSVCConfigurationIP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@NS_Emulation.NSVCConfigurationIP");
  }
}

void NSVCConfigurationIP::encode_text(Text_Buf& text_buf) const
{
field_address__family.encode_text(text_buf);
field_local__udp__port.encode_text(text_buf);
field_local__ip.encode_text(text_buf);
field_remote__udp__port.encode_text(text_buf);
field_remote__ip.encode_text(text_buf);
field_data__weight.encode_text(text_buf);
field_signalling__weight.encode_text(text_buf);
}

void NSVCConfigurationIP::decode_text(Text_Buf& text_buf)
{
field_address__family.decode_text(text_buf);
field_local__udp__port.decode_text(text_buf);
field_local__ip.decode_text(text_buf);
field_remote__udp__port.decode_text(text_buf);
field_remote__ip.decode_text(text_buf);
field_data__weight.decode_text(text_buf);
field_signalling__weight.decode_text(text_buf);
}

struct NSVCConfigurationIP_template::single_value_struct {
Osmocom__Types::AddressFamily_template field_address__family;
INTEGER_template field_local__udp__port;
CHARSTRING_template field_local__ip;
INTEGER_template field_remote__udp__port;
CHARSTRING_template field_remote__ip;
INTEGER_template field_data__weight;
INTEGER_template field_signalling__weight;
};

void NSVCConfigurationIP_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_address__family = ANY_VALUE;
single_value->field_local__udp__port = ANY_VALUE;
single_value->field_local__ip = ANY_VALUE;
single_value->field_remote__udp__port = ANY_VALUE;
single_value->field_remote__ip = ANY_VALUE;
single_value->field_data__weight = ANY_VALUE;
single_value->field_signalling__weight = ANY_VALUE;
}
}
}

void NSVCConfigurationIP_template::copy_value(const NSVCConfigurationIP& other_value)
{
single_value = new single_value_struct;
if (other_value.address__family().is_bound()) {
  single_value->field_address__family = other_value.address__family();
} else {
  single_value->field_address__family.clean_up();
}
if (other_value.local__udp__port().is_bound()) {
  single_value->field_local__udp__port = other_value.local__udp__port();
} else {
  single_value->field_local__udp__port.clean_up();
}
if (other_value.local__ip().is_bound()) {
  single_value->field_local__ip = other_value.local__ip();
} else {
  single_value->field_local__ip.clean_up();
}
if (other_value.remote__udp__port().is_bound()) {
  single_value->field_remote__udp__port = other_value.remote__udp__port();
} else {
  single_value->field_remote__udp__port.clean_up();
}
if (other_value.remote__ip().is_bound()) {
  single_value->field_remote__ip = other_value.remote__ip();
} else {
  single_value->field_remote__ip.clean_up();
}
if (other_value.data__weight().is_bound()) {
  single_value->field_data__weight = other_value.data__weight();
} else {
  single_value->field_data__weight.clean_up();
}
if (other_value.signalling__weight().is_bound()) {
  single_value->field_signalling__weight = other_value.signalling__weight();
} else {
  single_value->field_signalling__weight.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void NSVCConfigurationIP_template::copy_template(const NSVCConfigurationIP_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.address__family().get_selection()) {
single_value->field_address__family = other_value.address__family();
} else {
single_value->field_address__family.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.local__udp__port().get_selection()) {
single_value->field_local__udp__port = other_value.local__udp__port();
} else {
single_value->field_local__udp__port.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.local__ip().get_selection()) {
single_value->field_local__ip = other_value.local__ip();
} else {
single_value->field_local__ip.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.remote__udp__port().get_selection()) {
single_value->field_remote__udp__port = other_value.remote__udp__port();
} else {
single_value->field_remote__udp__port.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.remote__ip().get_selection()) {
single_value->field_remote__ip = other_value.remote__ip();
} else {
single_value->field_remote__ip.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.data__weight().get_selection()) {
single_value->field_data__weight = other_value.data__weight();
} else {
single_value->field_data__weight.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.signalling__weight().get_selection()) {
single_value->field_signalling__weight = other_value.signalling__weight();
} else {
single_value->field_signalling__weight.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 NSVCConfigurationIP_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 NSVCConfigurationIP_template(*other_value.implication_.precondition);
implication_.implied_template = new NSVCConfigurationIP_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 @NS_Emulation.NSVCConfigurationIP.");
break;
}
set_selection(other_value);
}

NSVCConfigurationIP_template::NSVCConfigurationIP_template()
{
}

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

NSVCConfigurationIP_template::NSVCConfigurationIP_template(const NSVCConfigurationIP& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean NSVCConfigurationIP_template::match(const NSVCConfigurationIP& 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.address__family().is_bound()) return FALSE;
if(!single_value->field_address__family.match(other_value.address__family(), legacy))return FALSE;
if(!other_value.local__udp__port().is_bound()) return FALSE;
if(!single_value->field_local__udp__port.match(other_value.local__udp__port(), legacy))return FALSE;
if(!other_value.local__ip().is_bound()) return FALSE;
if(!single_value->field_local__ip.match(other_value.local__ip(), legacy))return FALSE;
if(!other_value.remote__udp__port().is_bound()) return FALSE;
if(!single_value->field_remote__udp__port.match(other_value.remote__udp__port(), legacy))return FALSE;
if(!other_value.remote__ip().is_bound()) return FALSE;
if(!single_value->field_remote__ip.match(other_value.remote__ip(), legacy))return FALSE;
if(!other_value.data__weight().is_bound()) return FALSE;
if(!single_value->field_data__weight.match(other_value.data__weight(), legacy))return FALSE;
if(!other_value.signalling__weight().is_bound()) return FALSE;
if(!single_value->field_signalling__weight.match(other_value.signalling__weight(), 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 @NS_Emulation.NSVCConfigurationIP.");
}
return FALSE;
}

boolean NSVCConfigurationIP_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_address__family.is_bound()
 || single_value->field_local__udp__port.is_bound()
 || single_value->field_local__ip.is_bound()
 || single_value->field_remote__udp__port.is_bound()
 || single_value->field_remote__ip.is_bound()
 || single_value->field_data__weight.is_bound()
 || single_value->field_signalling__weight.is_bound();
}

boolean NSVCConfigurationIP_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_address__family.is_value()
 && single_value->field_local__udp__port.is_value()
 && single_value->field_local__ip.is_value()
 && single_value->field_remote__udp__port.is_value()
 && single_value->field_remote__ip.is_value()
 && single_value->field_data__weight.is_value()
 && single_value->field_signalling__weight.is_value();
}

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

NSVCConfigurationIP NSVCConfigurationIP_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 @NS_Emulation.NSVCConfigurationIP.");
NSVCConfigurationIP ret_val;
if (single_value->field_address__family.is_bound()) {
ret_val.address__family() = single_value->field_address__family.valueof();
}
if (single_value->field_local__udp__port.is_bound()) {
ret_val.local__udp__port() = single_value->field_local__udp__port.valueof();
}
if (single_value->field_local__ip.is_bound()) {
ret_val.local__ip() = single_value->field_local__ip.valueof();
}
if (single_value->field_remote__udp__port.is_bound()) {
ret_val.remote__udp__port() = single_value->field_remote__udp__port.valueof();
}
if (single_value->field_remote__ip.is_bound()) {
ret_val.remote__ip() = single_value->field_remote__ip.valueof();
}
if (single_value->field_data__weight.is_bound()) {
ret_val.data__weight() = single_value->field_data__weight.valueof();
}
if (single_value->field_signalling__weight.is_bound()) {
ret_val.signalling__weight() = single_value->field_signalling__weight.valueof();
}
return ret_val;
}

void NSVCConfigurationIP_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 @NS_Emulation.NSVCConfigurationIP.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new NSVCConfigurationIP_template[list_length];
}

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

Osmocom__Types::AddressFamily_template& NSVCConfigurationIP_template::address__family()
{
set_specific();
return single_value->field_address__family;
}

const Osmocom__Types::AddressFamily_template& NSVCConfigurationIP_template::address__family() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field address_family of a non-specific template of type @NS_Emulation.NSVCConfigurationIP.");
return single_value->field_address__family;
}

INTEGER_template& NSVCConfigurationIP_template::local__udp__port()
{
set_specific();
return single_value->field_local__udp__port;
}

const INTEGER_template& NSVCConfigurationIP_template::local__udp__port() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field local_udp_port of a non-specific template of type @NS_Emulation.NSVCConfigurationIP.");
return single_value->field_local__udp__port;
}

CHARSTRING_template& NSVCConfigurationIP_template::local__ip()
{
set_specific();
return single_value->field_local__ip;
}

const CHARSTRING_template& NSVCConfigurationIP_template::local__ip() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field local_ip of a non-specific template of type @NS_Emulation.NSVCConfigurationIP.");
return single_value->field_local__ip;
}

INTEGER_template& NSVCConfigurationIP_template::remote__udp__port()
{
set_specific();
return single_value->field_remote__udp__port;
}

const INTEGER_template& NSVCConfigurationIP_template::remote__udp__port() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field remote_udp_port of a non-specific template of type @NS_Emulation.NSVCConfigurationIP.");
return single_value->field_remote__udp__port;
}

CHARSTRING_template& NSVCConfigurationIP_template::remote__ip()
{
set_specific();
return single_value->field_remote__ip;
}

const CHARSTRING_template& NSVCConfigurationIP_template::remote__ip() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field remote_ip of a non-specific template of type @NS_Emulation.NSVCConfigurationIP.");
return single_value->field_remote__ip;
}

INTEGER_template& NSVCConfigurationIP_template::data__weight()
{
set_specific();
return single_value->field_data__weight;
}

const INTEGER_template& NSVCConfigurationIP_template::data__weight() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field data_weight of a non-specific template of type @NS_Emulation.NSVCConfigurationIP.");
return single_value->field_data__weight;
}

INTEGER_template& NSVCConfigurationIP_template::signalling__weight()
{
set_specific();
return single_value->field_signalling__weight;
}

const INTEGER_template& NSVCConfigurationIP_template::signalling__weight() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field signalling_weight of a non-specific template of type @NS_Emulation.NSVCConfigurationIP.");
return single_value->field_signalling__weight;
}

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

void NSVCConfigurationIP_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ address_family := ");
single_value->field_address__family.log();
TTCN_Logger::log_event_str(", local_udp_port := ");
single_value->field_local__udp__port.log();
TTCN_Logger::log_event_str(", local_ip := ");
single_value->field_local__ip.log();
TTCN_Logger::log_event_str(", remote_udp_port := ");
single_value->field_remote__udp__port.log();
TTCN_Logger::log_event_str(", remote_ip := ");
single_value->field_remote__ip.log();
TTCN_Logger::log_event_str(", data_weight := ");
single_value->field_data__weight.log();
TTCN_Logger::log_event_str(", signalling_weight := ");
single_value->field_signalling__weight.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 NSVCConfigurationIP_template::log_match(const NSVCConfigurationIP& 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_address__family.match(match_value.address__family(), legacy)){
TTCN_Logger::log_logmatch_info(".address_family");
single_value->field_address__family.log_match(match_value.address__family(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_local__udp__port.match(match_value.local__udp__port(), legacy)){
TTCN_Logger::log_logmatch_info(".local_udp_port");
single_value->field_local__udp__port.log_match(match_value.local__udp__port(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_local__ip.match(match_value.local__ip(), legacy)){
TTCN_Logger::log_logmatch_info(".local_ip");
single_value->field_local__ip.log_match(match_value.local__ip(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_remote__udp__port.match(match_value.remote__udp__port(), legacy)){
TTCN_Logger::log_logmatch_info(".remote_udp_port");
single_value->field_remote__udp__port.log_match(match_value.remote__udp__port(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_remote__ip.match(match_value.remote__ip(), legacy)){
TTCN_Logger::log_logmatch_info(".remote_ip");
single_value->field_remote__ip.log_match(match_value.remote__ip(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_data__weight.match(match_value.data__weight(), legacy)){
TTCN_Logger::log_logmatch_info(".data_weight");
single_value->field_data__weight.log_match(match_value.data__weight(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_signalling__weight.match(match_value.signalling__weight(), legacy)){
TTCN_Logger::log_logmatch_info(".signalling_weight");
single_value->field_signalling__weight.log_match(match_value.signalling__weight(), 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("{ address_family := ");
single_value->field_address__family.log_match(match_value.address__family(), legacy);
TTCN_Logger::log_event_str(", local_udp_port := ");
single_value->field_local__udp__port.log_match(match_value.local__udp__port(), legacy);
TTCN_Logger::log_event_str(", local_ip := ");
single_value->field_local__ip.log_match(match_value.local__ip(), legacy);
TTCN_Logger::log_event_str(", remote_udp_port := ");
single_value->field_remote__udp__port.log_match(match_value.remote__udp__port(), legacy);
TTCN_Logger::log_event_str(", remote_ip := ");
single_value->field_remote__ip.log_match(match_value.remote__ip(), legacy);
TTCN_Logger::log_event_str(", data_weight := ");
single_value->field_data__weight.log_match(match_value.data__weight(), legacy);
TTCN_Logger::log_event_str(", signalling_weight := ");
single_value->field_signalling__weight.log_match(match_value.signalling__weight(), 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 NSVCConfigurationIP_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (address__family().is_bound()) address__family().set_implicit_omit();
if (local__udp__port().is_bound()) local__udp__port().set_implicit_omit();
if (local__ip().is_bound()) local__ip().set_implicit_omit();
if (remote__udp__port().is_bound()) remote__udp__port().set_implicit_omit();
if (remote__ip().is_bound()) remote__ip().set_implicit_omit();
if (data__weight().is_bound()) data__weight().set_implicit_omit();
if (signalling__weight().is_bound()) signalling__weight().set_implicit_omit();
}

void NSVCConfigurationIP_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_address__family.encode_text(text_buf);
single_value->field_local__udp__port.encode_text(text_buf);
single_value->field_local__ip.encode_text(text_buf);
single_value->field_remote__udp__port.encode_text(text_buf);
single_value->field_remote__ip.encode_text(text_buf);
single_value->field_data__weight.encode_text(text_buf);
single_value->field_signalling__weight.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 @NS_Emulation.NSVCConfigurationIP.");
}
}

void NSVCConfigurationIP_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_address__family.decode_text(text_buf);
single_value->field_local__udp__port.decode_text(text_buf);
single_value->field_local__ip.decode_text(text_buf);
single_value->field_remote__udp__port.decode_text(text_buf);
single_value->field_remote__ip.decode_text(text_buf);
single_value->field_data__weight.decode_text(text_buf);
single_value->field_signalling__weight.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 NSVCConfigurationIP_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 @NS_Emulation.NSVCConfigurationIP.");
}
}

void NSVCConfigurationIP_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: {
    NSVCConfigurationIP_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (7<param.get_size()) {
      param.error("record template of type @NS_Emulation.NSVCConfigurationIP has 7 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) address__family().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) local__udp__port().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) local__ip().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) remote__udp__port().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) remote__ip().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) data__weight().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) signalling__weight().set_param(*param.get_elem(6));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "address_family")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          address__family().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "local_udp_port")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          local__udp__port().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "local_ip")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          local__ip().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "remote_udp_port")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          remote__udp__port().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "remote_ip")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          remote__ip().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "data_weight")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          data__weight().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "signalling_weight")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          signalling__weight().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 @NS_Emulation.NSVCConfigurationIP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    NSVCConfigurationIP_template* precondition = new NSVCConfigurationIP_template;
    precondition->set_param(*param.get_elem(0));
    NSVCConfigurationIP_template* implied_template = new NSVCConfigurationIP_template;
    implied_template->set_param(*param.get_elem(1));
    *this = NSVCConfigurationIP_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@NS_Emulation.NSVCConfigurationIP");
  }
  is_ifpresent = param.get_ifpresent();
}

void NSVCConfigurationIP_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_address__family.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NSVCConfigurationIP");
single_value->field_local__udp__port.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NSVCConfigurationIP");
single_value->field_local__ip.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NSVCConfigurationIP");
single_value->field_remote__udp__port.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NSVCConfigurationIP");
single_value->field_remote__ip.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NSVCConfigurationIP");
single_value->field_data__weight.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NSVCConfigurationIP");
single_value->field_signalling__weight.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NSVCConfigurationIP");
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 : "@NS_Emulation.NSVCConfigurationIP");
}

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

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

NSVCConfigurationFR::NSVCConfigurationFR()
{
}

NSVCConfigurationFR::NSVCConfigurationFR(const CHARSTRING& par_netdev,
    const INTEGER& par_dlci)
  :   field_netdev(par_netdev),
  field_dlci(par_dlci)
{
}

NSVCConfigurationFR::NSVCConfigurationFR(const NSVCConfigurationFR& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @NS_Emulation.NSVCConfigurationFR.");
if (other_value.netdev().is_bound()) field_netdev = other_value.netdev();
else field_netdev.clean_up();
if (other_value.dlci().is_bound()) field_dlci = other_value.dlci();
else field_dlci.clean_up();
}

void NSVCConfigurationFR::clean_up()
{
field_netdev.clean_up();
field_dlci.clean_up();
}

const TTCN_Typedescriptor_t* NSVCConfigurationFR::get_descriptor() const { return &NSVCConfigurationFR_descr_; }
NSVCConfigurationFR& NSVCConfigurationFR::operator=(const NSVCConfigurationFR& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @NS_Emulation.NSVCConfigurationFR.");
  if (other_value.netdev().is_bound()) field_netdev = other_value.netdev();
  else field_netdev.clean_up();
  if (other_value.dlci().is_bound()) field_dlci = other_value.dlci();
  else field_dlci.clean_up();
}
return *this;
}

boolean NSVCConfigurationFR::operator==(const NSVCConfigurationFR& other_value) const
{
return field_netdev==other_value.field_netdev
  && field_dlci==other_value.field_dlci;
}

boolean NSVCConfigurationFR::is_bound() const
{
return (field_netdev.is_bound())
  || (field_dlci.is_bound());
}
boolean NSVCConfigurationFR::is_value() const
{
return field_netdev.is_value()
  && field_dlci.is_value();
}
void NSVCConfigurationFR::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ netdev := ");
field_netdev.log();
TTCN_Logger::log_event_str(", dlci := ");
field_dlci.log();
TTCN_Logger::log_event_str(" }");
}

void NSVCConfigurationFR::set_implicit_omit()
{
if (netdev().is_bound()) netdev().set_implicit_omit();
if (dlci().is_bound()) dlci().set_implicit_omit();
}

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

void NSVCConfigurationFR::encode_text(Text_Buf& text_buf) const
{
field_netdev.encode_text(text_buf);
field_dlci.encode_text(text_buf);
}

void NSVCConfigurationFR::decode_text(Text_Buf& text_buf)
{
field_netdev.decode_text(text_buf);
field_dlci.decode_text(text_buf);
}

struct NSVCConfigurationFR_template::single_value_struct {
CHARSTRING_template field_netdev;
INTEGER_template field_dlci;
};

void NSVCConfigurationFR_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_netdev = ANY_VALUE;
single_value->field_dlci = ANY_VALUE;
}
}
}

void NSVCConfigurationFR_template::copy_value(const NSVCConfigurationFR& other_value)
{
single_value = new single_value_struct;
if (other_value.netdev().is_bound()) {
  single_value->field_netdev = other_value.netdev();
} else {
  single_value->field_netdev.clean_up();
}
if (other_value.dlci().is_bound()) {
  single_value->field_dlci = other_value.dlci();
} else {
  single_value->field_dlci.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void NSVCConfigurationFR_template::copy_template(const NSVCConfigurationFR_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.netdev().get_selection()) {
single_value->field_netdev = other_value.netdev();
} else {
single_value->field_netdev.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.dlci().get_selection()) {
single_value->field_dlci = other_value.dlci();
} else {
single_value->field_dlci.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 NSVCConfigurationFR_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 NSVCConfigurationFR_template(*other_value.implication_.precondition);
implication_.implied_template = new NSVCConfigurationFR_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 @NS_Emulation.NSVCConfigurationFR.");
break;
}
set_selection(other_value);
}

NSVCConfigurationFR_template::NSVCConfigurationFR_template()
{
}

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

NSVCConfigurationFR_template::NSVCConfigurationFR_template(const NSVCConfigurationFR& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean NSVCConfigurationFR_template::match(const NSVCConfigurationFR& 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.netdev().is_bound()) return FALSE;
if(!single_value->field_netdev.match(other_value.netdev(), legacy))return FALSE;
if(!other_value.dlci().is_bound()) return FALSE;
if(!single_value->field_dlci.match(other_value.dlci(), 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 @NS_Emulation.NSVCConfigurationFR.");
}
return FALSE;
}

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

boolean NSVCConfigurationFR_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_netdev.is_value()
 && single_value->field_dlci.is_value();
}

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

NSVCConfigurationFR NSVCConfigurationFR_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 @NS_Emulation.NSVCConfigurationFR.");
NSVCConfigurationFR ret_val;
if (single_value->field_netdev.is_bound()) {
ret_val.netdev() = single_value->field_netdev.valueof();
}
if (single_value->field_dlci.is_bound()) {
ret_val.dlci() = single_value->field_dlci.valueof();
}
return ret_val;
}

void NSVCConfigurationFR_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 @NS_Emulation.NSVCConfigurationFR.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new NSVCConfigurationFR_template[list_length];
}

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

CHARSTRING_template& NSVCConfigurationFR_template::netdev()
{
set_specific();
return single_value->field_netdev;
}

const CHARSTRING_template& NSVCConfigurationFR_template::netdev() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field netdev of a non-specific template of type @NS_Emulation.NSVCConfigurationFR.");
return single_value->field_netdev;
}

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

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

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

void NSVCConfigurationFR_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ netdev := ");
single_value->field_netdev.log();
TTCN_Logger::log_event_str(", dlci := ");
single_value->field_dlci.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 NSVCConfigurationFR_template::log_match(const NSVCConfigurationFR& 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_netdev.match(match_value.netdev(), legacy)){
TTCN_Logger::log_logmatch_info(".netdev");
single_value->field_netdev.log_match(match_value.netdev(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_dlci.match(match_value.dlci(), legacy)){
TTCN_Logger::log_logmatch_info(".dlci");
single_value->field_dlci.log_match(match_value.dlci(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}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("{ netdev := ");
single_value->field_netdev.log_match(match_value.netdev(), legacy);
TTCN_Logger::log_event_str(", dlci := ");
single_value->field_dlci.log_match(match_value.dlci(), 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 NSVCConfigurationFR_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (netdev().is_bound()) netdev().set_implicit_omit();
if (dlci().is_bound()) dlci().set_implicit_omit();
}

void NSVCConfigurationFR_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_netdev.encode_text(text_buf);
single_value->field_dlci.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 @NS_Emulation.NSVCConfigurationFR.");
}
}

void NSVCConfigurationFR_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_netdev.decode_text(text_buf);
single_value->field_dlci.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 NSVCConfigurationFR_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 @NS_Emulation.NSVCConfigurationFR.");
}
}

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

void NSVCConfigurationFR_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_netdev.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NSVCConfigurationFR");
single_value->field_dlci.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NSVCConfigurationFR");
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 : "@NS_Emulation.NSVCConfigurationFR");
}

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

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

void NSVCConfigurationP::copy_value(const NSVCConfigurationP& other_value)
{
switch (other_value.union_selection) {
case ALT_ip:
field_ip = new NSVCConfigurationIP(*other_value.field_ip);
break;
case ALT_fr:
field_fr = new NSVCConfigurationFR(*other_value.field_fr);
break;
default:
TTCN_error("Assignment of an unbound union value of type @NS_Emulation.NSVCConfigurationP.");
}
union_selection = other_value.union_selection;
}

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

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

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

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

boolean NSVCConfigurationP::operator==(const NSVCConfigurationP& other_value) const
{
if (union_selection == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of union type @NS_Emulation.NSVCConfigurationP.");
if (other_value.union_selection == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of union type @NS_Emulation.NSVCConfigurationP.");
if (union_selection != other_value.union_selection) return FALSE;
switch (union_selection) {
case ALT_ip:
return *field_ip == *other_value.field_ip;
case ALT_fr:
return *field_fr == *other_value.field_fr;
default:
return FALSE;
}
}

NSVCConfigurationIP& NSVCConfigurationP::ip()
{
if (union_selection != ALT_ip) {
clean_up();
field_ip = new NSVCConfigurationIP;
union_selection = ALT_ip;
}
return *field_ip;
}

const NSVCConfigurationIP& NSVCConfigurationP::ip() const
{
if (union_selection != ALT_ip) TTCN_error("Using non-selected field ip in a value of union type @NS_Emulation.NSVCConfigurationP.");
return *field_ip;
}

NSVCConfigurationFR& NSVCConfigurationP::fr()
{
if (union_selection != ALT_fr) {
clean_up();
field_fr = new NSVCConfigurationFR;
union_selection = ALT_fr;
}
return *field_fr;
}

const NSVCConfigurationFR& NSVCConfigurationP::fr() const
{
if (union_selection != ALT_fr) TTCN_error("Using non-selected field fr in a value of union type @NS_Emulation.NSVCConfigurationP.");
return *field_fr;
}

boolean NSVCConfigurationP::ischosen(union_selection_type checked_selection) const
{
if (checked_selection == UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @NS_Emulation.NSVCConfigurationP.");
return union_selection == checked_selection;
}

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

boolean NSVCConfigurationP::is_value() const
{
switch (union_selection) {
case UNBOUND_VALUE: return FALSE;
case ALT_ip: return field_ip->is_value();
case ALT_fr: return field_fr->is_value();
default: TTCN_error("Invalid selection in union is_bound");}
}

void NSVCConfigurationP::clean_up()
{
switch (union_selection) {
case ALT_ip:
  delete field_ip;
  break;
case ALT_fr:
  delete field_fr;
  break;
default:
  break;
}
union_selection = UNBOUND_VALUE;
}

void NSVCConfigurationP::log() const
{
switch (union_selection) {
case ALT_ip:
TTCN_Logger::log_event_str("{ ip := ");
field_ip->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_fr:
TTCN_Logger::log_event_str("{ fr := ");
field_fr->log();
TTCN_Logger::log_event_str(" }");
break;
default:
TTCN_Logger::log_event_unbound();
}
}

void NSVCConfigurationP::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "union value");
  Module_Param_Ptr m_p = &param;
  if (m_p->get_type()==Module_Param::MP_Value_List && m_p->get_size()==0) return;
  if (m_p->get_type()!=Module_Param::MP_Assignment_List) {
    param.error("union value with field name was expected");
  }
  Module_Param* mp_last = m_p->get_elem(m_p->get_size()-1);
  char* last_name = mp_last->get_id()->get_name();
  if (!strcmp(last_name, "ip")) {
    ip().set_param(*mp_last);
    if (!ip().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "fr")) {
    fr().set_param(*mp_last);
    if (!fr().is_bound()) clean_up();
    return;
  }
  mp_last->error("Field %s does not exist in type @NS_Emulation.NSVCConfigurationP.", last_name);
}

void NSVCConfigurationP::set_implicit_omit()
{
switch (union_selection) {
case ALT_ip:
field_ip->set_implicit_omit(); break;
case ALT_fr:
field_fr->set_implicit_omit(); break;
default: break;
}
}

void NSVCConfigurationP::encode_text(Text_Buf& text_buf) const
{
text_buf.push_int(union_selection);
switch (union_selection) {
case ALT_ip:
field_ip->encode_text(text_buf);
break;
case ALT_fr:
field_fr->encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an unbound value of union type @NS_Emulation.NSVCConfigurationP.");
}
}

void NSVCConfigurationP::decode_text(Text_Buf& text_buf)
{
switch ((union_selection_type)text_buf.pull_int().get_val()) {
case ALT_ip:
ip().decode_text(text_buf);
break;
case ALT_fr:
fr().decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized union selector was received for type @NS_Emulation.NSVCConfigurationP.");
}
}

void NSVCConfigurationP_template::copy_value(const NSVCConfigurationP& other_value)
{
single_value.union_selection = other_value.get_selection();
switch (single_value.union_selection) {
case NSVCConfigurationP::ALT_ip:
single_value.field_ip = new NSVCConfigurationIP_template(other_value.ip());
break;
case NSVCConfigurationP::ALT_fr:
single_value.field_fr = new NSVCConfigurationFR_template(other_value.fr());
break;
default:
TTCN_error("Initializing a template with an unbound value of type @NS_Emulation.NSVCConfigurationP.");
}
set_selection(SPECIFIC_VALUE);
}

void NSVCConfigurationP_template::copy_template(const NSVCConfigurationP_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value.union_selection = other_value.single_value.union_selection;
switch (single_value.union_selection) {
case NSVCConfigurationP::ALT_ip:
single_value.field_ip = new NSVCConfigurationIP_template(*other_value.single_value.field_ip);
break;
case NSVCConfigurationP::ALT_fr:
single_value.field_fr = new NSVCConfigurationFR_template(*other_value.single_value.field_fr);
break;
default:
TTCN_error("Internal error: Invalid union selector in a specific value when copying a template of type @NS_Emulation.NSVCConfigurationP.");
}
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 NSVCConfigurationP_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 NSVCConfigurationP_template(*other_value.implication_.precondition);
implication_.implied_template = new NSVCConfigurationP_template(*other_value.implication_.implied_template);
break;
case DYNAMIC_MATCH:
dyn_match = other_value.dyn_match;
dyn_match->ref_count++;
break;
default:
TTCN_error("Copying an uninitialized template of union type @NS_Emulation.NSVCConfigurationP.");
}
set_selection(other_value);
}

NSVCConfigurationP_template::NSVCConfigurationP_template()
{
}

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

NSVCConfigurationP_template::NSVCConfigurationP_template(const NSVCConfigurationP& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

void NSVCConfigurationP_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
switch (single_value.union_selection) {
case NSVCConfigurationP::ALT_ip:
delete single_value.field_ip;
break;
case NSVCConfigurationP::ALT_fr:
delete single_value.field_fr;
default:
break;
}
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

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

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

NSVCConfigurationP_template& NSVCConfigurationP_template::operator=(const OPTIONAL<NSVCConfigurationP>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const NSVCConfigurationP&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of union type @NS_Emulation.NSVCConfigurationP.");
}
return *this;
}

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

boolean NSVCConfigurationP_template::match(const NSVCConfigurationP& 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:
{
NSVCConfigurationP::union_selection_type value_selection = other_value.get_selection();
if (value_selection == NSVCConfigurationP::UNBOUND_VALUE) return FALSE;
if (value_selection != single_value.union_selection) return FALSE;
switch (value_selection) {
case NSVCConfigurationP::ALT_ip:
return single_value.field_ip->match(other_value.ip(), legacy);
case NSVCConfigurationP::ALT_fr:
return single_value.field_fr->match(other_value.fr(), legacy);
default:
TTCN_error("Internal error: Invalid selector in a specific value when matching a template of union type @NS_Emulation.NSVCConfigurationP.");
}
}
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error ("Matching an uninitialized template of union type @NS_Emulation.NSVCConfigurationP.");
}
return FALSE;
}

boolean NSVCConfigurationP_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
switch (single_value.union_selection) {
case NSVCConfigurationP::ALT_ip:
return single_value.field_ip->is_value();
case NSVCConfigurationP::ALT_fr:
return single_value.field_fr->is_value();
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing is_value operation on a template of union type @NS_Emulation.NSVCConfigurationP.");
}
}

NSVCConfigurationP NSVCConfigurationP_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent)
TTCN_error("Performing a valueof or send operation on a non-specific template of union type @NS_Emulation.NSVCConfigurationP.");
NSVCConfigurationP ret_val;
switch (single_value.union_selection) {
case NSVCConfigurationP::ALT_ip:
ret_val.ip() = single_value.field_ip->valueof();
break;
case NSVCConfigurationP::ALT_fr:
ret_val.fr() = single_value.field_fr->valueof();
break;
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing valueof operation on a template of union type @NS_Emulation.NSVCConfigurationP.");
}
return ret_val;
}

NSVCConfigurationP_template& NSVCConfigurationP_template::list_item(unsigned int list_index) const
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Internal error: Accessing a list element of a non-list template of union type @NS_Emulation.NSVCConfigurationP.");
if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of union type @NS_Emulation.NSVCConfigurationP.");
return value_list.list_value[list_index];
}
void NSVCConfigurationP_template::set_type(template_sel template_type, unsigned int list_length)
{
if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error ("Internal error: Setting an invalid list for a template of union type @NS_Emulation.NSVCConfigurationP.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new NSVCConfigurationP_template[list_length];
}

NSVCConfigurationIP_template& NSVCConfigurationP_template::ip()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != NSVCConfigurationP::ALT_ip) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_ip = new NSVCConfigurationIP_template(ANY_VALUE);
else single_value.field_ip = new NSVCConfigurationIP_template;
single_value.union_selection = NSVCConfigurationP::ALT_ip;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_ip;
}

const NSVCConfigurationIP_template& NSVCConfigurationP_template::ip() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ip in a non-specific template of union type @NS_Emulation.NSVCConfigurationP.");
if (single_value.union_selection != NSVCConfigurationP::ALT_ip) TTCN_error("Accessing non-selected field ip in a template of union type @NS_Emulation.NSVCConfigurationP.");
return *single_value.field_ip;
}

NSVCConfigurationFR_template& NSVCConfigurationP_template::fr()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != NSVCConfigurationP::ALT_fr) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_fr = new NSVCConfigurationFR_template(ANY_VALUE);
else single_value.field_fr = new NSVCConfigurationFR_template;
single_value.union_selection = NSVCConfigurationP::ALT_fr;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_fr;
}

const NSVCConfigurationFR_template& NSVCConfigurationP_template::fr() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field fr in a non-specific template of union type @NS_Emulation.NSVCConfigurationP.");
if (single_value.union_selection != NSVCConfigurationP::ALT_fr) TTCN_error("Accessing non-selected field fr in a template of union type @NS_Emulation.NSVCConfigurationP.");
return *single_value.field_fr;
}

boolean NSVCConfigurationP_template::ischosen(NSVCConfigurationP::union_selection_type checked_selection) const
{
if (checked_selection == NSVCConfigurationP::UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @NS_Emulation.NSVCConfigurationP.");
switch (template_selection) {
case SPECIFIC_VALUE:
if (single_value.union_selection == NSVCConfigurationP::UNBOUND_VALUE) TTCN_error("Internal error: Invalid selector in a specific value when performing ischosen() operation on a template of union type @NS_Emulation.NSVCConfigurationP.");
return single_value.union_selection == checked_selection;
case VALUE_LIST:
{
if (value_list.n_values < 1)
TTCN_error("Internal error: Performing ischosen() operation on a template of union type @NS_Emulation.NSVCConfigurationP containing an empty list.");
boolean ret_val = value_list.list_value[0].ischosen(checked_selection);
for (unsigned int list_count = 1; ret_val == TRUE && list_count < value_list.n_values; list_count++) {
ret_val = value_list.list_value[list_count].ischosen(checked_selection);
}
return ret_val;
}
default:
return FALSE;
}
return FALSE;
}

void NSVCConfigurationP_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
switch (single_value.union_selection) {
case NSVCConfigurationP::ALT_ip:
TTCN_Logger::log_event_str("{ ip := ");
single_value.field_ip->log();
TTCN_Logger::log_event_str(" }");
break;
case NSVCConfigurationP::ALT_fr:
TTCN_Logger::log_event_str("{ fr := ");
single_value.field_fr->log();
TTCN_Logger::log_event_str(" }");
break;
default:
TTCN_Logger::log_event_str("<invalid selector>");
}
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case CONJUNCTION_MATCH:
if (template_selection == CONJUNCTION_MATCH) {
TTCN_Logger::log_event_str("conjunct");
}
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) {
if (list_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[list_count].log();
}
TTCN_Logger::log_char(')');
break;
case IMPLICATION_MATCH:
implication_.precondition->log();
TTCN_Logger::log_event_str(" implies ");
implication_.implied_template->log();
break;
case DYNAMIC_MATCH:
TTCN_Logger::log_event_str("@dynamic template");
break;
default:
log_generic();
}
log_ifpresent();
}

void NSVCConfigurationP_template::log_match(const NSVCConfigurationP& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity() && match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
return;
}
if (template_selection == SPECIFIC_VALUE && single_value.union_selection == match_value.get_selection()) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
switch (single_value.union_selection) {
case NSVCConfigurationP::ALT_ip:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".ip");
single_value.field_ip->log_match(match_value.ip(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ ip := ");
single_value.field_ip->log_match(match_value.ip(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case NSVCConfigurationP::ALT_fr:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".fr");
single_value.field_fr->log_match(match_value.fr(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ fr := ");
single_value.field_fr->log_match(match_value.fr(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
default:
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str("<invalid selector>");
}
} else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void NSVCConfigurationP_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
switch (single_value.union_selection) {
case NSVCConfigurationP::ALT_ip:
single_value.field_ip->set_implicit_omit(); break;
case NSVCConfigurationP::ALT_fr:
single_value.field_fr->set_implicit_omit(); break;
default: break;
}
}

void NSVCConfigurationP_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
text_buf.push_int(single_value.union_selection);
switch (single_value.union_selection) {
case NSVCConfigurationP::ALT_ip:
single_value.field_ip->encode_text(text_buf);
break;
case NSVCConfigurationP::ALT_fr:
single_value.field_fr->encode_text(text_buf);
break;
default:
TTCN_error("Internal error: Invalid selector in a specific value when encoding a template of union type @NS_Emulation.NSVCConfigurationP.");
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
text_buf.push_int(value_list.n_values);
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized template of type @NS_Emulation.NSVCConfigurationP.");
}
}

void NSVCConfigurationP_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
{
single_value.union_selection = NSVCConfigurationP::UNBOUND_VALUE;
NSVCConfigurationP::union_selection_type new_selection = (NSVCConfigurationP::union_selection_type)text_buf.pull_int().get_val();
switch (new_selection) {
case NSVCConfigurationP::ALT_ip:
single_value.field_ip = new NSVCConfigurationIP_template;
single_value.field_ip->decode_text(text_buf);
break;
case NSVCConfigurationP::ALT_fr:
single_value.field_fr = new NSVCConfigurationFR_template;
single_value.field_fr->decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized union selector was received for a template of type @NS_Emulation.NSVCConfigurationP.");
}
single_value.union_selection = new_selection;
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new NSVCConfigurationP_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized selector was received in a template of type @NS_Emulation.NSVCConfigurationP.");
}
}

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

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

void NSVCConfigurationP_template::set_param(Module_Param& param)
{
  if (dynamic_cast<Module_Param_Name*>(param.get_id()) != NULL &&
      param.get_id()->next_name()) {
    char* param_field = param.get_id()->get_current_name();
    if (param_field[0] >= '0' && param_field[0] <= '9') {
      param.error("Unexpected array index in module parameter, expected a valid field"
        " name for union template type `@NS_Emulation.NSVCConfigurationP'");
    }
    if (strcmp("ip", param_field) == 0) {
      ip().set_param(param);
      return;
    } else if (strcmp("fr", param_field) == 0) {
      fr().set_param(param);
      return;
    } else param.error("Field `%s' not found in union template type `@NS_Emulation.NSVCConfigurationP'", param_field);
  }
  param.basic_check(Module_Param::BC_TEMPLATE, "union template");
  Module_Param_Ptr m_p = &param;
  switch (m_p->get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    NSVCConfigurationP_template new_temp;
    new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size());
    for (size_t p_i=0; p_i<m_p->get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (m_p->get_size()==0) break;
    param.type_error("union template", "@NS_Emulation.NSVCConfigurationP");
    break;
  case Module_Param::MP_Assignment_List: {
    Module_Param* mp_last = m_p->get_elem(m_p->get_size()-1);
    char* last_name = mp_last->get_id()->get_name();
    if (!strcmp(last_name, "ip")) {
      ip().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "fr")) {
      fr().set_param(*mp_last);
      break;
    }
    mp_last->error("Field %s does not exist in type @NS_Emulation.NSVCConfigurationP.", last_name);
  } break;
  case Module_Param::MP_Implication_Template: {
    NSVCConfigurationP_template* precondition = new NSVCConfigurationP_template;
    precondition->set_param(*m_p->get_elem(0));
    NSVCConfigurationP_template* implied_template = new NSVCConfigurationP_template;
    implied_template->set_param(*m_p->get_elem(1));
    *this = NSVCConfigurationP_template(precondition, implied_template);
  } break;
  default:
    param.type_error("union template", "@NS_Emulation.NSVCConfigurationP");
  }
  is_ifpresent = param.get_ifpresent();
}

void NSVCConfigurationP_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
switch (single_value.union_selection) {
case NSVCConfigurationP::ALT_ip:
single_value.field_ip->check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NSVCConfigurationP");
return;
case NSVCConfigurationP::ALT_fr:
single_value.field_fr->check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NSVCConfigurationP");
return;
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing check_restriction operation on a template of union type @NS_Emulation.NSVCConfigurationP.");
}
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 : "@NS_Emulation.NSVCConfigurationP");
}

NSVCConfiguration::NSVCConfiguration()
{
}

NSVCConfiguration::NSVCConfiguration(const NSVCConfigurationP& par_provider,
    const INTEGER& par_nsvci)
  :   field_provider(par_provider),
  field_nsvci(par_nsvci)
{
}

NSVCConfiguration::NSVCConfiguration(const NSVCConfiguration& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @NS_Emulation.NSVCConfiguration.");
if (other_value.provider().is_bound()) field_provider = other_value.provider();
else field_provider.clean_up();
if (other_value.nsvci().is_bound()) field_nsvci = other_value.nsvci();
else field_nsvci.clean_up();
}

void NSVCConfiguration::clean_up()
{
field_provider.clean_up();
field_nsvci.clean_up();
}

const TTCN_Typedescriptor_t* NSVCConfiguration::get_descriptor() const { return &NSVCConfiguration_descr_; }
NSVCConfiguration& NSVCConfiguration::operator=(const NSVCConfiguration& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @NS_Emulation.NSVCConfiguration.");
  if (other_value.provider().is_bound()) field_provider = other_value.provider();
  else field_provider.clean_up();
  if (other_value.nsvci().is_bound()) field_nsvci = other_value.nsvci();
  else field_nsvci.clean_up();
}
return *this;
}

boolean NSVCConfiguration::operator==(const NSVCConfiguration& other_value) const
{
return field_provider==other_value.field_provider
  && field_nsvci==other_value.field_nsvci;
}

boolean NSVCConfiguration::is_bound() const
{
return (field_provider.is_bound())
  || (field_nsvci.is_bound());
}
boolean NSVCConfiguration::is_value() const
{
return field_provider.is_value()
  && field_nsvci.is_value();
}
void NSVCConfiguration::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ provider := ");
field_provider.log();
TTCN_Logger::log_event_str(", nsvci := ");
field_nsvci.log();
TTCN_Logger::log_event_str(" }");
}

void NSVCConfiguration::set_implicit_omit()
{
if (provider().is_bound()) provider().set_implicit_omit();
if (nsvci().is_bound()) nsvci().set_implicit_omit();
}

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

void NSVCConfiguration::encode_text(Text_Buf& text_buf) const
{
field_provider.encode_text(text_buf);
field_nsvci.encode_text(text_buf);
}

void NSVCConfiguration::decode_text(Text_Buf& text_buf)
{
field_provider.decode_text(text_buf);
field_nsvci.decode_text(text_buf);
}

struct NSVCConfiguration_template::single_value_struct {
NSVCConfigurationP_template field_provider;
INTEGER_template field_nsvci;
};

void NSVCConfiguration_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_provider = ANY_VALUE;
single_value->field_nsvci = ANY_VALUE;
}
}
}

void NSVCConfiguration_template::copy_value(const NSVCConfiguration& other_value)
{
single_value = new single_value_struct;
if (other_value.provider().is_bound()) {
  single_value->field_provider = other_value.provider();
} else {
  single_value->field_provider.clean_up();
}
if (other_value.nsvci().is_bound()) {
  single_value->field_nsvci = other_value.nsvci();
} else {
  single_value->field_nsvci.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void NSVCConfiguration_template::copy_template(const NSVCConfiguration_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.provider().get_selection()) {
single_value->field_provider = other_value.provider();
} else {
single_value->field_provider.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.nsvci().get_selection()) {
single_value->field_nsvci = other_value.nsvci();
} else {
single_value->field_nsvci.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 NSVCConfiguration_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 NSVCConfiguration_template(*other_value.implication_.precondition);
implication_.implied_template = new NSVCConfiguration_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 @NS_Emulation.NSVCConfiguration.");
break;
}
set_selection(other_value);
}

NSVCConfiguration_template::NSVCConfiguration_template()
{
}

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

NSVCConfiguration_template::NSVCConfiguration_template(const NSVCConfiguration& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean NSVCConfiguration_template::match(const NSVCConfiguration& 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.provider().is_bound()) return FALSE;
if(!single_value->field_provider.match(other_value.provider(), legacy))return FALSE;
if(!other_value.nsvci().is_bound()) return FALSE;
if(!single_value->field_nsvci.match(other_value.nsvci(), 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 @NS_Emulation.NSVCConfiguration.");
}
return FALSE;
}

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

boolean NSVCConfiguration_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_provider.is_value()
 && single_value->field_nsvci.is_value();
}

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

NSVCConfiguration NSVCConfiguration_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 @NS_Emulation.NSVCConfiguration.");
NSVCConfiguration ret_val;
if (single_value->field_provider.is_bound()) {
ret_val.provider() = single_value->field_provider.valueof();
}
if (single_value->field_nsvci.is_bound()) {
ret_val.nsvci() = single_value->field_nsvci.valueof();
}
return ret_val;
}

void NSVCConfiguration_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 @NS_Emulation.NSVCConfiguration.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new NSVCConfiguration_template[list_length];
}

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

NSVCConfigurationP_template& NSVCConfiguration_template::provider()
{
set_specific();
return single_value->field_provider;
}

const NSVCConfigurationP_template& NSVCConfiguration_template::provider() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field provider of a non-specific template of type @NS_Emulation.NSVCConfiguration.");
return single_value->field_provider;
}

INTEGER_template& NSVCConfiguration_template::nsvci()
{
set_specific();
return single_value->field_nsvci;
}

const INTEGER_template& NSVCConfiguration_template::nsvci() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field nsvci of a non-specific template of type @NS_Emulation.NSVCConfiguration.");
return single_value->field_nsvci;
}

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

void NSVCConfiguration_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ provider := ");
single_value->field_provider.log();
TTCN_Logger::log_event_str(", nsvci := ");
single_value->field_nsvci.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 NSVCConfiguration_template::log_match(const NSVCConfiguration& 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_provider.match(match_value.provider(), legacy)){
TTCN_Logger::log_logmatch_info(".provider");
single_value->field_provider.log_match(match_value.provider(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_nsvci.match(match_value.nsvci(), legacy)){
TTCN_Logger::log_logmatch_info(".nsvci");
single_value->field_nsvci.log_match(match_value.nsvci(), 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("{ provider := ");
single_value->field_provider.log_match(match_value.provider(), legacy);
TTCN_Logger::log_event_str(", nsvci := ");
single_value->field_nsvci.log_match(match_value.nsvci(), 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 NSVCConfiguration_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (provider().is_bound()) provider().set_implicit_omit();
if (nsvci().is_bound()) nsvci().set_implicit_omit();
}

void NSVCConfiguration_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_provider.encode_text(text_buf);
single_value->field_nsvci.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 @NS_Emulation.NSVCConfiguration.");
}
}

void NSVCConfiguration_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_provider.decode_text(text_buf);
single_value->field_nsvci.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 NSVCConfiguration_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 @NS_Emulation.NSVCConfiguration.");
}
}

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

void NSVCConfiguration_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_provider.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NSVCConfiguration");
single_value->field_nsvci.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NSVCConfiguration");
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 : "@NS_Emulation.NSVCConfiguration");
}

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

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


const NSVCConfiguration NSVCConfigurations::UNBOUND_ELEM;
NSVCConfigurations::NSVCConfigurations()
{
val_ptr = NULL;
}

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

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

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

void NSVCConfigurations::clean_up()
{
if (val_ptr != NULL) {
if (val_ptr->ref_count > 1) {
val_ptr->ref_count--;
val_ptr = NULL;
}
else if (val_ptr->ref_count == 1) {
for (int elem_count = 0; elem_count < val_ptr->n_elements;
elem_count++)
if (val_ptr->value_elements[elem_count] != NULL)
delete val_ptr->value_elements[elem_count];
free_pointers((void**)val_ptr->value_elements);
delete val_ptr;
val_ptr = NULL;
}
else
TTCN_error("Internal error: Invalid reference counter in a record of/set of value.");
}
}

NSVCConfigurations& NSVCConfigurations::operator=(null_type)
{
clean_up();
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = 0;
val_ptr->value_elements = NULL;
return *this;
}

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

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

boolean NSVCConfigurations::operator==(const NSVCConfigurations& other_value) const
{
if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @NS_Emulation.NSVCConfigurations.");
if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @NS_Emulation.NSVCConfigurations.");
if (val_ptr == other_value.val_ptr) return TRUE;
if (val_ptr->n_elements != (other_value.val_ptr)->n_elements)
return FALSE;
for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++){
if (val_ptr->value_elements[elem_count] != NULL){
if ((other_value.val_ptr)->value_elements[elem_count] != NULL){
  if (*val_ptr->value_elements[elem_count] != *(other_value.val_ptr)->value_elements[elem_count]) return FALSE;
} else return FALSE;
} else {
if ((other_value.val_ptr)->value_elements[elem_count] != NULL) return FALSE;
}
}
return TRUE;
}

NSVCConfiguration& NSVCConfigurations::operator[](int index_value)
{
if (index_value < 0) TTCN_error("Accessing an element of type @NS_Emulation.NSVCConfigurations using a negative index: %d.", index_value);
if (val_ptr == NULL) {
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = 0;
val_ptr->value_elements = NULL;
} else if (val_ptr->ref_count > 1) {
struct recordof_setof_struct *new_val_ptr = new recordof_setof_struct;
new_val_ptr->ref_count = 1;
new_val_ptr->n_elements = (index_value >= val_ptr->n_elements) ? index_value + 1 : val_ptr->n_elements;
new_val_ptr->value_elements = (NSVCConfiguration**)allocate_pointers(new_val_ptr->n_elements);
for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++){
if (val_ptr->value_elements[elem_count] != NULL){
new_val_ptr->value_elements[elem_count] = new NSVCConfiguration(*(val_ptr->value_elements[elem_count]));
}
}
clean_up();
val_ptr = new_val_ptr;
}
if (index_value >= val_ptr->n_elements) set_size(index_value + 1);
if (val_ptr->value_elements[index_value] == NULL) {
val_ptr->value_elements[index_value] = new NSVCConfiguration;
}
return *val_ptr->value_elements[index_value];
}

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

const NSVCConfiguration& NSVCConfigurations::operator[](int index_value) const
{
if (val_ptr == NULL)
TTCN_error("Accessing an element in an unbound value of type @NS_Emulation.NSVCConfigurations.");
if (index_value < 0) TTCN_error("Accessing an element of type @NS_Emulation.NSVCConfigurations using a negative index: %d.", index_value);
if (index_value >= val_ptr->n_elements) TTCN_error("Index overflow in a value of type @NS_Emulation.NSVCConfigurations: The index is %d, but the value has only %d elements.", index_value, val_ptr->n_elements);
return (val_ptr->value_elements[index_value] == NULL) ?
UNBOUND_ELEM : *val_ptr->value_elements[index_value];
}

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

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

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

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

NSVCConfigurations NSVCConfigurations::operator>>=(int rotate_count) const
{
if (val_ptr == NULL) TTCN_error("Performing rotation operation on an unbound value of type @NS_Emulation.NSVCConfigurations.");
if (val_ptr->n_elements == 0) return *this;
int rc;
if (rotate_count>=0) rc = rotate_count % val_ptr->n_elements;
else rc = val_ptr->n_elements - ((-rotate_count) % val_ptr->n_elements);
if (rc == 0) return *this;
NSVCConfigurations ret_val;
ret_val.set_size(val_ptr->n_elements);
for (int i=0; i<val_ptr->n_elements; i++) {
if (val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[(i+rc)%val_ptr->n_elements] =new NSVCConfiguration(*val_ptr->value_elements[i]);
}
}
return ret_val;
}

NSVCConfigurations NSVCConfigurations::operator+(const NSVCConfigurations& other_value) const
{
if (val_ptr == NULL || other_value.val_ptr == NULL) TTCN_error("Unbound operand of @NS_Emulation.NSVCConfigurations concatenation.");
if (val_ptr->n_elements == 0) return other_value;
if (other_value.val_ptr->n_elements == 0) return *this;
NSVCConfigurations ret_val;
ret_val.set_size(val_ptr->n_elements+other_value.val_ptr->n_elements);
for (int i=0; i<val_ptr->n_elements; i++) {
if (val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[i] = new NSVCConfiguration(*val_ptr->value_elements[i]);
}
}
for (int i=0; i<other_value.val_ptr->n_elements; i++) {
if (other_value.val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[i+val_ptr->n_elements] = new NSVCConfiguration(*other_value.val_ptr->value_elements[i]);
}
}
return ret_val;
}

NSVCConfigurations NSVCConfigurations::substr(int index, int returncount) const
{
if (val_ptr == NULL) TTCN_error("The first argument of substr() is an unbound value of type @NS_Emulation.NSVCConfigurations.");
check_substr_arguments(val_ptr->n_elements, index, returncount, "@NS_Emulation.NSVCConfigurations","element");
NSVCConfigurations ret_val;
ret_val.set_size(returncount);
for (int i=0; i<returncount; i++) {
if (val_ptr->value_elements[i+index] != NULL) {
ret_val.val_ptr->value_elements[i] = new NSVCConfiguration(*val_ptr->value_elements[i+index]);
}
}
return ret_val;
}

NSVCConfigurations NSVCConfigurations::replace(int index, int len, const NSVCConfigurations& repl) const
{
if (val_ptr == NULL) TTCN_error("The first argument of replace() is an unbound value of type @NS_Emulation.NSVCConfigurations.");
if (repl.val_ptr == NULL) TTCN_error("The fourth argument of replace() is an unbound value of type @NS_Emulation.NSVCConfigurations.");
check_replace_arguments(val_ptr->n_elements, index, len, "@NS_Emulation.NSVCConfigurations","element");
NSVCConfigurations ret_val;
ret_val.set_size(val_ptr->n_elements + repl.val_ptr->n_elements - len);
for (int i = 0; i < index; i++) {
if (val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[i] = new NSVCConfiguration(*val_ptr->value_elements[i]);
}
}
for (int i = 0; i < repl.val_ptr->n_elements; i++) {
if (repl.val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[i+index] = new NSVCConfiguration(*repl.val_ptr->value_elements[i]);
}
}
for (int i = 0; i < val_ptr->n_elements - index - len; i++) {
if (val_ptr->value_elements[index+i+len] != NULL) {
ret_val.val_ptr->value_elements[index+i+repl.val_ptr->n_elements] = new NSVCConfiguration(*val_ptr->value_elements[index+i+len]);
}
}
return ret_val;
}

NSVCConfigurations NSVCConfigurations::replace(int index, int len, const NSVCConfigurations_template& repl) const
{
if (!repl.is_value()) TTCN_error("The fourth argument of function replace() is a template with non-specific value.");
return replace(index, len, repl.valueof());
}

void NSVCConfigurations::set_size(int new_size)
{
if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a value of type @NS_Emulation.NSVCConfigurations.");
if (val_ptr == NULL) {
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = 0;
val_ptr->value_elements = NULL;
} else if (val_ptr->ref_count > 1) {
struct recordof_setof_struct *new_val_ptr = new recordof_setof_struct;
new_val_ptr->ref_count = 1;
new_val_ptr->n_elements = (new_size < val_ptr->n_elements) ? new_size : val_ptr->n_elements;
new_val_ptr->value_elements = (NSVCConfiguration**)allocate_pointers(new_val_ptr->n_elements);
for (int elem_count = 0; elem_count < new_val_ptr->n_elements; elem_count++) {
if (val_ptr->value_elements[elem_count] != NULL){
new_val_ptr->value_elements[elem_count] = new NSVCConfiguration(*(val_ptr->value_elements[elem_count]));
}
}
clean_up();
val_ptr = new_val_ptr;
}
if (new_size > val_ptr->n_elements) {
val_ptr->value_elements = (NSVCConfiguration**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size);
#ifdef TITAN_MEMORY_DEBUG_SET_RECORD_OF
if((val_ptr->n_elements/1000)!=(new_size/1000)) TTCN_warning("New size of type @NS_Emulation.NSVCConfigurations: %d",new_size);
#endif
val_ptr->n_elements = new_size;
} else if (new_size < val_ptr->n_elements) {
for (int elem_count = new_size; elem_count < val_ptr->n_elements; elem_count++)
if (val_ptr->value_elements[elem_count] != NULL)delete val_ptr->value_elements[elem_count];
val_ptr->value_elements = (NSVCConfiguration**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size);
val_ptr->n_elements = new_size;
}
}

boolean NSVCConfigurations::is_value() const
{
if (val_ptr == NULL) return FALSE;
for(int i = 0; i < val_ptr->n_elements; ++i) {
if (val_ptr->value_elements[i] == NULL || !val_ptr->value_elements[i]->is_value()) return FALSE;
}
return TRUE;
}

int NSVCConfigurations::size_of() const
{
if (val_ptr == NULL) TTCN_error("Performing sizeof operation on an unbound value of type @NS_Emulation.NSVCConfigurations.");
return val_ptr->n_elements;
}

int NSVCConfigurations::lengthof() const
{
if (val_ptr == NULL) TTCN_error("Performing lengthof operation on an unbound value of type @NS_Emulation.NSVCConfigurations.");
for (int my_length=val_ptr->n_elements; my_length>0; my_length--) if (val_ptr->value_elements[my_length-1] != NULL) return my_length;
return 0;
}

void NSVCConfigurations::log() const
{
if (val_ptr == NULL) {;
TTCN_Logger::log_event_unbound();
return;
}
switch (val_ptr->n_elements) {
case 0:
TTCN_Logger::log_event_str("{ }");
break;
default:
TTCN_Logger::log_event_str("{ ");
for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++) {
if (elem_count > 0) TTCN_Logger::log_event_str(", ");
(*this)[elem_count].log();
}
TTCN_Logger::log_event_str(" }");
}
}

void NSVCConfigurations::set_implicit_omit()
{
if (val_ptr == NULL) return;
for (int i = 0; i < val_ptr->n_elements; i++) {
if (val_ptr->value_elements[i] != NULL) val_ptr->value_elements[i]->set_implicit_omit();
}
}

void NSVCConfigurations::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE|Module_Param::BC_LIST, "record of value");
  switch (param.get_operation_type()) {
  case Module_Param::OT_ASSIGN:
    if (param.get_type()==Module_Param::MP_Value_List && param.get_size()==0) {
      *this = NULL_VALUE;
      return;
    }
    switch (param.get_type()) {
    case Module_Param::MP_Value_List:
      set_size(param.get_size());
      for (size_t i=0; i<param.get_size(); ++i) {
        Module_Param* const curr = param.get_elem(i);
        if (curr->get_type()!=Module_Param::MP_NotUsed) {
          (*this)[i].set_param(*curr);
          if (!(*this)[i].is_bound()) {
            delete val_ptr->value_elements[i];
            val_ptr->value_elements[i] = NULL;
          }
        }
      }
      break;
    case Module_Param::MP_Indexed_List:
      for (size_t i=0; i<param.get_size(); ++i) {
        Module_Param* const curr = param.get_elem(i);
        (*this)[curr->get_id()->get_index()].set_param(*curr);
        if (!(*this)[curr->get_id()->get_index()].is_bound()) {
          delete val_ptr->value_elements[curr->get_id()->get_index()];
          val_ptr->value_elements[curr->get_id()->get_index()] = NULL;
        }
      }
      break;
    default:
      param.type_error("record of value", "@NS_Emulation.NSVCConfigurations");
    }
    break;
  case Module_Param::OT_CONCAT:
    switch (param.get_type()) {
    case Module_Param::MP_Value_List: {
      if (!is_bound()) *this = NULL_VALUE;
      int start_idx = lengthof();
      for (size_t i=0; i<param.get_size(); ++i) {
        Module_Param* const curr = param.get_elem(i);
        if ((curr->get_type()!=Module_Param::MP_NotUsed)) {
          (*this)[start_idx+(int)i].set_param(*curr);
        }
      }
    } break;
    case Module_Param::MP_Indexed_List:
      param.error("Cannot concatenate an indexed value list");
      break;
    default:
      param.type_error("record of value", "@NS_Emulation.NSVCConfigurations");
    }
    break;
  default:
    TTCN_error("Internal error: Unknown operation type.");
  }
}

void NSVCConfigurations::encode_text(Text_Buf& text_buf) const
{
if (val_ptr == NULL) TTCN_error("Text encoder: Encoding an unbound value of type @NS_Emulation.NSVCConfigurations.");
text_buf.push_int(val_ptr->n_elements);
for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++)
(*this)[elem_count].encode_text(text_buf);
}

void NSVCConfigurations::decode_text(Text_Buf& text_buf)
{
clean_up();
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = text_buf.pull_int().get_val();
if (val_ptr->n_elements < 0) TTCN_error("Text decoder: Negative size was received for a value of type @NS_Emulation.NSVCConfigurations.");
val_ptr->value_elements = (NSVCConfiguration**)allocate_pointers(val_ptr->n_elements);
for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++) {
val_ptr->value_elements[elem_count] = new NSVCConfiguration;
val_ptr->value_elements[elem_count]->decode_text(text_buf);
}
}

void NSVCConfigurations_template::copy_value(const NSVCConfigurations& other_value)
{
if (!other_value.is_bound()) TTCN_error("Initialization of a template of type @NS_Emulation.NSVCConfigurations with an unbound value.");
single_value.n_elements = other_value.size_of();
single_value.value_elements = (NSVCConfiguration_template**)allocate_pointers(single_value.n_elements);
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
if (other_value[elem_count].is_bound()) {
single_value.value_elements[elem_count] = new NSVCConfiguration_template(other_value[elem_count]);
} else {
single_value.value_elements[elem_count] = new NSVCConfiguration_template;
}
}
set_selection(SPECIFIC_VALUE);
}

void NSVCConfigurations_template::copy_template(const NSVCConfigurations_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value.n_elements = other_value.single_value.n_elements;
single_value.value_elements = (NSVCConfiguration_template**)allocate_pointers(single_value.n_elements);
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
if (UNINITIALIZED_TEMPLATE != other_value.single_value.value_elements[elem_count]->get_selection()) {
single_value.value_elements[elem_count] = new NSVCConfiguration_template(*other_value.single_value.value_elements[elem_count]);
} else {
single_value.value_elements[elem_count] = new NSVCConfiguration_template;
}
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new NSVCConfigurations_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 NSVCConfigurations_template(*other_value.implication_.precondition);
implication_.implied_template = new NSVCConfigurations_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 @NS_Emulation.NSVCConfigurations.");
break;
}
set_selection(other_value);
}

boolean NSVCConfigurations_template::match_function_specific(const Base_Type *value_ptr, int value_index, const Restricted_Length_Template *template_ptr, int template_index, boolean legacy)
{
if (value_index >= 0) return ((const NSVCConfigurations_template*)template_ptr)->single_value.value_elements[template_index]->match((*(const NSVCConfigurations*)value_ptr)[value_index], legacy);
else return ((const NSVCConfigurations_template*)template_ptr)->single_value.value_elements[template_index]->is_any_or_omit();
}

NSVCConfigurations_template::NSVCConfigurations_template()
{
}

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

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

NSVCConfigurations_template::NSVCConfigurations_template(const NSVCConfigurations& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

void NSVCConfigurations_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++)
delete single_value.value_elements[elem_count];
free_pointers((void**)single_value.value_elements);
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

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

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

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

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

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

NSVCConfiguration_template& NSVCConfigurations_template::operator[](int index_value)
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @NS_Emulation.NSVCConfigurations using a negative index: %d.", index_value);
switch (template_selection)
{
  case SPECIFIC_VALUE:
    if(index_value < single_value.n_elements) break;
    // no break
  case OMIT_VALUE:
  case ANY_VALUE:
  case ANY_OR_OMIT:
  case UNINITIALIZED_TEMPLATE:
    set_size(index_value + 1);
    break;
  default:
    TTCN_error("Accessing an element of a non-specific template for type @NS_Emulation.NSVCConfigurations.");
    break;
}
return *single_value.value_elements[index_value];
}

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

const NSVCConfiguration_template& NSVCConfigurations_template::operator[](int index_value) const
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @NS_Emulation.NSVCConfigurations using a negative index: %d.", index_value);
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing an element of a non-specific template for type @NS_Emulation.NSVCConfigurations.");
if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @NS_Emulation.NSVCConfigurations: The index is %d, but the template has only %d elements.", index_value, single_value.n_elements);
return *single_value.value_elements[index_value];
}

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

void NSVCConfigurations_template::set_size(int new_size)
{
if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a template of type @NS_Emulation.NSVCConfigurations.");
template_sel old_selection = template_selection;
if (old_selection != SPECIFIC_VALUE) {
clean_up();
set_selection(SPECIFIC_VALUE);
single_value.n_elements = 0;
single_value.value_elements = NULL;
}
if (new_size > single_value.n_elements) {
single_value.value_elements = (NSVCConfiguration_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size);
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) {
for (int elem_count = single_value.n_elements; elem_count < new_size; elem_count++)
single_value.value_elements[elem_count] = new NSVCConfiguration_template(ANY_VALUE);
} else {
for (int elem_count = single_value.n_elements; elem_count < new_size; elem_count++)
single_value.value_elements[elem_count] = new NSVCConfiguration_template;
}
single_value.n_elements = new_size;
} else if (new_size < single_value.n_elements) {
for (int elem_count = new_size; elem_count < single_value.n_elements; elem_count++)
delete single_value.value_elements[elem_count];
single_value.value_elements = (NSVCConfiguration_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size);
single_value.n_elements = new_size;
}
}

int NSVCConfigurations_template::n_elem() const
{
  switch (template_selection) {
  case SPECIFIC_VALUE:
    return single_value.n_elements;
    break;
  case VALUE_LIST:
    return value_list.n_values;
    break;
  default:
    TTCN_error("Performing n_elem");
  }
}

int NSVCConfigurations_template::size_of(boolean is_size) const
{
const char* op_name = is_size ? "size" : "length";
int min_size;
boolean has_any_or_none;
if (is_ifpresent) TTCN_error("Performing %sof() operation on a template of type @NS_Emulation.NSVCConfigurations which has an ifpresent attribute.", op_name);
switch (template_selection)
{
case SPECIFIC_VALUE: {
  min_size = 0;
  has_any_or_none = FALSE;
  int elem_count = single_value.n_elements;
  if (!is_size) { while (elem_count>0 && !single_value.value_elements[elem_count-1]->is_bound()) elem_count--; }
  for (int i=0; i<elem_count; i++) {
    switch (single_value.value_elements[i]->get_selection()) {
    case OMIT_VALUE:
      TTCN_error("Performing %sof() operation on a template of type @NS_Emulation.NSVCConfigurations containing omit element.", op_name);
    case ANY_OR_OMIT:
      has_any_or_none = TRUE;
      break;
    default:
      min_size++;
      break;
    }
  }
} break;
case OMIT_VALUE:
  TTCN_error("Performing %sof() operation on a template of type @NS_Emulation.NSVCConfigurations containing omit value.", op_name);
case ANY_VALUE:
case ANY_OR_OMIT:
  min_size = 0;
  has_any_or_none = TRUE;
  break;
case VALUE_LIST:
{
  if (value_list.n_values<1)
    TTCN_error("Performing %sof() operation on a template of type @NS_Emulation.NSVCConfigurations containing an empty list.", op_name);
  int item_size = value_list.list_value[0].size_of(is_size);
  for (unsigned int i = 1; i < value_list.n_values; i++) {
    if (value_list.list_value[i].size_of(is_size)!=item_size)
      TTCN_error("Performing %sof() operation on a template of type @NS_Emulation.NSVCConfigurations containing a value list with different sizes.", op_name);
  }
  min_size = item_size;
  has_any_or_none = FALSE;
  break;
}
case COMPLEMENTED_LIST:
  TTCN_error("Performing %sof() operation on a template of type @NS_Emulation.NSVCConfigurations containing complemented list.", op_name);
default:
  TTCN_error("Performing %sof() operation on an uninitialized/unsupported template of type @NS_Emulation.NSVCConfigurations.", op_name);
}
return check_section_is_single(min_size, has_any_or_none, op_name, "a", "template of type @NS_Emulation.NSVCConfigurations");
}

boolean NSVCConfigurations_template::match(const NSVCConfigurations& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
int value_length = other_value.size_of();
if (!match_length(value_length)) return FALSE;
switch (template_selection) {
case SPECIFIC_VALUE:
return match_record_of(&other_value, value_length, this, single_value.n_elements, match_function_specific, legacy);
case OMIT_VALUE:
return FALSE;
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching with an uninitialized/unsupported template of type @NS_Emulation.NSVCConfigurations.");
}
return FALSE;
}

boolean NSVCConfigurations_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++)
if (!single_value.value_elements[elem_count]->is_value()) return FALSE;
return TRUE;
}

NSVCConfigurations NSVCConfigurations_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 @NS_Emulation.NSVCConfigurations.");
NSVCConfigurations ret_val;
ret_val.set_size(single_value.n_elements);
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++)
if (single_value.value_elements[elem_count]->is_bound()) {
ret_val[elem_count] = single_value.value_elements[elem_count]->valueof();
}
return ret_val;
}

NSVCConfigurations NSVCConfigurations_template::substr(int index, int returncount) const
{
if (!is_value()) TTCN_error("The first argument of function substr() is a template with non-specific value.");
return valueof().substr(index, returncount);
}

NSVCConfigurations NSVCConfigurations_template::replace(int index, int len, const NSVCConfigurations_template& repl) const
{
if (!is_value()) TTCN_error("The first argument of function replace() is a template with non-specific value.");
if (!repl.is_value()) TTCN_error("The fourth argument of function replace() is a template with non-specific value.");
return valueof().replace(index, len, repl.valueof());
}

NSVCConfigurations NSVCConfigurations_template::replace(int index, int len, const NSVCConfigurations& repl) const
{
if (!is_value()) TTCN_error("The first argument of function replace() is a template with non-specific value.");
return valueof().replace(index, len, repl);
}

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

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

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

void NSVCConfigurations_template::log_match(const NSVCConfigurations& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
if(match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
}else{
if (template_selection == SPECIFIC_VALUE && single_value.n_elements > 0 && get_number_of_permutations() == 0 && single_value.n_elements == match_value.size_of()) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
if(!single_value.value_elements[elem_count]->match(match_value[elem_count], legacy)){
TTCN_Logger::log_logmatch_info("[%d]", elem_count);
single_value.value_elements[elem_count]->log_match(match_value[elem_count], legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
log_match_length(single_value.n_elements);
} else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE && single_value.n_elements > 0 && get_number_of_permutations() == 0 && single_value.n_elements == match_value.size_of()) {
TTCN_Logger::log_event_str("{ ");
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
if (elem_count > 0) TTCN_Logger::log_event_str(", ");
single_value.value_elements[elem_count]->log_match(match_value[elem_count], legacy);
}
TTCN_Logger::log_event_str(" }");
log_match_length(single_value.n_elements);
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

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

void NSVCConfigurations_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_permutation(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value.n_elements = text_buf.pull_int().get_val();
if (single_value.n_elements < 0) TTCN_error("Text decoder: Negative size was received for a template of type @NS_Emulation.NSVCConfigurations.");
single_value.value_elements = (NSVCConfiguration_template**)allocate_pointers(single_value.n_elements);
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
single_value.value_elements[elem_count] = new NSVCConfiguration_template;
single_value.value_elements[elem_count]->decode_text(text_buf);
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new NSVCConfigurations_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of type @NS_Emulation.NSVCConfigurations.");
}
}

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

boolean NSVCConfigurations_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 NSVCConfigurations_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
for (int i = 0; i < single_value.n_elements; i++) {
if (single_value.value_elements[i] != NULL) single_value.value_elements[i]->set_implicit_omit();
}
}

void NSVCConfigurations_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE|Module_Param::BC_LIST, "record of template");
  switch (param.get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    NSVCConfigurations_template temp;
    temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = temp;
    break; }
  case Module_Param::MP_Indexed_List:
    if (template_selection!=SPECIFIC_VALUE) set_size(0);
    for (size_t p_i=0; p_i<param.get_size(); ++p_i) {
      (*this)[(int)(param.get_elem(p_i)->get_id()->get_index())].set_param(*param.get_elem(p_i));
    }
    break;
  case Module_Param::MP_Value_List: {
    set_size(param.get_size());
    int curr_idx = 0;
    for (size_t p_i=0; p_i<param.get_size(); ++p_i) {
      switch (param.get_elem(p_i)->get_type()) {
      case Module_Param::MP_NotUsed:
        curr_idx++;
        break;
      case Module_Param::MP_Permutation_Template: {
        int perm_start_idx = curr_idx;
        Module_Param* param_i = param.get_elem(p_i);
        for (size_t perm_i=0; perm_i<param_i->get_size(); perm_i++) {
          (*this)[curr_idx].set_param(*(param_i->get_elem(perm_i)));
          curr_idx++;
        }
        int perm_end_idx = curr_idx - 1;
        add_permutation(perm_start_idx, perm_end_idx);
      } break;
      default:
        (*this)[curr_idx].set_param(*param.get_elem(p_i));
        curr_idx++;
      }
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    NSVCConfigurations_template* precondition = new NSVCConfigurations_template;
    precondition->set_param(*param.get_elem(0));
    NSVCConfigurations_template* implied_template = new NSVCConfigurations_template;
    implied_template->set_param(*param.get_elem(1));
    *this = NSVCConfigurations_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record of template", "@NS_Emulation.NSVCConfigurations");
  }
  is_ifpresent = param.get_ifpresent();
  set_length_range(param);
}

void NSVCConfigurations_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
for (int i=0; i<single_value.n_elements; i++) single_value.value_elements[i]->check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NSVCConfigurations");
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 : "@NS_Emulation.NSVCConfigurations");
}

boolean NSVCConfigurations_template::get_istemplate_kind(const char* type) const {
if (!strcmp(type, "AnyElement")) {
  if (template_selection != SPECIFIC_VALUE) {
    return FALSE;
  }
  for (int i = 0; i < single_value.n_elements; i++) {
    if (single_value.value_elements[i]->get_selection() == ANY_VALUE) {
      return TRUE;
    }
  }
  return FALSE;
} else if (!strcmp(type, "AnyElementsOrNone")) {
  if (template_selection != SPECIFIC_VALUE) {
    return FALSE;
  }
  for (int i = 0; i < single_value.n_elements; i++) {
    if (single_value.value_elements[i]->get_selection() == ANY_OR_OMIT) {
      return TRUE;
    }
  }
  return FALSE;
} else if (!strcmp(type, "permutation")) {
  return number_of_permutations;
} else if (!strcmp(type, "length")) {
  return length_restriction_type != NO_LENGTH_RESTRICTION;
} else {
  return Base_Template::get_istemplate_kind(type);
}
}
NSConfiguration::NSConfiguration()
{
}

NSConfiguration::NSConfiguration(const INTEGER& par_nsei,
    const BOOLEAN& par_role__sgsn,
    const BOOLEAN& par_handle__sns,
    const NSVCConfigurations& par_nsvc)
  :   field_nsei(par_nsei),
  field_role__sgsn(par_role__sgsn),
  field_handle__sns(par_handle__sns),
  field_nsvc(par_nsvc)
{
}

NSConfiguration::NSConfiguration(const NSConfiguration& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @NS_Emulation.NSConfiguration.");
if (other_value.nsei().is_bound()) field_nsei = other_value.nsei();
else field_nsei.clean_up();
if (other_value.role__sgsn().is_bound()) field_role__sgsn = other_value.role__sgsn();
else field_role__sgsn.clean_up();
if (other_value.handle__sns().is_bound()) field_handle__sns = other_value.handle__sns();
else field_handle__sns.clean_up();
if (other_value.nsvc().is_bound()) field_nsvc = other_value.nsvc();
else field_nsvc.clean_up();
}

void NSConfiguration::clean_up()
{
field_nsei.clean_up();
field_role__sgsn.clean_up();
field_handle__sns.clean_up();
field_nsvc.clean_up();
}

const TTCN_Typedescriptor_t* NSConfiguration::get_descriptor() const { return &NSConfiguration_descr_; }
NSConfiguration& NSConfiguration::operator=(const NSConfiguration& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @NS_Emulation.NSConfiguration.");
  if (other_value.nsei().is_bound()) field_nsei = other_value.nsei();
  else field_nsei.clean_up();
  if (other_value.role__sgsn().is_bound()) field_role__sgsn = other_value.role__sgsn();
  else field_role__sgsn.clean_up();
  if (other_value.handle__sns().is_bound()) field_handle__sns = other_value.handle__sns();
  else field_handle__sns.clean_up();
  if (other_value.nsvc().is_bound()) field_nsvc = other_value.nsvc();
  else field_nsvc.clean_up();
}
return *this;
}

boolean NSConfiguration::operator==(const NSConfiguration& other_value) const
{
return field_nsei==other_value.field_nsei
  && field_role__sgsn==other_value.field_role__sgsn
  && field_handle__sns==other_value.field_handle__sns
  && field_nsvc==other_value.field_nsvc;
}

boolean NSConfiguration::is_bound() const
{
return (field_nsei.is_bound())
  || (field_role__sgsn.is_bound())
  || (field_handle__sns.is_bound())
  || (field_nsvc.is_bound());
}
boolean NSConfiguration::is_value() const
{
return field_nsei.is_value()
  && field_role__sgsn.is_value()
  && field_handle__sns.is_value()
  && field_nsvc.is_value();
}
void NSConfiguration::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ nsei := ");
field_nsei.log();
TTCN_Logger::log_event_str(", role_sgsn := ");
field_role__sgsn.log();
TTCN_Logger::log_event_str(", handle_sns := ");
field_handle__sns.log();
TTCN_Logger::log_event_str(", nsvc := ");
field_nsvc.log();
TTCN_Logger::log_event_str(" }");
}

void NSConfiguration::set_implicit_omit()
{
if (nsei().is_bound()) nsei().set_implicit_omit();
if (role__sgsn().is_bound()) role__sgsn().set_implicit_omit();
if (handle__sns().is_bound()) handle__sns().set_implicit_omit();
if (nsvc().is_bound()) nsvc().set_implicit_omit();
}

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

void NSConfiguration::encode_text(Text_Buf& text_buf) const
{
field_nsei.encode_text(text_buf);
field_role__sgsn.encode_text(text_buf);
field_handle__sns.encode_text(text_buf);
field_nsvc.encode_text(text_buf);
}

void NSConfiguration::decode_text(Text_Buf& text_buf)
{
field_nsei.decode_text(text_buf);
field_role__sgsn.decode_text(text_buf);
field_handle__sns.decode_text(text_buf);
field_nsvc.decode_text(text_buf);
}

struct NSConfiguration_template::single_value_struct {
INTEGER_template field_nsei;
BOOLEAN_template field_role__sgsn;
BOOLEAN_template field_handle__sns;
NSVCConfigurations_template field_nsvc;
};

void NSConfiguration_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_nsei = ANY_VALUE;
single_value->field_role__sgsn = ANY_VALUE;
single_value->field_handle__sns = ANY_VALUE;
single_value->field_nsvc = ANY_VALUE;
}
}
}

void NSConfiguration_template::copy_value(const NSConfiguration& other_value)
{
single_value = new single_value_struct;
if (other_value.nsei().is_bound()) {
  single_value->field_nsei = other_value.nsei();
} else {
  single_value->field_nsei.clean_up();
}
if (other_value.role__sgsn().is_bound()) {
  single_value->field_role__sgsn = other_value.role__sgsn();
} else {
  single_value->field_role__sgsn.clean_up();
}
if (other_value.handle__sns().is_bound()) {
  single_value->field_handle__sns = other_value.handle__sns();
} else {
  single_value->field_handle__sns.clean_up();
}
if (other_value.nsvc().is_bound()) {
  single_value->field_nsvc = other_value.nsvc();
} else {
  single_value->field_nsvc.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void NSConfiguration_template::copy_template(const NSConfiguration_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.nsei().get_selection()) {
single_value->field_nsei = other_value.nsei();
} else {
single_value->field_nsei.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.role__sgsn().get_selection()) {
single_value->field_role__sgsn = other_value.role__sgsn();
} else {
single_value->field_role__sgsn.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.handle__sns().get_selection()) {
single_value->field_handle__sns = other_value.handle__sns();
} else {
single_value->field_handle__sns.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.nsvc().get_selection()) {
single_value->field_nsvc = other_value.nsvc();
} else {
single_value->field_nsvc.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 NSConfiguration_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 NSConfiguration_template(*other_value.implication_.precondition);
implication_.implied_template = new NSConfiguration_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 @NS_Emulation.NSConfiguration.");
break;
}
set_selection(other_value);
}

NSConfiguration_template::NSConfiguration_template()
{
}

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

NSConfiguration_template::NSConfiguration_template(const NSConfiguration& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean NSConfiguration_template::match(const NSConfiguration& 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.nsei().is_bound()) return FALSE;
if(!single_value->field_nsei.match(other_value.nsei(), legacy))return FALSE;
if(!other_value.role__sgsn().is_bound()) return FALSE;
if(!single_value->field_role__sgsn.match(other_value.role__sgsn(), legacy))return FALSE;
if(!other_value.handle__sns().is_bound()) return FALSE;
if(!single_value->field_handle__sns.match(other_value.handle__sns(), legacy))return FALSE;
if(!other_value.nsvc().is_bound()) return FALSE;
if(!single_value->field_nsvc.match(other_value.nsvc(), 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 @NS_Emulation.NSConfiguration.");
}
return FALSE;
}

boolean NSConfiguration_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_nsei.is_bound()
 || single_value->field_role__sgsn.is_bound()
 || single_value->field_handle__sns.is_bound()
 || single_value->field_nsvc.is_bound();
}

boolean NSConfiguration_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_nsei.is_value()
 && single_value->field_role__sgsn.is_value()
 && single_value->field_handle__sns.is_value()
 && single_value->field_nsvc.is_value();
}

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

NSConfiguration NSConfiguration_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 @NS_Emulation.NSConfiguration.");
NSConfiguration ret_val;
if (single_value->field_nsei.is_bound()) {
ret_val.nsei() = single_value->field_nsei.valueof();
}
if (single_value->field_role__sgsn.is_bound()) {
ret_val.role__sgsn() = single_value->field_role__sgsn.valueof();
}
if (single_value->field_handle__sns.is_bound()) {
ret_val.handle__sns() = single_value->field_handle__sns.valueof();
}
if (single_value->field_nsvc.is_bound()) {
ret_val.nsvc() = single_value->field_nsvc.valueof();
}
return ret_val;
}

void NSConfiguration_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 @NS_Emulation.NSConfiguration.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new NSConfiguration_template[list_length];
}

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

INTEGER_template& NSConfiguration_template::nsei()
{
set_specific();
return single_value->field_nsei;
}

const INTEGER_template& NSConfiguration_template::nsei() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field nsei of a non-specific template of type @NS_Emulation.NSConfiguration.");
return single_value->field_nsei;
}

BOOLEAN_template& NSConfiguration_template::role__sgsn()
{
set_specific();
return single_value->field_role__sgsn;
}

const BOOLEAN_template& NSConfiguration_template::role__sgsn() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field role_sgsn of a non-specific template of type @NS_Emulation.NSConfiguration.");
return single_value->field_role__sgsn;
}

BOOLEAN_template& NSConfiguration_template::handle__sns()
{
set_specific();
return single_value->field_handle__sns;
}

const BOOLEAN_template& NSConfiguration_template::handle__sns() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field handle_sns of a non-specific template of type @NS_Emulation.NSConfiguration.");
return single_value->field_handle__sns;
}

NSVCConfigurations_template& NSConfiguration_template::nsvc()
{
set_specific();
return single_value->field_nsvc;
}

const NSVCConfigurations_template& NSConfiguration_template::nsvc() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field nsvc of a non-specific template of type @NS_Emulation.NSConfiguration.");
return single_value->field_nsvc;
}

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

void NSConfiguration_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ nsei := ");
single_value->field_nsei.log();
TTCN_Logger::log_event_str(", role_sgsn := ");
single_value->field_role__sgsn.log();
TTCN_Logger::log_event_str(", handle_sns := ");
single_value->field_handle__sns.log();
TTCN_Logger::log_event_str(", nsvc := ");
single_value->field_nsvc.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 NSConfiguration_template::log_match(const NSConfiguration& 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_nsei.match(match_value.nsei(), legacy)){
TTCN_Logger::log_logmatch_info(".nsei");
single_value->field_nsei.log_match(match_value.nsei(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_role__sgsn.match(match_value.role__sgsn(), legacy)){
TTCN_Logger::log_logmatch_info(".role_sgsn");
single_value->field_role__sgsn.log_match(match_value.role__sgsn(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_handle__sns.match(match_value.handle__sns(), legacy)){
TTCN_Logger::log_logmatch_info(".handle_sns");
single_value->field_handle__sns.log_match(match_value.handle__sns(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_nsvc.match(match_value.nsvc(), legacy)){
TTCN_Logger::log_logmatch_info(".nsvc");
single_value->field_nsvc.log_match(match_value.nsvc(), 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("{ nsei := ");
single_value->field_nsei.log_match(match_value.nsei(), legacy);
TTCN_Logger::log_event_str(", role_sgsn := ");
single_value->field_role__sgsn.log_match(match_value.role__sgsn(), legacy);
TTCN_Logger::log_event_str(", handle_sns := ");
single_value->field_handle__sns.log_match(match_value.handle__sns(), legacy);
TTCN_Logger::log_event_str(", nsvc := ");
single_value->field_nsvc.log_match(match_value.nsvc(), 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 NSConfiguration_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (nsei().is_bound()) nsei().set_implicit_omit();
if (role__sgsn().is_bound()) role__sgsn().set_implicit_omit();
if (handle__sns().is_bound()) handle__sns().set_implicit_omit();
if (nsvc().is_bound()) nsvc().set_implicit_omit();
}

void NSConfiguration_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_nsei.encode_text(text_buf);
single_value->field_role__sgsn.encode_text(text_buf);
single_value->field_handle__sns.encode_text(text_buf);
single_value->field_nsvc.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 @NS_Emulation.NSConfiguration.");
}
}

void NSConfiguration_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_nsei.decode_text(text_buf);
single_value->field_role__sgsn.decode_text(text_buf);
single_value->field_handle__sns.decode_text(text_buf);
single_value->field_nsvc.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 NSConfiguration_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 @NS_Emulation.NSConfiguration.");
}
}

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

void NSConfiguration_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_nsei.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NSConfiguration");
single_value->field_role__sgsn.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NSConfiguration");
single_value->field_handle__sns.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NSConfiguration");
single_value->field_nsvc.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NSConfiguration");
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 : "@NS_Emulation.NSConfiguration");
}

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

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


const IpEndpointTableEntry IpEndpointTable::UNBOUND_ELEM;
IpEndpointTable::IpEndpointTable()
{
val_ptr = NULL;
}

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

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

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

void IpEndpointTable::clean_up()
{
if (val_ptr != NULL) {
if (val_ptr->ref_count > 1) {
val_ptr->ref_count--;
val_ptr = NULL;
}
else if (val_ptr->ref_count == 1) {
for (int elem_count = 0; elem_count < val_ptr->n_elements;
elem_count++)
if (val_ptr->value_elements[elem_count] != NULL)
delete val_ptr->value_elements[elem_count];
free_pointers((void**)val_ptr->value_elements);
delete val_ptr;
val_ptr = NULL;
}
else
TTCN_error("Internal error: Invalid reference counter in a record of/set of value.");
}
}

IpEndpointTable& IpEndpointTable::operator=(null_type)
{
clean_up();
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = 0;
val_ptr->value_elements = NULL;
return *this;
}

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

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

boolean IpEndpointTable::operator==(const IpEndpointTable& other_value) const
{
if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @NS_Emulation.IpEndpointTable.");
if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @NS_Emulation.IpEndpointTable.");
if (val_ptr == other_value.val_ptr) return TRUE;
if (val_ptr->n_elements != (other_value.val_ptr)->n_elements)
return FALSE;
for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++){
if (val_ptr->value_elements[elem_count] != NULL){
if ((other_value.val_ptr)->value_elements[elem_count] != NULL){
  if (*val_ptr->value_elements[elem_count] != *(other_value.val_ptr)->value_elements[elem_count]) return FALSE;
} else return FALSE;
} else {
if ((other_value.val_ptr)->value_elements[elem_count] != NULL) return FALSE;
}
}
return TRUE;
}

IpEndpointTableEntry& IpEndpointTable::operator[](int index_value)
{
if (index_value < 0) TTCN_error("Accessing an element of type @NS_Emulation.IpEndpointTable using a negative index: %d.", index_value);
if (val_ptr == NULL) {
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = 0;
val_ptr->value_elements = NULL;
} else if (val_ptr->ref_count > 1) {
struct recordof_setof_struct *new_val_ptr = new recordof_setof_struct;
new_val_ptr->ref_count = 1;
new_val_ptr->n_elements = (index_value >= val_ptr->n_elements) ? index_value + 1 : val_ptr->n_elements;
new_val_ptr->value_elements = (IpEndpointTableEntry**)allocate_pointers(new_val_ptr->n_elements);
for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++){
if (val_ptr->value_elements[elem_count] != NULL){
new_val_ptr->value_elements[elem_count] = new IpEndpointTableEntry(*(val_ptr->value_elements[elem_count]));
}
}
clean_up();
val_ptr = new_val_ptr;
}
if (index_value >= val_ptr->n_elements) set_size(index_value + 1);
if (val_ptr->value_elements[index_value] == NULL) {
val_ptr->value_elements[index_value] = new IpEndpointTableEntry;
}
return *val_ptr->value_elements[index_value];
}

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

const IpEndpointTableEntry& IpEndpointTable::operator[](int index_value) const
{
if (val_ptr == NULL)
TTCN_error("Accessing an element in an unbound value of type @NS_Emulation.IpEndpointTable.");
if (index_value < 0) TTCN_error("Accessing an element of type @NS_Emulation.IpEndpointTable using a negative index: %d.", index_value);
if (index_value >= val_ptr->n_elements) TTCN_error("Index overflow in a value of type @NS_Emulation.IpEndpointTable: The index is %d, but the value has only %d elements.", index_value, val_ptr->n_elements);
return (val_ptr->value_elements[index_value] == NULL) ?
UNBOUND_ELEM : *val_ptr->value_elements[index_value];
}

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

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

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

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

IpEndpointTable IpEndpointTable::operator>>=(int rotate_count) const
{
if (val_ptr == NULL) TTCN_error("Performing rotation operation on an unbound value of type @NS_Emulation.IpEndpointTable.");
if (val_ptr->n_elements == 0) return *this;
int rc;
if (rotate_count>=0) rc = rotate_count % val_ptr->n_elements;
else rc = val_ptr->n_elements - ((-rotate_count) % val_ptr->n_elements);
if (rc == 0) return *this;
IpEndpointTable ret_val;
ret_val.set_size(val_ptr->n_elements);
for (int i=0; i<val_ptr->n_elements; i++) {
if (val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[(i+rc)%val_ptr->n_elements] =new IpEndpointTableEntry(*val_ptr->value_elements[i]);
}
}
return ret_val;
}

IpEndpointTable IpEndpointTable::operator+(const IpEndpointTable& other_value) const
{
if (val_ptr == NULL || other_value.val_ptr == NULL) TTCN_error("Unbound operand of @NS_Emulation.IpEndpointTable concatenation.");
if (val_ptr->n_elements == 0) return other_value;
if (other_value.val_ptr->n_elements == 0) return *this;
IpEndpointTable ret_val;
ret_val.set_size(val_ptr->n_elements+other_value.val_ptr->n_elements);
for (int i=0; i<val_ptr->n_elements; i++) {
if (val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[i] = new IpEndpointTableEntry(*val_ptr->value_elements[i]);
}
}
for (int i=0; i<other_value.val_ptr->n_elements; i++) {
if (other_value.val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[i+val_ptr->n_elements] = new IpEndpointTableEntry(*other_value.val_ptr->value_elements[i]);
}
}
return ret_val;
}

IpEndpointTable IpEndpointTable::substr(int index, int returncount) const
{
if (val_ptr == NULL) TTCN_error("The first argument of substr() is an unbound value of type @NS_Emulation.IpEndpointTable.");
check_substr_arguments(val_ptr->n_elements, index, returncount, "@NS_Emulation.IpEndpointTable","element");
IpEndpointTable ret_val;
ret_val.set_size(returncount);
for (int i=0; i<returncount; i++) {
if (val_ptr->value_elements[i+index] != NULL) {
ret_val.val_ptr->value_elements[i] = new IpEndpointTableEntry(*val_ptr->value_elements[i+index]);
}
}
return ret_val;
}

IpEndpointTable IpEndpointTable::replace(int index, int len, const IpEndpointTable& repl) const
{
if (val_ptr == NULL) TTCN_error("The first argument of replace() is an unbound value of type @NS_Emulation.IpEndpointTable.");
if (repl.val_ptr == NULL) TTCN_error("The fourth argument of replace() is an unbound value of type @NS_Emulation.IpEndpointTable.");
check_replace_arguments(val_ptr->n_elements, index, len, "@NS_Emulation.IpEndpointTable","element");
IpEndpointTable ret_val;
ret_val.set_size(val_ptr->n_elements + repl.val_ptr->n_elements - len);
for (int i = 0; i < index; i++) {
if (val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[i] = new IpEndpointTableEntry(*val_ptr->value_elements[i]);
}
}
for (int i = 0; i < repl.val_ptr->n_elements; i++) {
if (repl.val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[i+index] = new IpEndpointTableEntry(*repl.val_ptr->value_elements[i]);
}
}
for (int i = 0; i < val_ptr->n_elements - index - len; i++) {
if (val_ptr->value_elements[index+i+len] != NULL) {
ret_val.val_ptr->value_elements[index+i+repl.val_ptr->n_elements] = new IpEndpointTableEntry(*val_ptr->value_elements[index+i+len]);
}
}
return ret_val;
}

IpEndpointTable IpEndpointTable::replace(int index, int len, const IpEndpointTable_template& repl) const
{
if (!repl.is_value()) TTCN_error("The fourth argument of function replace() is a template with non-specific value.");
return replace(index, len, repl.valueof());
}

void IpEndpointTable::set_size(int new_size)
{
if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a value of type @NS_Emulation.IpEndpointTable.");
if (val_ptr == NULL) {
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = 0;
val_ptr->value_elements = NULL;
} else if (val_ptr->ref_count > 1) {
struct recordof_setof_struct *new_val_ptr = new recordof_setof_struct;
new_val_ptr->ref_count = 1;
new_val_ptr->n_elements = (new_size < val_ptr->n_elements) ? new_size : val_ptr->n_elements;
new_val_ptr->value_elements = (IpEndpointTableEntry**)allocate_pointers(new_val_ptr->n_elements);
for (int elem_count = 0; elem_count < new_val_ptr->n_elements; elem_count++) {
if (val_ptr->value_elements[elem_count] != NULL){
new_val_ptr->value_elements[elem_count] = new IpEndpointTableEntry(*(val_ptr->value_elements[elem_count]));
}
}
clean_up();
val_ptr = new_val_ptr;
}
if (new_size > val_ptr->n_elements) {
val_ptr->value_elements = (IpEndpointTableEntry**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size);
#ifdef TITAN_MEMORY_DEBUG_SET_RECORD_OF
if((val_ptr->n_elements/1000)!=(new_size/1000)) TTCN_warning("New size of type @NS_Emulation.IpEndpointTable: %d",new_size);
#endif
val_ptr->n_elements = new_size;
} else if (new_size < val_ptr->n_elements) {
for (int elem_count = new_size; elem_count < val_ptr->n_elements; elem_count++)
if (val_ptr->value_elements[elem_count] != NULL)delete val_ptr->value_elements[elem_count];
val_ptr->value_elements = (IpEndpointTableEntry**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size);
val_ptr->n_elements = new_size;
}
}

boolean IpEndpointTable::is_value() const
{
if (val_ptr == NULL) return FALSE;
for(int i = 0; i < val_ptr->n_elements; ++i) {
if (val_ptr->value_elements[i] == NULL || !val_ptr->value_elements[i]->is_value()) return FALSE;
}
return TRUE;
}

int IpEndpointTable::size_of() const
{
if (val_ptr == NULL) TTCN_error("Performing sizeof operation on an unbound value of type @NS_Emulation.IpEndpointTable.");
return val_ptr->n_elements;
}

int IpEndpointTable::lengthof() const
{
if (val_ptr == NULL) TTCN_error("Performing lengthof operation on an unbound value of type @NS_Emulation.IpEndpointTable.");
for (int my_length=val_ptr->n_elements; my_length>0; my_length--) if (val_ptr->value_elements[my_length-1] != NULL) return my_length;
return 0;
}

void IpEndpointTable::log() const
{
if (val_ptr == NULL) {;
TTCN_Logger::log_event_unbound();
return;
}
switch (val_ptr->n_elements) {
case 0:
TTCN_Logger::log_event_str("{ }");
break;
default:
TTCN_Logger::log_event_str("{ ");
for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++) {
if (elem_count > 0) TTCN_Logger::log_event_str(", ");
(*this)[elem_count].log();
}
TTCN_Logger::log_event_str(" }");
}
}

void IpEndpointTable::set_implicit_omit()
{
if (val_ptr == NULL) return;
for (int i = 0; i < val_ptr->n_elements; i++) {
if (val_ptr->value_elements[i] != NULL) val_ptr->value_elements[i]->set_implicit_omit();
}
}

void IpEndpointTable::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE|Module_Param::BC_LIST, "record of value");
  switch (param.get_operation_type()) {
  case Module_Param::OT_ASSIGN:
    if (param.get_type()==Module_Param::MP_Value_List && param.get_size()==0) {
      *this = NULL_VALUE;
      return;
    }
    switch (param.get_type()) {
    case Module_Param::MP_Value_List:
      set_size(param.get_size());
      for (size_t i=0; i<param.get_size(); ++i) {
        Module_Param* const curr = param.get_elem(i);
        if (curr->get_type()!=Module_Param::MP_NotUsed) {
          (*this)[i].set_param(*curr);
          if (!(*this)[i].is_bound()) {
            delete val_ptr->value_elements[i];
            val_ptr->value_elements[i] = NULL;
          }
        }
      }
      break;
    case Module_Param::MP_Indexed_List:
      for (size_t i=0; i<param.get_size(); ++i) {
        Module_Param* const curr = param.get_elem(i);
        (*this)[curr->get_id()->get_index()].set_param(*curr);
        if (!(*this)[curr->get_id()->get_index()].is_bound()) {
          delete val_ptr->value_elements[curr->get_id()->get_index()];
          val_ptr->value_elements[curr->get_id()->get_index()] = NULL;
        }
      }
      break;
    default:
      param.type_error("record of value", "@NS_Emulation.IpEndpointTable");
    }
    break;
  case Module_Param::OT_CONCAT:
    switch (param.get_type()) {
    case Module_Param::MP_Value_List: {
      if (!is_bound()) *this = NULL_VALUE;
      int start_idx = lengthof();
      for (size_t i=0; i<param.get_size(); ++i) {
        Module_Param* const curr = param.get_elem(i);
        if ((curr->get_type()!=Module_Param::MP_NotUsed)) {
          (*this)[start_idx+(int)i].set_param(*curr);
        }
      }
    } break;
    case Module_Param::MP_Indexed_List:
      param.error("Cannot concatenate an indexed value list");
      break;
    default:
      param.type_error("record of value", "@NS_Emulation.IpEndpointTable");
    }
    break;
  default:
    TTCN_error("Internal error: Unknown operation type.");
  }
}

void IpEndpointTable::encode_text(Text_Buf& text_buf) const
{
if (val_ptr == NULL) TTCN_error("Text encoder: Encoding an unbound value of type @NS_Emulation.IpEndpointTable.");
text_buf.push_int(val_ptr->n_elements);
for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++)
(*this)[elem_count].encode_text(text_buf);
}

void IpEndpointTable::decode_text(Text_Buf& text_buf)
{
clean_up();
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = text_buf.pull_int().get_val();
if (val_ptr->n_elements < 0) TTCN_error("Text decoder: Negative size was received for a value of type @NS_Emulation.IpEndpointTable.");
val_ptr->value_elements = (IpEndpointTableEntry**)allocate_pointers(val_ptr->n_elements);
for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++) {
val_ptr->value_elements[elem_count] = new IpEndpointTableEntry;
val_ptr->value_elements[elem_count]->decode_text(text_buf);
}
}

void IpEndpointTable_template::copy_value(const IpEndpointTable& other_value)
{
if (!other_value.is_bound()) TTCN_error("Initialization of a template of type @NS_Emulation.IpEndpointTable with an unbound value.");
single_value.n_elements = other_value.size_of();
single_value.value_elements = (IpEndpointTableEntry_template**)allocate_pointers(single_value.n_elements);
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
if (other_value[elem_count].is_bound()) {
single_value.value_elements[elem_count] = new IpEndpointTableEntry_template(other_value[elem_count]);
} else {
single_value.value_elements[elem_count] = new IpEndpointTableEntry_template;
}
}
set_selection(SPECIFIC_VALUE);
}

void IpEndpointTable_template::copy_template(const IpEndpointTable_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value.n_elements = other_value.single_value.n_elements;
single_value.value_elements = (IpEndpointTableEntry_template**)allocate_pointers(single_value.n_elements);
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
if (UNINITIALIZED_TEMPLATE != other_value.single_value.value_elements[elem_count]->get_selection()) {
single_value.value_elements[elem_count] = new IpEndpointTableEntry_template(*other_value.single_value.value_elements[elem_count]);
} else {
single_value.value_elements[elem_count] = new IpEndpointTableEntry_template;
}
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new IpEndpointTable_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 IpEndpointTable_template(*other_value.implication_.precondition);
implication_.implied_template = new IpEndpointTable_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 @NS_Emulation.IpEndpointTable.");
break;
}
set_selection(other_value);
}

boolean IpEndpointTable_template::match_function_specific(const Base_Type *value_ptr, int value_index, const Restricted_Length_Template *template_ptr, int template_index, boolean legacy)
{
if (value_index >= 0) return ((const IpEndpointTable_template*)template_ptr)->single_value.value_elements[template_index]->match((*(const IpEndpointTable*)value_ptr)[value_index], legacy);
else return ((const IpEndpointTable_template*)template_ptr)->single_value.value_elements[template_index]->is_any_or_omit();
}

IpEndpointTable_template::IpEndpointTable_template()
{
}

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

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

IpEndpointTable_template::IpEndpointTable_template(const IpEndpointTable& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

void IpEndpointTable_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++)
delete single_value.value_elements[elem_count];
free_pointers((void**)single_value.value_elements);
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

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

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

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

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

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

IpEndpointTableEntry_template& IpEndpointTable_template::operator[](int index_value)
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @NS_Emulation.IpEndpointTable using a negative index: %d.", index_value);
switch (template_selection)
{
  case SPECIFIC_VALUE:
    if(index_value < single_value.n_elements) break;
    // no break
  case OMIT_VALUE:
  case ANY_VALUE:
  case ANY_OR_OMIT:
  case UNINITIALIZED_TEMPLATE:
    set_size(index_value + 1);
    break;
  default:
    TTCN_error("Accessing an element of a non-specific template for type @NS_Emulation.IpEndpointTable.");
    break;
}
return *single_value.value_elements[index_value];
}

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

const IpEndpointTableEntry_template& IpEndpointTable_template::operator[](int index_value) const
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @NS_Emulation.IpEndpointTable using a negative index: %d.", index_value);
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing an element of a non-specific template for type @NS_Emulation.IpEndpointTable.");
if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @NS_Emulation.IpEndpointTable: The index is %d, but the template has only %d elements.", index_value, single_value.n_elements);
return *single_value.value_elements[index_value];
}

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

void IpEndpointTable_template::set_size(int new_size)
{
if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a template of type @NS_Emulation.IpEndpointTable.");
template_sel old_selection = template_selection;
if (old_selection != SPECIFIC_VALUE) {
clean_up();
set_selection(SPECIFIC_VALUE);
single_value.n_elements = 0;
single_value.value_elements = NULL;
}
if (new_size > single_value.n_elements) {
single_value.value_elements = (IpEndpointTableEntry_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size);
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) {
for (int elem_count = single_value.n_elements; elem_count < new_size; elem_count++)
single_value.value_elements[elem_count] = new IpEndpointTableEntry_template(ANY_VALUE);
} else {
for (int elem_count = single_value.n_elements; elem_count < new_size; elem_count++)
single_value.value_elements[elem_count] = new IpEndpointTableEntry_template;
}
single_value.n_elements = new_size;
} else if (new_size < single_value.n_elements) {
for (int elem_count = new_size; elem_count < single_value.n_elements; elem_count++)
delete single_value.value_elements[elem_count];
single_value.value_elements = (IpEndpointTableEntry_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size);
single_value.n_elements = new_size;
}
}

int IpEndpointTable_template::n_elem() const
{
  switch (template_selection) {
  case SPECIFIC_VALUE:
    return single_value.n_elements;
    break;
  case VALUE_LIST:
    return value_list.n_values;
    break;
  default:
    TTCN_error("Performing n_elem");
  }
}

int IpEndpointTable_template::size_of(boolean is_size) const
{
const char* op_name = is_size ? "size" : "length";
int min_size;
boolean has_any_or_none;
if (is_ifpresent) TTCN_error("Performing %sof() operation on a template of type @NS_Emulation.IpEndpointTable which has an ifpresent attribute.", op_name);
switch (template_selection)
{
case SPECIFIC_VALUE: {
  min_size = 0;
  has_any_or_none = FALSE;
  int elem_count = single_value.n_elements;
  if (!is_size) { while (elem_count>0 && !single_value.value_elements[elem_count-1]->is_bound()) elem_count--; }
  for (int i=0; i<elem_count; i++) {
    switch (single_value.value_elements[i]->get_selection()) {
    case OMIT_VALUE:
      TTCN_error("Performing %sof() operation on a template of type @NS_Emulation.IpEndpointTable containing omit element.", op_name);
    case ANY_OR_OMIT:
      has_any_or_none = TRUE;
      break;
    default:
      min_size++;
      break;
    }
  }
} break;
case OMIT_VALUE:
  TTCN_error("Performing %sof() operation on a template of type @NS_Emulation.IpEndpointTable containing omit value.", op_name);
case ANY_VALUE:
case ANY_OR_OMIT:
  min_size = 0;
  has_any_or_none = TRUE;
  break;
case VALUE_LIST:
{
  if (value_list.n_values<1)
    TTCN_error("Performing %sof() operation on a template of type @NS_Emulation.IpEndpointTable containing an empty list.", op_name);
  int item_size = value_list.list_value[0].size_of(is_size);
  for (unsigned int i = 1; i < value_list.n_values; i++) {
    if (value_list.list_value[i].size_of(is_size)!=item_size)
      TTCN_error("Performing %sof() operation on a template of type @NS_Emulation.IpEndpointTable containing a value list with different sizes.", op_name);
  }
  min_size = item_size;
  has_any_or_none = FALSE;
  break;
}
case COMPLEMENTED_LIST:
  TTCN_error("Performing %sof() operation on a template of type @NS_Emulation.IpEndpointTable containing complemented list.", op_name);
default:
  TTCN_error("Performing %sof() operation on an uninitialized/unsupported template of type @NS_Emulation.IpEndpointTable.", op_name);
}
return check_section_is_single(min_size, has_any_or_none, op_name, "a", "template of type @NS_Emulation.IpEndpointTable");
}

boolean IpEndpointTable_template::match(const IpEndpointTable& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
int value_length = other_value.size_of();
if (!match_length(value_length)) return FALSE;
switch (template_selection) {
case SPECIFIC_VALUE:
return match_record_of(&other_value, value_length, this, single_value.n_elements, match_function_specific, legacy);
case OMIT_VALUE:
return FALSE;
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching with an uninitialized/unsupported template of type @NS_Emulation.IpEndpointTable.");
}
return FALSE;
}

boolean IpEndpointTable_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++)
if (!single_value.value_elements[elem_count]->is_value()) return FALSE;
return TRUE;
}

IpEndpointTable IpEndpointTable_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 @NS_Emulation.IpEndpointTable.");
IpEndpointTable ret_val;
ret_val.set_size(single_value.n_elements);
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++)
if (single_value.value_elements[elem_count]->is_bound()) {
ret_val[elem_count] = single_value.value_elements[elem_count]->valueof();
}
return ret_val;
}

IpEndpointTable IpEndpointTable_template::substr(int index, int returncount) const
{
if (!is_value()) TTCN_error("The first argument of function substr() is a template with non-specific value.");
return valueof().substr(index, returncount);
}

IpEndpointTable IpEndpointTable_template::replace(int index, int len, const IpEndpointTable_template& repl) const
{
if (!is_value()) TTCN_error("The first argument of function replace() is a template with non-specific value.");
if (!repl.is_value()) TTCN_error("The fourth argument of function replace() is a template with non-specific value.");
return valueof().replace(index, len, repl.valueof());
}

IpEndpointTable IpEndpointTable_template::replace(int index, int len, const IpEndpointTable& repl) const
{
if (!is_value()) TTCN_error("The first argument of function replace() is a template with non-specific value.");
return valueof().replace(index, len, repl);
}

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

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

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

void IpEndpointTable_template::log_match(const IpEndpointTable& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
if(match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
}else{
if (template_selection == SPECIFIC_VALUE && single_value.n_elements > 0 && get_number_of_permutations() == 0 && single_value.n_elements == match_value.size_of()) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
if(!single_value.value_elements[elem_count]->match(match_value[elem_count], legacy)){
TTCN_Logger::log_logmatch_info("[%d]", elem_count);
single_value.value_elements[elem_count]->log_match(match_value[elem_count], legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
log_match_length(single_value.n_elements);
} else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE && single_value.n_elements > 0 && get_number_of_permutations() == 0 && single_value.n_elements == match_value.size_of()) {
TTCN_Logger::log_event_str("{ ");
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
if (elem_count > 0) TTCN_Logger::log_event_str(", ");
single_value.value_elements[elem_count]->log_match(match_value[elem_count], legacy);
}
TTCN_Logger::log_event_str(" }");
log_match_length(single_value.n_elements);
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

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

void IpEndpointTable_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_permutation(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value.n_elements = text_buf.pull_int().get_val();
if (single_value.n_elements < 0) TTCN_error("Text decoder: Negative size was received for a template of type @NS_Emulation.IpEndpointTable.");
single_value.value_elements = (IpEndpointTableEntry_template**)allocate_pointers(single_value.n_elements);
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
single_value.value_elements[elem_count] = new IpEndpointTableEntry_template;
single_value.value_elements[elem_count]->decode_text(text_buf);
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new IpEndpointTable_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of type @NS_Emulation.IpEndpointTable.");
}
}

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

boolean IpEndpointTable_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 IpEndpointTable_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
for (int i = 0; i < single_value.n_elements; i++) {
if (single_value.value_elements[i] != NULL) single_value.value_elements[i]->set_implicit_omit();
}
}

void IpEndpointTable_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE|Module_Param::BC_LIST, "record of template");
  switch (param.get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    IpEndpointTable_template temp;
    temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = temp;
    break; }
  case Module_Param::MP_Indexed_List:
    if (template_selection!=SPECIFIC_VALUE) set_size(0);
    for (size_t p_i=0; p_i<param.get_size(); ++p_i) {
      (*this)[(int)(param.get_elem(p_i)->get_id()->get_index())].set_param(*param.get_elem(p_i));
    }
    break;
  case Module_Param::MP_Value_List: {
    set_size(param.get_size());
    int curr_idx = 0;
    for (size_t p_i=0; p_i<param.get_size(); ++p_i) {
      switch (param.get_elem(p_i)->get_type()) {
      case Module_Param::MP_NotUsed:
        curr_idx++;
        break;
      case Module_Param::MP_Permutation_Template: {
        int perm_start_idx = curr_idx;
        Module_Param* param_i = param.get_elem(p_i);
        for (size_t perm_i=0; perm_i<param_i->get_size(); perm_i++) {
          (*this)[curr_idx].set_param(*(param_i->get_elem(perm_i)));
          curr_idx++;
        }
        int perm_end_idx = curr_idx - 1;
        add_permutation(perm_start_idx, perm_end_idx);
      } break;
      default:
        (*this)[curr_idx].set_param(*param.get_elem(p_i));
        curr_idx++;
      }
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    IpEndpointTable_template* precondition = new IpEndpointTable_template;
    precondition->set_param(*param.get_elem(0));
    IpEndpointTable_template* implied_template = new IpEndpointTable_template;
    implied_template->set_param(*param.get_elem(1));
    *this = IpEndpointTable_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record of template", "@NS_Emulation.IpEndpointTable");
  }
  is_ifpresent = param.get_ifpresent();
  set_length_range(param);
}

void IpEndpointTable_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
for (int i=0; i<single_value.n_elements; i++) single_value.value_elements[i]->check_restriction(t_res, t_name ? t_name : "@NS_Emulation.IpEndpointTable");
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 : "@NS_Emulation.IpEndpointTable");
}

boolean IpEndpointTable_template::get_istemplate_kind(const char* type) const {
if (!strcmp(type, "AnyElement")) {
  if (template_selection != SPECIFIC_VALUE) {
    return FALSE;
  }
  for (int i = 0; i < single_value.n_elements; i++) {
    if (single_value.value_elements[i]->get_selection() == ANY_VALUE) {
      return TRUE;
    }
  }
  return FALSE;
} else if (!strcmp(type, "AnyElementsOrNone")) {
  if (template_selection != SPECIFIC_VALUE) {
    return FALSE;
  }
  for (int i = 0; i < single_value.n_elements; i++) {
    if (single_value.value_elements[i]->get_selection() == ANY_OR_OMIT) {
      return TRUE;
    }
  }
  return FALSE;
} else if (!strcmp(type, "permutation")) {
  return number_of_permutations;
} else if (!strcmp(type, "length")) {
  return length_restriction_type != NO_LENGTH_RESTRICTION;
} else {
  return Base_Template::get_istemplate_kind(type);
}
}
IpEndpointTableEntry::IpEndpointTableEntry()
{
}

IpEndpointTableEntry::IpEndpointTableEntry(const Osmocom__Types::AddressFamily& par_address__family,
    const INTEGER& par_local__udp__port,
    const CHARSTRING& par_local__ip,
    const INTEGER& par_data__weight,
    const INTEGER& par_signalling__weight,
    const COMPONENT& par_provider__ct)
  :   field_address__family(par_address__family),
  field_local__udp__port(par_local__udp__port),
  field_local__ip(par_local__ip),
  field_data__weight(par_data__weight),
  field_signalling__weight(par_signalling__weight),
  field_provider__ct(par_provider__ct)
{
}

IpEndpointTableEntry::IpEndpointTableEntry(const IpEndpointTableEntry& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @NS_Emulation.IpEndpointTableEntry.");
if (other_value.address__family().is_bound()) field_address__family = other_value.address__family();
else field_address__family.clean_up();
if (other_value.local__udp__port().is_bound()) field_local__udp__port = other_value.local__udp__port();
else field_local__udp__port.clean_up();
if (other_value.local__ip().is_bound()) field_local__ip = other_value.local__ip();
else field_local__ip.clean_up();
if (other_value.data__weight().is_bound()) field_data__weight = other_value.data__weight();
else field_data__weight.clean_up();
if (other_value.signalling__weight().is_bound()) field_signalling__weight = other_value.signalling__weight();
else field_signalling__weight.clean_up();
if (other_value.provider__ct().is_bound()) field_provider__ct = other_value.provider__ct();
else field_provider__ct.clean_up();
}

void IpEndpointTableEntry::clean_up()
{
field_address__family.clean_up();
field_local__udp__port.clean_up();
field_local__ip.clean_up();
field_data__weight.clean_up();
field_signalling__weight.clean_up();
field_provider__ct.clean_up();
}

const TTCN_Typedescriptor_t* IpEndpointTableEntry::get_descriptor() const { return &IpEndpointTableEntry_descr_; }
IpEndpointTableEntry& IpEndpointTableEntry::operator=(const IpEndpointTableEntry& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @NS_Emulation.IpEndpointTableEntry.");
  if (other_value.address__family().is_bound()) field_address__family = other_value.address__family();
  else field_address__family.clean_up();
  if (other_value.local__udp__port().is_bound()) field_local__udp__port = other_value.local__udp__port();
  else field_local__udp__port.clean_up();
  if (other_value.local__ip().is_bound()) field_local__ip = other_value.local__ip();
  else field_local__ip.clean_up();
  if (other_value.data__weight().is_bound()) field_data__weight = other_value.data__weight();
  else field_data__weight.clean_up();
  if (other_value.signalling__weight().is_bound()) field_signalling__weight = other_value.signalling__weight();
  else field_signalling__weight.clean_up();
  if (other_value.provider__ct().is_bound()) field_provider__ct = other_value.provider__ct();
  else field_provider__ct.clean_up();
}
return *this;
}

boolean IpEndpointTableEntry::operator==(const IpEndpointTableEntry& other_value) const
{
return field_address__family==other_value.field_address__family
  && field_local__udp__port==other_value.field_local__udp__port
  && field_local__ip==other_value.field_local__ip
  && field_data__weight==other_value.field_data__weight
  && field_signalling__weight==other_value.field_signalling__weight
  && field_provider__ct==other_value.field_provider__ct;
}

boolean IpEndpointTableEntry::is_bound() const
{
return (field_address__family.is_bound())
  || (field_local__udp__port.is_bound())
  || (field_local__ip.is_bound())
  || (field_data__weight.is_bound())
  || (field_signalling__weight.is_bound())
  || (field_provider__ct.is_bound());
}
boolean IpEndpointTableEntry::is_value() const
{
return field_address__family.is_value()
  && field_local__udp__port.is_value()
  && field_local__ip.is_value()
  && field_data__weight.is_value()
  && field_signalling__weight.is_value()
  && field_provider__ct.is_value();
}
void IpEndpointTableEntry::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ address_family := ");
field_address__family.log();
TTCN_Logger::log_event_str(", local_udp_port := ");
field_local__udp__port.log();
TTCN_Logger::log_event_str(", local_ip := ");
field_local__ip.log();
TTCN_Logger::log_event_str(", data_weight := ");
field_data__weight.log();
TTCN_Logger::log_event_str(", signalling_weight := ");
field_signalling__weight.log();
TTCN_Logger::log_event_str(", provider_ct := ");
field_provider__ct.log();
TTCN_Logger::log_event_str(" }");
}

void IpEndpointTableEntry::set_implicit_omit()
{
if (address__family().is_bound()) address__family().set_implicit_omit();
if (local__udp__port().is_bound()) local__udp__port().set_implicit_omit();
if (local__ip().is_bound()) local__ip().set_implicit_omit();
if (data__weight().is_bound()) data__weight().set_implicit_omit();
if (signalling__weight().is_bound()) signalling__weight().set_implicit_omit();
if (provider__ct().is_bound()) provider__ct().set_implicit_omit();
}

void IpEndpointTableEntry::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (6<param.get_size()) {
      param.error("record value of type @NS_Emulation.IpEndpointTableEntry has 6 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) address__family().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) local__udp__port().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) local__ip().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) data__weight().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) signalling__weight().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) provider__ct().set_param(*param.get_elem(5));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "address_family")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          address__family().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "local_udp_port")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          local__udp__port().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "local_ip")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          local__ip().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "data_weight")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          data__weight().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "signalling_weight")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          signalling__weight().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "provider_ct")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          provider__ct().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 @NS_Emulation.IpEndpointTableEntry: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@NS_Emulation.IpEndpointTableEntry");
  }
}

void IpEndpointTableEntry::encode_text(Text_Buf& text_buf) const
{
field_address__family.encode_text(text_buf);
field_local__udp__port.encode_text(text_buf);
field_local__ip.encode_text(text_buf);
field_data__weight.encode_text(text_buf);
field_signalling__weight.encode_text(text_buf);
field_provider__ct.encode_text(text_buf);
}

void IpEndpointTableEntry::decode_text(Text_Buf& text_buf)
{
field_address__family.decode_text(text_buf);
field_local__udp__port.decode_text(text_buf);
field_local__ip.decode_text(text_buf);
field_data__weight.decode_text(text_buf);
field_signalling__weight.decode_text(text_buf);
field_provider__ct.decode_text(text_buf);
}

struct IpEndpointTableEntry_template::single_value_struct {
Osmocom__Types::AddressFamily_template field_address__family;
INTEGER_template field_local__udp__port;
CHARSTRING_template field_local__ip;
INTEGER_template field_data__weight;
INTEGER_template field_signalling__weight;
COMPONENT_template field_provider__ct;
};

void IpEndpointTableEntry_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_address__family = ANY_VALUE;
single_value->field_local__udp__port = ANY_VALUE;
single_value->field_local__ip = ANY_VALUE;
single_value->field_data__weight = ANY_VALUE;
single_value->field_signalling__weight = ANY_VALUE;
single_value->field_provider__ct = ANY_VALUE;
}
}
}

void IpEndpointTableEntry_template::copy_value(const IpEndpointTableEntry& other_value)
{
single_value = new single_value_struct;
if (other_value.address__family().is_bound()) {
  single_value->field_address__family = other_value.address__family();
} else {
  single_value->field_address__family.clean_up();
}
if (other_value.local__udp__port().is_bound()) {
  single_value->field_local__udp__port = other_value.local__udp__port();
} else {
  single_value->field_local__udp__port.clean_up();
}
if (other_value.local__ip().is_bound()) {
  single_value->field_local__ip = other_value.local__ip();
} else {
  single_value->field_local__ip.clean_up();
}
if (other_value.data__weight().is_bound()) {
  single_value->field_data__weight = other_value.data__weight();
} else {
  single_value->field_data__weight.clean_up();
}
if (other_value.signalling__weight().is_bound()) {
  single_value->field_signalling__weight = other_value.signalling__weight();
} else {
  single_value->field_signalling__weight.clean_up();
}
if (other_value.provider__ct().is_bound()) {
  single_value->field_provider__ct = other_value.provider__ct();
} else {
  single_value->field_provider__ct.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void IpEndpointTableEntry_template::copy_template(const IpEndpointTableEntry_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.address__family().get_selection()) {
single_value->field_address__family = other_value.address__family();
} else {
single_value->field_address__family.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.local__udp__port().get_selection()) {
single_value->field_local__udp__port = other_value.local__udp__port();
} else {
single_value->field_local__udp__port.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.local__ip().get_selection()) {
single_value->field_local__ip = other_value.local__ip();
} else {
single_value->field_local__ip.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.data__weight().get_selection()) {
single_value->field_data__weight = other_value.data__weight();
} else {
single_value->field_data__weight.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.signalling__weight().get_selection()) {
single_value->field_signalling__weight = other_value.signalling__weight();
} else {
single_value->field_signalling__weight.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.provider__ct().get_selection()) {
single_value->field_provider__ct = other_value.provider__ct();
} else {
single_value->field_provider__ct.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 IpEndpointTableEntry_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 IpEndpointTableEntry_template(*other_value.implication_.precondition);
implication_.implied_template = new IpEndpointTableEntry_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 @NS_Emulation.IpEndpointTableEntry.");
break;
}
set_selection(other_value);
}

IpEndpointTableEntry_template::IpEndpointTableEntry_template()
{
}

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

IpEndpointTableEntry_template::IpEndpointTableEntry_template(const IpEndpointTableEntry& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean IpEndpointTableEntry_template::match(const IpEndpointTableEntry& 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.address__family().is_bound()) return FALSE;
if(!single_value->field_address__family.match(other_value.address__family(), legacy))return FALSE;
if(!other_value.local__udp__port().is_bound()) return FALSE;
if(!single_value->field_local__udp__port.match(other_value.local__udp__port(), legacy))return FALSE;
if(!other_value.local__ip().is_bound()) return FALSE;
if(!single_value->field_local__ip.match(other_value.local__ip(), legacy))return FALSE;
if(!other_value.data__weight().is_bound()) return FALSE;
if(!single_value->field_data__weight.match(other_value.data__weight(), legacy))return FALSE;
if(!other_value.signalling__weight().is_bound()) return FALSE;
if(!single_value->field_signalling__weight.match(other_value.signalling__weight(), legacy))return FALSE;
if(!other_value.provider__ct().is_bound()) return FALSE;
if(!single_value->field_provider__ct.match(other_value.provider__ct(), 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 @NS_Emulation.IpEndpointTableEntry.");
}
return FALSE;
}

boolean IpEndpointTableEntry_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_address__family.is_bound()
 || single_value->field_local__udp__port.is_bound()
 || single_value->field_local__ip.is_bound()
 || single_value->field_data__weight.is_bound()
 || single_value->field_signalling__weight.is_bound()
 || single_value->field_provider__ct.is_bound();
}

boolean IpEndpointTableEntry_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_address__family.is_value()
 && single_value->field_local__udp__port.is_value()
 && single_value->field_local__ip.is_value()
 && single_value->field_data__weight.is_value()
 && single_value->field_signalling__weight.is_value()
 && single_value->field_provider__ct.is_value();
}

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

IpEndpointTableEntry IpEndpointTableEntry_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 @NS_Emulation.IpEndpointTableEntry.");
IpEndpointTableEntry ret_val;
if (single_value->field_address__family.is_bound()) {
ret_val.address__family() = single_value->field_address__family.valueof();
}
if (single_value->field_local__udp__port.is_bound()) {
ret_val.local__udp__port() = single_value->field_local__udp__port.valueof();
}
if (single_value->field_local__ip.is_bound()) {
ret_val.local__ip() = single_value->field_local__ip.valueof();
}
if (single_value->field_data__weight.is_bound()) {
ret_val.data__weight() = single_value->field_data__weight.valueof();
}
if (single_value->field_signalling__weight.is_bound()) {
ret_val.signalling__weight() = single_value->field_signalling__weight.valueof();
}
if (single_value->field_provider__ct.is_bound()) {
ret_val.provider__ct() = single_value->field_provider__ct.valueof();
}
return ret_val;
}

void IpEndpointTableEntry_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 @NS_Emulation.IpEndpointTableEntry.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new IpEndpointTableEntry_template[list_length];
}

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

Osmocom__Types::AddressFamily_template& IpEndpointTableEntry_template::address__family()
{
set_specific();
return single_value->field_address__family;
}

const Osmocom__Types::AddressFamily_template& IpEndpointTableEntry_template::address__family() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field address_family of a non-specific template of type @NS_Emulation.IpEndpointTableEntry.");
return single_value->field_address__family;
}

INTEGER_template& IpEndpointTableEntry_template::local__udp__port()
{
set_specific();
return single_value->field_local__udp__port;
}

const INTEGER_template& IpEndpointTableEntry_template::local__udp__port() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field local_udp_port of a non-specific template of type @NS_Emulation.IpEndpointTableEntry.");
return single_value->field_local__udp__port;
}

CHARSTRING_template& IpEndpointTableEntry_template::local__ip()
{
set_specific();
return single_value->field_local__ip;
}

const CHARSTRING_template& IpEndpointTableEntry_template::local__ip() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field local_ip of a non-specific template of type @NS_Emulation.IpEndpointTableEntry.");
return single_value->field_local__ip;
}

INTEGER_template& IpEndpointTableEntry_template::data__weight()
{
set_specific();
return single_value->field_data__weight;
}

const INTEGER_template& IpEndpointTableEntry_template::data__weight() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field data_weight of a non-specific template of type @NS_Emulation.IpEndpointTableEntry.");
return single_value->field_data__weight;
}

INTEGER_template& IpEndpointTableEntry_template::signalling__weight()
{
set_specific();
return single_value->field_signalling__weight;
}

const INTEGER_template& IpEndpointTableEntry_template::signalling__weight() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field signalling_weight of a non-specific template of type @NS_Emulation.IpEndpointTableEntry.");
return single_value->field_signalling__weight;
}

COMPONENT_template& IpEndpointTableEntry_template::provider__ct()
{
set_specific();
return single_value->field_provider__ct;
}

const COMPONENT_template& IpEndpointTableEntry_template::provider__ct() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field provider_ct of a non-specific template of type @NS_Emulation.IpEndpointTableEntry.");
return single_value->field_provider__ct;
}

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

void IpEndpointTableEntry_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ address_family := ");
single_value->field_address__family.log();
TTCN_Logger::log_event_str(", local_udp_port := ");
single_value->field_local__udp__port.log();
TTCN_Logger::log_event_str(", local_ip := ");
single_value->field_local__ip.log();
TTCN_Logger::log_event_str(", data_weight := ");
single_value->field_data__weight.log();
TTCN_Logger::log_event_str(", signalling_weight := ");
single_value->field_signalling__weight.log();
TTCN_Logger::log_event_str(", provider_ct := ");
single_value->field_provider__ct.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 IpEndpointTableEntry_template::log_match(const IpEndpointTableEntry& 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_address__family.match(match_value.address__family(), legacy)){
TTCN_Logger::log_logmatch_info(".address_family");
single_value->field_address__family.log_match(match_value.address__family(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_local__udp__port.match(match_value.local__udp__port(), legacy)){
TTCN_Logger::log_logmatch_info(".local_udp_port");
single_value->field_local__udp__port.log_match(match_value.local__udp__port(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_local__ip.match(match_value.local__ip(), legacy)){
TTCN_Logger::log_logmatch_info(".local_ip");
single_value->field_local__ip.log_match(match_value.local__ip(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_data__weight.match(match_value.data__weight(), legacy)){
TTCN_Logger::log_logmatch_info(".data_weight");
single_value->field_data__weight.log_match(match_value.data__weight(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_signalling__weight.match(match_value.signalling__weight(), legacy)){
TTCN_Logger::log_logmatch_info(".signalling_weight");
single_value->field_signalling__weight.log_match(match_value.signalling__weight(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_provider__ct.match(match_value.provider__ct(), legacy)){
TTCN_Logger::log_logmatch_info(".provider_ct");
single_value->field_provider__ct.log_match(match_value.provider__ct(), 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("{ address_family := ");
single_value->field_address__family.log_match(match_value.address__family(), legacy);
TTCN_Logger::log_event_str(", local_udp_port := ");
single_value->field_local__udp__port.log_match(match_value.local__udp__port(), legacy);
TTCN_Logger::log_event_str(", local_ip := ");
single_value->field_local__ip.log_match(match_value.local__ip(), legacy);
TTCN_Logger::log_event_str(", data_weight := ");
single_value->field_data__weight.log_match(match_value.data__weight(), legacy);
TTCN_Logger::log_event_str(", signalling_weight := ");
single_value->field_signalling__weight.log_match(match_value.signalling__weight(), legacy);
TTCN_Logger::log_event_str(", provider_ct := ");
single_value->field_provider__ct.log_match(match_value.provider__ct(), 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 IpEndpointTableEntry_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (address__family().is_bound()) address__family().set_implicit_omit();
if (local__udp__port().is_bound()) local__udp__port().set_implicit_omit();
if (local__ip().is_bound()) local__ip().set_implicit_omit();
if (data__weight().is_bound()) data__weight().set_implicit_omit();
if (signalling__weight().is_bound()) signalling__weight().set_implicit_omit();
if (provider__ct().is_bound()) provider__ct().set_implicit_omit();
}

void IpEndpointTableEntry_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_address__family.encode_text(text_buf);
single_value->field_local__udp__port.encode_text(text_buf);
single_value->field_local__ip.encode_text(text_buf);
single_value->field_data__weight.encode_text(text_buf);
single_value->field_signalling__weight.encode_text(text_buf);
single_value->field_provider__ct.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 @NS_Emulation.IpEndpointTableEntry.");
}
}

void IpEndpointTableEntry_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_address__family.decode_text(text_buf);
single_value->field_local__udp__port.decode_text(text_buf);
single_value->field_local__ip.decode_text(text_buf);
single_value->field_data__weight.decode_text(text_buf);
single_value->field_signalling__weight.decode_text(text_buf);
single_value->field_provider__ct.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 IpEndpointTableEntry_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 @NS_Emulation.IpEndpointTableEntry.");
}
}

void IpEndpointTableEntry_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: {
    IpEndpointTableEntry_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (6<param.get_size()) {
      param.error("record template of type @NS_Emulation.IpEndpointTableEntry has 6 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) address__family().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) local__udp__port().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) local__ip().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) data__weight().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) signalling__weight().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) provider__ct().set_param(*param.get_elem(5));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "address_family")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          address__family().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "local_udp_port")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          local__udp__port().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "local_ip")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          local__ip().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "data_weight")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          data__weight().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "signalling_weight")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          signalling__weight().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "provider_ct")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          provider__ct().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 @NS_Emulation.IpEndpointTableEntry: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    IpEndpointTableEntry_template* precondition = new IpEndpointTableEntry_template;
    precondition->set_param(*param.get_elem(0));
    IpEndpointTableEntry_template* implied_template = new IpEndpointTableEntry_template;
    implied_template->set_param(*param.get_elem(1));
    *this = IpEndpointTableEntry_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@NS_Emulation.IpEndpointTableEntry");
  }
  is_ifpresent = param.get_ifpresent();
}

void IpEndpointTableEntry_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_address__family.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.IpEndpointTableEntry");
single_value->field_local__udp__port.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.IpEndpointTableEntry");
single_value->field_local__ip.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.IpEndpointTableEntry");
single_value->field_data__weight.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.IpEndpointTableEntry");
single_value->field_signalling__weight.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.IpEndpointTableEntry");
single_value->field_provider__ct.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.IpEndpointTableEntry");
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 : "@NS_Emulation.IpEndpointTableEntry");
}

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

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


const NsvcTableEntry NsvcTable::UNBOUND_ELEM;
NsvcTable::NsvcTable()
{
val_ptr = NULL;
}

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

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

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

void NsvcTable::clean_up()
{
if (val_ptr != NULL) {
if (val_ptr->ref_count > 1) {
val_ptr->ref_count--;
val_ptr = NULL;
}
else if (val_ptr->ref_count == 1) {
for (int elem_count = 0; elem_count < val_ptr->n_elements;
elem_count++)
if (val_ptr->value_elements[elem_count] != NULL)
delete val_ptr->value_elements[elem_count];
free_pointers((void**)val_ptr->value_elements);
delete val_ptr;
val_ptr = NULL;
}
else
TTCN_error("Internal error: Invalid reference counter in a record of/set of value.");
}
}

NsvcTable& NsvcTable::operator=(null_type)
{
clean_up();
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = 0;
val_ptr->value_elements = NULL;
return *this;
}

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

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

boolean NsvcTable::operator==(const NsvcTable& other_value) const
{
if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @NS_Emulation.NsvcTable.");
if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @NS_Emulation.NsvcTable.");
if (val_ptr == other_value.val_ptr) return TRUE;
if (val_ptr->n_elements != (other_value.val_ptr)->n_elements)
return FALSE;
for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++){
if (val_ptr->value_elements[elem_count] != NULL){
if ((other_value.val_ptr)->value_elements[elem_count] != NULL){
  if (*val_ptr->value_elements[elem_count] != *(other_value.val_ptr)->value_elements[elem_count]) return FALSE;
} else return FALSE;
} else {
if ((other_value.val_ptr)->value_elements[elem_count] != NULL) return FALSE;
}
}
return TRUE;
}

NsvcTableEntry& NsvcTable::operator[](int index_value)
{
if (index_value < 0) TTCN_error("Accessing an element of type @NS_Emulation.NsvcTable using a negative index: %d.", index_value);
if (val_ptr == NULL) {
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = 0;
val_ptr->value_elements = NULL;
} else if (val_ptr->ref_count > 1) {
struct recordof_setof_struct *new_val_ptr = new recordof_setof_struct;
new_val_ptr->ref_count = 1;
new_val_ptr->n_elements = (index_value >= val_ptr->n_elements) ? index_value + 1 : val_ptr->n_elements;
new_val_ptr->value_elements = (NsvcTableEntry**)allocate_pointers(new_val_ptr->n_elements);
for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++){
if (val_ptr->value_elements[elem_count] != NULL){
new_val_ptr->value_elements[elem_count] = new NsvcTableEntry(*(val_ptr->value_elements[elem_count]));
}
}
clean_up();
val_ptr = new_val_ptr;
}
if (index_value >= val_ptr->n_elements) set_size(index_value + 1);
if (val_ptr->value_elements[index_value] == NULL) {
val_ptr->value_elements[index_value] = new NsvcTableEntry;
}
return *val_ptr->value_elements[index_value];
}

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

const NsvcTableEntry& NsvcTable::operator[](int index_value) const
{
if (val_ptr == NULL)
TTCN_error("Accessing an element in an unbound value of type @NS_Emulation.NsvcTable.");
if (index_value < 0) TTCN_error("Accessing an element of type @NS_Emulation.NsvcTable using a negative index: %d.", index_value);
if (index_value >= val_ptr->n_elements) TTCN_error("Index overflow in a value of type @NS_Emulation.NsvcTable: The index is %d, but the value has only %d elements.", index_value, val_ptr->n_elements);
return (val_ptr->value_elements[index_value] == NULL) ?
UNBOUND_ELEM : *val_ptr->value_elements[index_value];
}

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

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

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

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

NsvcTable NsvcTable::operator>>=(int rotate_count) const
{
if (val_ptr == NULL) TTCN_error("Performing rotation operation on an unbound value of type @NS_Emulation.NsvcTable.");
if (val_ptr->n_elements == 0) return *this;
int rc;
if (rotate_count>=0) rc = rotate_count % val_ptr->n_elements;
else rc = val_ptr->n_elements - ((-rotate_count) % val_ptr->n_elements);
if (rc == 0) return *this;
NsvcTable ret_val;
ret_val.set_size(val_ptr->n_elements);
for (int i=0; i<val_ptr->n_elements; i++) {
if (val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[(i+rc)%val_ptr->n_elements] =new NsvcTableEntry(*val_ptr->value_elements[i]);
}
}
return ret_val;
}

NsvcTable NsvcTable::operator+(const NsvcTable& other_value) const
{
if (val_ptr == NULL || other_value.val_ptr == NULL) TTCN_error("Unbound operand of @NS_Emulation.NsvcTable concatenation.");
if (val_ptr->n_elements == 0) return other_value;
if (other_value.val_ptr->n_elements == 0) return *this;
NsvcTable ret_val;
ret_val.set_size(val_ptr->n_elements+other_value.val_ptr->n_elements);
for (int i=0; i<val_ptr->n_elements; i++) {
if (val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[i] = new NsvcTableEntry(*val_ptr->value_elements[i]);
}
}
for (int i=0; i<other_value.val_ptr->n_elements; i++) {
if (other_value.val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[i+val_ptr->n_elements] = new NsvcTableEntry(*other_value.val_ptr->value_elements[i]);
}
}
return ret_val;
}

NsvcTable NsvcTable::substr(int index, int returncount) const
{
if (val_ptr == NULL) TTCN_error("The first argument of substr() is an unbound value of type @NS_Emulation.NsvcTable.");
check_substr_arguments(val_ptr->n_elements, index, returncount, "@NS_Emulation.NsvcTable","element");
NsvcTable ret_val;
ret_val.set_size(returncount);
for (int i=0; i<returncount; i++) {
if (val_ptr->value_elements[i+index] != NULL) {
ret_val.val_ptr->value_elements[i] = new NsvcTableEntry(*val_ptr->value_elements[i+index]);
}
}
return ret_val;
}

NsvcTable NsvcTable::replace(int index, int len, const NsvcTable& repl) const
{
if (val_ptr == NULL) TTCN_error("The first argument of replace() is an unbound value of type @NS_Emulation.NsvcTable.");
if (repl.val_ptr == NULL) TTCN_error("The fourth argument of replace() is an unbound value of type @NS_Emulation.NsvcTable.");
check_replace_arguments(val_ptr->n_elements, index, len, "@NS_Emulation.NsvcTable","element");
NsvcTable ret_val;
ret_val.set_size(val_ptr->n_elements + repl.val_ptr->n_elements - len);
for (int i = 0; i < index; i++) {
if (val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[i] = new NsvcTableEntry(*val_ptr->value_elements[i]);
}
}
for (int i = 0; i < repl.val_ptr->n_elements; i++) {
if (repl.val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[i+index] = new NsvcTableEntry(*repl.val_ptr->value_elements[i]);
}
}
for (int i = 0; i < val_ptr->n_elements - index - len; i++) {
if (val_ptr->value_elements[index+i+len] != NULL) {
ret_val.val_ptr->value_elements[index+i+repl.val_ptr->n_elements] = new NsvcTableEntry(*val_ptr->value_elements[index+i+len]);
}
}
return ret_val;
}

NsvcTable NsvcTable::replace(int index, int len, const NsvcTable_template& repl) const
{
if (!repl.is_value()) TTCN_error("The fourth argument of function replace() is a template with non-specific value.");
return replace(index, len, repl.valueof());
}

void NsvcTable::set_size(int new_size)
{
if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a value of type @NS_Emulation.NsvcTable.");
if (val_ptr == NULL) {
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = 0;
val_ptr->value_elements = NULL;
} else if (val_ptr->ref_count > 1) {
struct recordof_setof_struct *new_val_ptr = new recordof_setof_struct;
new_val_ptr->ref_count = 1;
new_val_ptr->n_elements = (new_size < val_ptr->n_elements) ? new_size : val_ptr->n_elements;
new_val_ptr->value_elements = (NsvcTableEntry**)allocate_pointers(new_val_ptr->n_elements);
for (int elem_count = 0; elem_count < new_val_ptr->n_elements; elem_count++) {
if (val_ptr->value_elements[elem_count] != NULL){
new_val_ptr->value_elements[elem_count] = new NsvcTableEntry(*(val_ptr->value_elements[elem_count]));
}
}
clean_up();
val_ptr = new_val_ptr;
}
if (new_size > val_ptr->n_elements) {
val_ptr->value_elements = (NsvcTableEntry**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size);
#ifdef TITAN_MEMORY_DEBUG_SET_RECORD_OF
if((val_ptr->n_elements/1000)!=(new_size/1000)) TTCN_warning("New size of type @NS_Emulation.NsvcTable: %d",new_size);
#endif
val_ptr->n_elements = new_size;
} else if (new_size < val_ptr->n_elements) {
for (int elem_count = new_size; elem_count < val_ptr->n_elements; elem_count++)
if (val_ptr->value_elements[elem_count] != NULL)delete val_ptr->value_elements[elem_count];
val_ptr->value_elements = (NsvcTableEntry**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size);
val_ptr->n_elements = new_size;
}
}

boolean NsvcTable::is_value() const
{
if (val_ptr == NULL) return FALSE;
for(int i = 0; i < val_ptr->n_elements; ++i) {
if (val_ptr->value_elements[i] == NULL || !val_ptr->value_elements[i]->is_value()) return FALSE;
}
return TRUE;
}

int NsvcTable::size_of() const
{
if (val_ptr == NULL) TTCN_error("Performing sizeof operation on an unbound value of type @NS_Emulation.NsvcTable.");
return val_ptr->n_elements;
}

int NsvcTable::lengthof() const
{
if (val_ptr == NULL) TTCN_error("Performing lengthof operation on an unbound value of type @NS_Emulation.NsvcTable.");
for (int my_length=val_ptr->n_elements; my_length>0; my_length--) if (val_ptr->value_elements[my_length-1] != NULL) return my_length;
return 0;
}

void NsvcTable::log() const
{
if (val_ptr == NULL) {;
TTCN_Logger::log_event_unbound();
return;
}
switch (val_ptr->n_elements) {
case 0:
TTCN_Logger::log_event_str("{ }");
break;
default:
TTCN_Logger::log_event_str("{ ");
for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++) {
if (elem_count > 0) TTCN_Logger::log_event_str(", ");
(*this)[elem_count].log();
}
TTCN_Logger::log_event_str(" }");
}
}

void NsvcTable::set_implicit_omit()
{
if (val_ptr == NULL) return;
for (int i = 0; i < val_ptr->n_elements; i++) {
if (val_ptr->value_elements[i] != NULL) val_ptr->value_elements[i]->set_implicit_omit();
}
}

void NsvcTable::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE|Module_Param::BC_LIST, "record of value");
  switch (param.get_operation_type()) {
  case Module_Param::OT_ASSIGN:
    if (param.get_type()==Module_Param::MP_Value_List && param.get_size()==0) {
      *this = NULL_VALUE;
      return;
    }
    switch (param.get_type()) {
    case Module_Param::MP_Value_List:
      set_size(param.get_size());
      for (size_t i=0; i<param.get_size(); ++i) {
        Module_Param* const curr = param.get_elem(i);
        if (curr->get_type()!=Module_Param::MP_NotUsed) {
          (*this)[i].set_param(*curr);
          if (!(*this)[i].is_bound()) {
            delete val_ptr->value_elements[i];
            val_ptr->value_elements[i] = NULL;
          }
        }
      }
      break;
    case Module_Param::MP_Indexed_List:
      for (size_t i=0; i<param.get_size(); ++i) {
        Module_Param* const curr = param.get_elem(i);
        (*this)[curr->get_id()->get_index()].set_param(*curr);
        if (!(*this)[curr->get_id()->get_index()].is_bound()) {
          delete val_ptr->value_elements[curr->get_id()->get_index()];
          val_ptr->value_elements[curr->get_id()->get_index()] = NULL;
        }
      }
      break;
    default:
      param.type_error("record of value", "@NS_Emulation.NsvcTable");
    }
    break;
  case Module_Param::OT_CONCAT:
    switch (param.get_type()) {
    case Module_Param::MP_Value_List: {
      if (!is_bound()) *this = NULL_VALUE;
      int start_idx = lengthof();
      for (size_t i=0; i<param.get_size(); ++i) {
        Module_Param* const curr = param.get_elem(i);
        if ((curr->get_type()!=Module_Param::MP_NotUsed)) {
          (*this)[start_idx+(int)i].set_param(*curr);
        }
      }
    } break;
    case Module_Param::MP_Indexed_List:
      param.error("Cannot concatenate an indexed value list");
      break;
    default:
      param.type_error("record of value", "@NS_Emulation.NsvcTable");
    }
    break;
  default:
    TTCN_error("Internal error: Unknown operation type.");
  }
}

void NsvcTable::encode_text(Text_Buf& text_buf) const
{
if (val_ptr == NULL) TTCN_error("Text encoder: Encoding an unbound value of type @NS_Emulation.NsvcTable.");
text_buf.push_int(val_ptr->n_elements);
for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++)
(*this)[elem_count].encode_text(text_buf);
}

void NsvcTable::decode_text(Text_Buf& text_buf)
{
clean_up();
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = text_buf.pull_int().get_val();
if (val_ptr->n_elements < 0) TTCN_error("Text decoder: Negative size was received for a value of type @NS_Emulation.NsvcTable.");
val_ptr->value_elements = (NsvcTableEntry**)allocate_pointers(val_ptr->n_elements);
for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++) {
val_ptr->value_elements[elem_count] = new NsvcTableEntry;
val_ptr->value_elements[elem_count]->decode_text(text_buf);
}
}

void NsvcTable_template::copy_value(const NsvcTable& other_value)
{
if (!other_value.is_bound()) TTCN_error("Initialization of a template of type @NS_Emulation.NsvcTable with an unbound value.");
single_value.n_elements = other_value.size_of();
single_value.value_elements = (NsvcTableEntry_template**)allocate_pointers(single_value.n_elements);
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
if (other_value[elem_count].is_bound()) {
single_value.value_elements[elem_count] = new NsvcTableEntry_template(other_value[elem_count]);
} else {
single_value.value_elements[elem_count] = new NsvcTableEntry_template;
}
}
set_selection(SPECIFIC_VALUE);
}

void NsvcTable_template::copy_template(const NsvcTable_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value.n_elements = other_value.single_value.n_elements;
single_value.value_elements = (NsvcTableEntry_template**)allocate_pointers(single_value.n_elements);
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
if (UNINITIALIZED_TEMPLATE != other_value.single_value.value_elements[elem_count]->get_selection()) {
single_value.value_elements[elem_count] = new NsvcTableEntry_template(*other_value.single_value.value_elements[elem_count]);
} else {
single_value.value_elements[elem_count] = new NsvcTableEntry_template;
}
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new NsvcTable_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 NsvcTable_template(*other_value.implication_.precondition);
implication_.implied_template = new NsvcTable_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 @NS_Emulation.NsvcTable.");
break;
}
set_selection(other_value);
}

boolean NsvcTable_template::match_function_specific(const Base_Type *value_ptr, int value_index, const Restricted_Length_Template *template_ptr, int template_index, boolean legacy)
{
if (value_index >= 0) return ((const NsvcTable_template*)template_ptr)->single_value.value_elements[template_index]->match((*(const NsvcTable*)value_ptr)[value_index], legacy);
else return ((const NsvcTable_template*)template_ptr)->single_value.value_elements[template_index]->is_any_or_omit();
}

NsvcTable_template::NsvcTable_template()
{
}

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

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

NsvcTable_template::NsvcTable_template(const NsvcTable& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

void NsvcTable_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++)
delete single_value.value_elements[elem_count];
free_pointers((void**)single_value.value_elements);
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

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

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

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

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

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

NsvcTableEntry_template& NsvcTable_template::operator[](int index_value)
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @NS_Emulation.NsvcTable using a negative index: %d.", index_value);
switch (template_selection)
{
  case SPECIFIC_VALUE:
    if(index_value < single_value.n_elements) break;
    // no break
  case OMIT_VALUE:
  case ANY_VALUE:
  case ANY_OR_OMIT:
  case UNINITIALIZED_TEMPLATE:
    set_size(index_value + 1);
    break;
  default:
    TTCN_error("Accessing an element of a non-specific template for type @NS_Emulation.NsvcTable.");
    break;
}
return *single_value.value_elements[index_value];
}

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

const NsvcTableEntry_template& NsvcTable_template::operator[](int index_value) const
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @NS_Emulation.NsvcTable using a negative index: %d.", index_value);
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing an element of a non-specific template for type @NS_Emulation.NsvcTable.");
if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @NS_Emulation.NsvcTable: The index is %d, but the template has only %d elements.", index_value, single_value.n_elements);
return *single_value.value_elements[index_value];
}

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

void NsvcTable_template::set_size(int new_size)
{
if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a template of type @NS_Emulation.NsvcTable.");
template_sel old_selection = template_selection;
if (old_selection != SPECIFIC_VALUE) {
clean_up();
set_selection(SPECIFIC_VALUE);
single_value.n_elements = 0;
single_value.value_elements = NULL;
}
if (new_size > single_value.n_elements) {
single_value.value_elements = (NsvcTableEntry_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size);
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) {
for (int elem_count = single_value.n_elements; elem_count < new_size; elem_count++)
single_value.value_elements[elem_count] = new NsvcTableEntry_template(ANY_VALUE);
} else {
for (int elem_count = single_value.n_elements; elem_count < new_size; elem_count++)
single_value.value_elements[elem_count] = new NsvcTableEntry_template;
}
single_value.n_elements = new_size;
} else if (new_size < single_value.n_elements) {
for (int elem_count = new_size; elem_count < single_value.n_elements; elem_count++)
delete single_value.value_elements[elem_count];
single_value.value_elements = (NsvcTableEntry_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size);
single_value.n_elements = new_size;
}
}

int NsvcTable_template::n_elem() const
{
  switch (template_selection) {
  case SPECIFIC_VALUE:
    return single_value.n_elements;
    break;
  case VALUE_LIST:
    return value_list.n_values;
    break;
  default:
    TTCN_error("Performing n_elem");
  }
}

int NsvcTable_template::size_of(boolean is_size) const
{
const char* op_name = is_size ? "size" : "length";
int min_size;
boolean has_any_or_none;
if (is_ifpresent) TTCN_error("Performing %sof() operation on a template of type @NS_Emulation.NsvcTable which has an ifpresent attribute.", op_name);
switch (template_selection)
{
case SPECIFIC_VALUE: {
  min_size = 0;
  has_any_or_none = FALSE;
  int elem_count = single_value.n_elements;
  if (!is_size) { while (elem_count>0 && !single_value.value_elements[elem_count-1]->is_bound()) elem_count--; }
  for (int i=0; i<elem_count; i++) {
    switch (single_value.value_elements[i]->get_selection()) {
    case OMIT_VALUE:
      TTCN_error("Performing %sof() operation on a template of type @NS_Emulation.NsvcTable containing omit element.", op_name);
    case ANY_OR_OMIT:
      has_any_or_none = TRUE;
      break;
    default:
      min_size++;
      break;
    }
  }
} break;
case OMIT_VALUE:
  TTCN_error("Performing %sof() operation on a template of type @NS_Emulation.NsvcTable containing omit value.", op_name);
case ANY_VALUE:
case ANY_OR_OMIT:
  min_size = 0;
  has_any_or_none = TRUE;
  break;
case VALUE_LIST:
{
  if (value_list.n_values<1)
    TTCN_error("Performing %sof() operation on a template of type @NS_Emulation.NsvcTable containing an empty list.", op_name);
  int item_size = value_list.list_value[0].size_of(is_size);
  for (unsigned int i = 1; i < value_list.n_values; i++) {
    if (value_list.list_value[i].size_of(is_size)!=item_size)
      TTCN_error("Performing %sof() operation on a template of type @NS_Emulation.NsvcTable containing a value list with different sizes.", op_name);
  }
  min_size = item_size;
  has_any_or_none = FALSE;
  break;
}
case COMPLEMENTED_LIST:
  TTCN_error("Performing %sof() operation on a template of type @NS_Emulation.NsvcTable containing complemented list.", op_name);
default:
  TTCN_error("Performing %sof() operation on an uninitialized/unsupported template of type @NS_Emulation.NsvcTable.", op_name);
}
return check_section_is_single(min_size, has_any_or_none, op_name, "a", "template of type @NS_Emulation.NsvcTable");
}

boolean NsvcTable_template::match(const NsvcTable& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
int value_length = other_value.size_of();
if (!match_length(value_length)) return FALSE;
switch (template_selection) {
case SPECIFIC_VALUE:
return match_record_of(&other_value, value_length, this, single_value.n_elements, match_function_specific, legacy);
case OMIT_VALUE:
return FALSE;
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching with an uninitialized/unsupported template of type @NS_Emulation.NsvcTable.");
}
return FALSE;
}

boolean NsvcTable_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++)
if (!single_value.value_elements[elem_count]->is_value()) return FALSE;
return TRUE;
}

NsvcTable NsvcTable_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 @NS_Emulation.NsvcTable.");
NsvcTable ret_val;
ret_val.set_size(single_value.n_elements);
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++)
if (single_value.value_elements[elem_count]->is_bound()) {
ret_val[elem_count] = single_value.value_elements[elem_count]->valueof();
}
return ret_val;
}

NsvcTable NsvcTable_template::substr(int index, int returncount) const
{
if (!is_value()) TTCN_error("The first argument of function substr() is a template with non-specific value.");
return valueof().substr(index, returncount);
}

NsvcTable NsvcTable_template::replace(int index, int len, const NsvcTable_template& repl) const
{
if (!is_value()) TTCN_error("The first argument of function replace() is a template with non-specific value.");
if (!repl.is_value()) TTCN_error("The fourth argument of function replace() is a template with non-specific value.");
return valueof().replace(index, len, repl.valueof());
}

NsvcTable NsvcTable_template::replace(int index, int len, const NsvcTable& repl) const
{
if (!is_value()) TTCN_error("The first argument of function replace() is a template with non-specific value.");
return valueof().replace(index, len, repl);
}

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

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

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

void NsvcTable_template::log_match(const NsvcTable& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
if(match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
}else{
if (template_selection == SPECIFIC_VALUE && single_value.n_elements > 0 && get_number_of_permutations() == 0 && single_value.n_elements == match_value.size_of()) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
if(!single_value.value_elements[elem_count]->match(match_value[elem_count], legacy)){
TTCN_Logger::log_logmatch_info("[%d]", elem_count);
single_value.value_elements[elem_count]->log_match(match_value[elem_count], legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
log_match_length(single_value.n_elements);
} else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE && single_value.n_elements > 0 && get_number_of_permutations() == 0 && single_value.n_elements == match_value.size_of()) {
TTCN_Logger::log_event_str("{ ");
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
if (elem_count > 0) TTCN_Logger::log_event_str(", ");
single_value.value_elements[elem_count]->log_match(match_value[elem_count], legacy);
}
TTCN_Logger::log_event_str(" }");
log_match_length(single_value.n_elements);
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

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

void NsvcTable_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_permutation(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value.n_elements = text_buf.pull_int().get_val();
if (single_value.n_elements < 0) TTCN_error("Text decoder: Negative size was received for a template of type @NS_Emulation.NsvcTable.");
single_value.value_elements = (NsvcTableEntry_template**)allocate_pointers(single_value.n_elements);
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
single_value.value_elements[elem_count] = new NsvcTableEntry_template;
single_value.value_elements[elem_count]->decode_text(text_buf);
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new NsvcTable_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of type @NS_Emulation.NsvcTable.");
}
}

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

boolean NsvcTable_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 NsvcTable_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
for (int i = 0; i < single_value.n_elements; i++) {
if (single_value.value_elements[i] != NULL) single_value.value_elements[i]->set_implicit_omit();
}
}

void NsvcTable_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE|Module_Param::BC_LIST, "record of template");
  switch (param.get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    NsvcTable_template temp;
    temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = temp;
    break; }
  case Module_Param::MP_Indexed_List:
    if (template_selection!=SPECIFIC_VALUE) set_size(0);
    for (size_t p_i=0; p_i<param.get_size(); ++p_i) {
      (*this)[(int)(param.get_elem(p_i)->get_id()->get_index())].set_param(*param.get_elem(p_i));
    }
    break;
  case Module_Param::MP_Value_List: {
    set_size(param.get_size());
    int curr_idx = 0;
    for (size_t p_i=0; p_i<param.get_size(); ++p_i) {
      switch (param.get_elem(p_i)->get_type()) {
      case Module_Param::MP_NotUsed:
        curr_idx++;
        break;
      case Module_Param::MP_Permutation_Template: {
        int perm_start_idx = curr_idx;
        Module_Param* param_i = param.get_elem(p_i);
        for (size_t perm_i=0; perm_i<param_i->get_size(); perm_i++) {
          (*this)[curr_idx].set_param(*(param_i->get_elem(perm_i)));
          curr_idx++;
        }
        int perm_end_idx = curr_idx - 1;
        add_permutation(perm_start_idx, perm_end_idx);
      } break;
      default:
        (*this)[curr_idx].set_param(*param.get_elem(p_i));
        curr_idx++;
      }
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    NsvcTable_template* precondition = new NsvcTable_template;
    precondition->set_param(*param.get_elem(0));
    NsvcTable_template* implied_template = new NsvcTable_template;
    implied_template->set_param(*param.get_elem(1));
    *this = NsvcTable_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record of template", "@NS_Emulation.NsvcTable");
  }
  is_ifpresent = param.get_ifpresent();
  set_length_range(param);
}

void NsvcTable_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
for (int i=0; i<single_value.n_elements; i++) single_value.value_elements[i]->check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NsvcTable");
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 : "@NS_Emulation.NsvcTable");
}

boolean NsvcTable_template::get_istemplate_kind(const char* type) const {
if (!strcmp(type, "AnyElement")) {
  if (template_selection != SPECIFIC_VALUE) {
    return FALSE;
  }
  for (int i = 0; i < single_value.n_elements; i++) {
    if (single_value.value_elements[i]->get_selection() == ANY_VALUE) {
      return TRUE;
    }
  }
  return FALSE;
} else if (!strcmp(type, "AnyElementsOrNone")) {
  if (template_selection != SPECIFIC_VALUE) {
    return FALSE;
  }
  for (int i = 0; i < single_value.n_elements; i++) {
    if (single_value.value_elements[i]->get_selection() == ANY_OR_OMIT) {
      return TRUE;
    }
  }
  return FALSE;
} else if (!strcmp(type, "permutation")) {
  return number_of_permutations;
} else if (!strcmp(type, "length")) {
  return length_restriction_type != NO_LENGTH_RESTRICTION;
} else {
  return Base_Template::get_istemplate_kind(type);
}
}
NsvcTableEntry::NsvcTableEntry()
{
}

NsvcTableEntry::NsvcTableEntry(const NSVCConfiguration& par_cfg,
    const COMPONENT& par_vc__conn,
    const NsvcState& par_state)
  :   field_cfg(par_cfg),
  field_vc__conn(par_vc__conn),
  field_state(par_state)
{
}

NsvcTableEntry::NsvcTableEntry(const NsvcTableEntry& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @NS_Emulation.NsvcTableEntry.");
if (other_value.cfg().is_bound()) field_cfg = other_value.cfg();
else field_cfg.clean_up();
if (other_value.vc__conn().is_bound()) field_vc__conn = other_value.vc__conn();
else field_vc__conn.clean_up();
if (other_value.state().is_bound()) field_state = other_value.state();
else field_state.clean_up();
}

void NsvcTableEntry::clean_up()
{
field_cfg.clean_up();
field_vc__conn.clean_up();
field_state.clean_up();
}

const TTCN_Typedescriptor_t* NsvcTableEntry::get_descriptor() const { return &NsvcTableEntry_descr_; }
NsvcTableEntry& NsvcTableEntry::operator=(const NsvcTableEntry& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @NS_Emulation.NsvcTableEntry.");
  if (other_value.cfg().is_bound()) field_cfg = other_value.cfg();
  else field_cfg.clean_up();
  if (other_value.vc__conn().is_bound()) field_vc__conn = other_value.vc__conn();
  else field_vc__conn.clean_up();
  if (other_value.state().is_bound()) field_state = other_value.state();
  else field_state.clean_up();
}
return *this;
}

boolean NsvcTableEntry::operator==(const NsvcTableEntry& other_value) const
{
return field_cfg==other_value.field_cfg
  && field_vc__conn==other_value.field_vc__conn
  && field_state==other_value.field_state;
}

boolean NsvcTableEntry::is_bound() const
{
return (field_cfg.is_bound())
  || (field_vc__conn.is_bound())
  || (field_state.is_bound());
}
boolean NsvcTableEntry::is_value() const
{
return field_cfg.is_value()
  && field_vc__conn.is_value()
  && field_state.is_value();
}
void NsvcTableEntry::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ cfg := ");
field_cfg.log();
TTCN_Logger::log_event_str(", vc_conn := ");
field_vc__conn.log();
TTCN_Logger::log_event_str(", state := ");
field_state.log();
TTCN_Logger::log_event_str(" }");
}

void NsvcTableEntry::set_implicit_omit()
{
if (cfg().is_bound()) cfg().set_implicit_omit();
if (vc__conn().is_bound()) vc__conn().set_implicit_omit();
if (state().is_bound()) state().set_implicit_omit();
}

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

void NsvcTableEntry::encode_text(Text_Buf& text_buf) const
{
field_cfg.encode_text(text_buf);
field_vc__conn.encode_text(text_buf);
field_state.encode_text(text_buf);
}

void NsvcTableEntry::decode_text(Text_Buf& text_buf)
{
field_cfg.decode_text(text_buf);
field_vc__conn.decode_text(text_buf);
field_state.decode_text(text_buf);
}

struct NsvcTableEntry_template::single_value_struct {
NSVCConfiguration_template field_cfg;
COMPONENT_template field_vc__conn;
NsvcState_template field_state;
};

void NsvcTableEntry_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_cfg = ANY_VALUE;
single_value->field_vc__conn = ANY_VALUE;
single_value->field_state = ANY_VALUE;
}
}
}

void NsvcTableEntry_template::copy_value(const NsvcTableEntry& other_value)
{
single_value = new single_value_struct;
if (other_value.cfg().is_bound()) {
  single_value->field_cfg = other_value.cfg();
} else {
  single_value->field_cfg.clean_up();
}
if (other_value.vc__conn().is_bound()) {
  single_value->field_vc__conn = other_value.vc__conn();
} else {
  single_value->field_vc__conn.clean_up();
}
if (other_value.state().is_bound()) {
  single_value->field_state = other_value.state();
} else {
  single_value->field_state.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void NsvcTableEntry_template::copy_template(const NsvcTableEntry_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.cfg().get_selection()) {
single_value->field_cfg = other_value.cfg();
} else {
single_value->field_cfg.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.vc__conn().get_selection()) {
single_value->field_vc__conn = other_value.vc__conn();
} else {
single_value->field_vc__conn.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.state().get_selection()) {
single_value->field_state = other_value.state();
} else {
single_value->field_state.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 NsvcTableEntry_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 NsvcTableEntry_template(*other_value.implication_.precondition);
implication_.implied_template = new NsvcTableEntry_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 @NS_Emulation.NsvcTableEntry.");
break;
}
set_selection(other_value);
}

NsvcTableEntry_template::NsvcTableEntry_template()
{
}

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

NsvcTableEntry_template::NsvcTableEntry_template(const NsvcTableEntry& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean NsvcTableEntry_template::match(const NsvcTableEntry& 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.cfg().is_bound()) return FALSE;
if(!single_value->field_cfg.match(other_value.cfg(), legacy))return FALSE;
if(!other_value.vc__conn().is_bound()) return FALSE;
if(!single_value->field_vc__conn.match(other_value.vc__conn(), legacy))return FALSE;
if(!other_value.state().is_bound()) return FALSE;
if(!single_value->field_state.match(other_value.state(), 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 @NS_Emulation.NsvcTableEntry.");
}
return FALSE;
}

boolean NsvcTableEntry_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_cfg.is_bound()
 || single_value->field_vc__conn.is_bound()
 || single_value->field_state.is_bound();
}

boolean NsvcTableEntry_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_cfg.is_value()
 && single_value->field_vc__conn.is_value()
 && single_value->field_state.is_value();
}

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

NsvcTableEntry NsvcTableEntry_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 @NS_Emulation.NsvcTableEntry.");
NsvcTableEntry ret_val;
if (single_value->field_cfg.is_bound()) {
ret_val.cfg() = single_value->field_cfg.valueof();
}
if (single_value->field_vc__conn.is_bound()) {
ret_val.vc__conn() = single_value->field_vc__conn.valueof();
}
if (single_value->field_state.is_bound()) {
ret_val.state() = single_value->field_state.valueof();
}
return ret_val;
}

void NsvcTableEntry_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 @NS_Emulation.NsvcTableEntry.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new NsvcTableEntry_template[list_length];
}

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

NSVCConfiguration_template& NsvcTableEntry_template::cfg()
{
set_specific();
return single_value->field_cfg;
}

const NSVCConfiguration_template& NsvcTableEntry_template::cfg() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field cfg of a non-specific template of type @NS_Emulation.NsvcTableEntry.");
return single_value->field_cfg;
}

COMPONENT_template& NsvcTableEntry_template::vc__conn()
{
set_specific();
return single_value->field_vc__conn;
}

const COMPONENT_template& NsvcTableEntry_template::vc__conn() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field vc_conn of a non-specific template of type @NS_Emulation.NsvcTableEntry.");
return single_value->field_vc__conn;
}

NsvcState_template& NsvcTableEntry_template::state()
{
set_specific();
return single_value->field_state;
}

const NsvcState_template& NsvcTableEntry_template::state() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field state of a non-specific template of type @NS_Emulation.NsvcTableEntry.");
return single_value->field_state;
}

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

void NsvcTableEntry_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ cfg := ");
single_value->field_cfg.log();
TTCN_Logger::log_event_str(", vc_conn := ");
single_value->field_vc__conn.log();
TTCN_Logger::log_event_str(", state := ");
single_value->field_state.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 NsvcTableEntry_template::log_match(const NsvcTableEntry& 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_cfg.match(match_value.cfg(), legacy)){
TTCN_Logger::log_logmatch_info(".cfg");
single_value->field_cfg.log_match(match_value.cfg(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_vc__conn.match(match_value.vc__conn(), legacy)){
TTCN_Logger::log_logmatch_info(".vc_conn");
single_value->field_vc__conn.log_match(match_value.vc__conn(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_state.match(match_value.state(), legacy)){
TTCN_Logger::log_logmatch_info(".state");
single_value->field_state.log_match(match_value.state(), 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("{ cfg := ");
single_value->field_cfg.log_match(match_value.cfg(), legacy);
TTCN_Logger::log_event_str(", vc_conn := ");
single_value->field_vc__conn.log_match(match_value.vc__conn(), legacy);
TTCN_Logger::log_event_str(", state := ");
single_value->field_state.log_match(match_value.state(), 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 NsvcTableEntry_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (cfg().is_bound()) cfg().set_implicit_omit();
if (vc__conn().is_bound()) vc__conn().set_implicit_omit();
if (state().is_bound()) state().set_implicit_omit();
}

void NsvcTableEntry_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_cfg.encode_text(text_buf);
single_value->field_vc__conn.encode_text(text_buf);
single_value->field_state.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 @NS_Emulation.NsvcTableEntry.");
}
}

void NsvcTableEntry_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_cfg.decode_text(text_buf);
single_value->field_vc__conn.decode_text(text_buf);
single_value->field_state.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 NsvcTableEntry_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 @NS_Emulation.NsvcTableEntry.");
}
}

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

void NsvcTableEntry_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_cfg.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NsvcTableEntry");
single_value->field_vc__conn.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NsvcTableEntry");
single_value->field_state.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.NsvcTableEntry");
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 : "@NS_Emulation.NsvcTableEntry");
}

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

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

void NSint__SP__PT::remove_msg_queue_head()
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
switch (my_head->item_selection) {
case MESSAGE_0:
delete (my_head)->message_0;
break;
case MESSAGE_1:
delete (my_head)->message_1;
break;
case MESSAGE_2:
delete (my_head)->message_2;
break;
default:
TTCN_error("Internal error: Invalid message selector in the queue of port %s.", port_name);
}
msg_queue_item_base *next_item = msg_queue_head->next_item;
delete (msg_queue_item*)msg_queue_head;
msg_queue_head = next_item;
if (next_item == NULL) msg_queue_tail = NULL;
TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::extract__msg, port_name, 0, ++msg_head_count, CHARSTRING(0,NULL), CHARSTRING(0,NULL));}

void NSint__SP__PT::clear_queue()
{
while (msg_queue_head != NULL) remove_msg_queue_head();
}

NSint__SP__PT::NSint__SP__PT(const char *par_port_name)
 : PORT(par_port_name)
{
msg_queue_head = NULL;
msg_queue_tail = NULL;
}

NSint__SP__PT::~NSint__SP__PT()
{
clear_queue();
}

void NSint__SP__PT::send(const NsUnitdataIndication& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name);
if (!destination_component.is_bound()) TTCN_error("Unbound component reference in the to clause of send operation.");
const TTCN_Logger::Severity log_sev = destination_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMSEND:TTCN_Logger::PORTEVENT_MCSEND;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_send(port_name, destination_component,
(TTCN_Logger::begin_event(log_sev, TRUE), TTCN_Logger::log_event_str(" @NS_Emulation.NsUnitdataIndication : "),
send_par.log(), TTCN_Logger::end_event_log2str()));
}
if (destination_component == SYSTEM_COMPREF) TTCN_error("Message cannot be sent to system on internal port %s.", port_name);
else {
Text_Buf text_buf;
prepare_message(text_buf, "@NS_Emulation.NsUnitdataIndication");
send_par.encode_text(text_buf);
send_data(text_buf, destination_component);
}
}

void NSint__SP__PT::send(const NsUnitdataIndication& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect)
{
for (size_t i = 0; i < nof_components; ++i) send(send_par, destination_components[i], timestamp_redirect);
}

void NSint__SP__PT::send(const NsUnitdataIndication& send_par, boolean broadcast, FLOAT* timestamp_redirect)
{
if (broadcast) {
if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name);
Text_Buf text_buf;
prepare_message(text_buf, "@NS_Emulation.NsUnitdataIndication");
send_par.encode_text(text_buf);
send_data_broadcast(text_buf, PORT::OMT_SEND, (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MCSEND, TRUE),
TTCN_Logger::log_event_str(" @NS_Emulation.NsUnitdataIndication : "), send_par.log(), TTCN_Logger::end_event_log2str()));
}
else send(send_par, COMPONENT(get_default_destination()), timestamp_redirect);
}

void NSint__SP__PT::send(const NsUnitdataIndication_template& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
const NsUnitdataIndication& send_par_value = NsUnitdataIndication(send_par.valueof());
send(send_par_value, destination_component, timestamp_redirect);
}

void NSint__SP__PT::send(const NsUnitdataIndication_template& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect)
{
const NsUnitdataIndication& send_par_value = NsUnitdataIndication(send_par.valueof());
send(send_par_value, nof_components, destination_components, timestamp_redirect);
}

void NSint__SP__PT::send(const NsUnitdataIndication_template& send_par, boolean broadcast, FLOAT* timestamp_redirect)
{
const NsUnitdataIndication& send_par_value = NsUnitdataIndication(send_par.valueof());
send(send_par_value, broadcast, timestamp_redirect);
}

void NSint__SP__PT::send(const SnsIndication& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name);
if (!destination_component.is_bound()) TTCN_error("Unbound component reference in the to clause of send operation.");
const TTCN_Logger::Severity log_sev = destination_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMSEND:TTCN_Logger::PORTEVENT_MCSEND;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_send(port_name, destination_component,
(TTCN_Logger::begin_event(log_sev, TRUE), TTCN_Logger::log_event_str(" @NS_Emulation.SnsIndication : "),
send_par.log(), TTCN_Logger::end_event_log2str()));
}
if (destination_component == SYSTEM_COMPREF) TTCN_error("Message cannot be sent to system on internal port %s.", port_name);
else {
Text_Buf text_buf;
prepare_message(text_buf, "@NS_Emulation.SnsIndication");
send_par.encode_text(text_buf);
send_data(text_buf, destination_component);
}
}

void NSint__SP__PT::send(const SnsIndication& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect)
{
for (size_t i = 0; i < nof_components; ++i) send(send_par, destination_components[i], timestamp_redirect);
}

void NSint__SP__PT::send(const SnsIndication& send_par, boolean broadcast, FLOAT* timestamp_redirect)
{
if (broadcast) {
if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name);
Text_Buf text_buf;
prepare_message(text_buf, "@NS_Emulation.SnsIndication");
send_par.encode_text(text_buf);
send_data_broadcast(text_buf, PORT::OMT_SEND, (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MCSEND, TRUE),
TTCN_Logger::log_event_str(" @NS_Emulation.SnsIndication : "), send_par.log(), TTCN_Logger::end_event_log2str()));
}
else send(send_par, COMPONENT(get_default_destination()), timestamp_redirect);
}

void NSint__SP__PT::send(const SnsIndication_template& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
const SnsIndication& send_par_value = SnsIndication(send_par.valueof());
send(send_par_value, destination_component, timestamp_redirect);
}

void NSint__SP__PT::send(const SnsIndication_template& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect)
{
const SnsIndication& send_par_value = SnsIndication(send_par.valueof());
send(send_par_value, nof_components, destination_components, timestamp_redirect);
}

void NSint__SP__PT::send(const SnsIndication_template& send_par, boolean broadcast, FLOAT* timestamp_redirect)
{
const SnsIndication& send_par_value = SnsIndication(send_par.valueof());
send(send_par_value, broadcast, timestamp_redirect);
}

void NSint__SP__PT::send(const NsStatusIndication& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name);
if (!destination_component.is_bound()) TTCN_error("Unbound component reference in the to clause of send operation.");
const TTCN_Logger::Severity log_sev = destination_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMSEND:TTCN_Logger::PORTEVENT_MCSEND;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_send(port_name, destination_component,
(TTCN_Logger::begin_event(log_sev, TRUE), TTCN_Logger::log_event_str(" @NS_Emulation.NsStatusIndication : "),
send_par.log(), TTCN_Logger::end_event_log2str()));
}
if (destination_component == SYSTEM_COMPREF) TTCN_error("Message cannot be sent to system on internal port %s.", port_name);
else {
Text_Buf text_buf;
prepare_message(text_buf, "@NS_Emulation.NsStatusIndication");
send_par.encode_text(text_buf);
send_data(text_buf, destination_component);
}
}

void NSint__SP__PT::send(const NsStatusIndication& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect)
{
for (size_t i = 0; i < nof_components; ++i) send(send_par, destination_components[i], timestamp_redirect);
}

void NSint__SP__PT::send(const NsStatusIndication& send_par, boolean broadcast, FLOAT* timestamp_redirect)
{
if (broadcast) {
if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name);
Text_Buf text_buf;
prepare_message(text_buf, "@NS_Emulation.NsStatusIndication");
send_par.encode_text(text_buf);
send_data_broadcast(text_buf, PORT::OMT_SEND, (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MCSEND, TRUE),
TTCN_Logger::log_event_str(" @NS_Emulation.NsStatusIndication : "), send_par.log(), TTCN_Logger::end_event_log2str()));
}
else send(send_par, COMPONENT(get_default_destination()), timestamp_redirect);
}

void NSint__SP__PT::send(const NsStatusIndication_template& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
const NsStatusIndication& send_par_value = NsStatusIndication(send_par.valueof());
send(send_par_value, destination_component, timestamp_redirect);
}

void NSint__SP__PT::send(const NsStatusIndication_template& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect)
{
const NsStatusIndication& send_par_value = NsStatusIndication(send_par.valueof());
send(send_par_value, nof_components, destination_components, timestamp_redirect);
}

void NSint__SP__PT::send(const NsStatusIndication_template& send_par, boolean broadcast, FLOAT* timestamp_redirect)
{
const NsStatusIndication& send_par_value = NsStatusIndication(send_par.valueof());
send(send_par_value, broadcast, timestamp_redirect);
}

alt_status NSint__SP__PT::receive(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else {
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS, "Matching on port %s succeeded.", port_name);
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
switch (my_head->item_selection) {
case MESSAGE_0:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsUnitdataRequest: "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
case MESSAGE_1:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.SnsRequest: "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
case MESSAGE_2:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsCtrlRequest: "),
my_head->message_2->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
default:
TTCN_error("Internal error: unknown message");
}
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NSint__SP__PT::check_receive(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else {
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS, "Matching on port %s succeeded.", port_name);
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
switch (my_head->item_selection) {
case MESSAGE_0:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsUnitdataRequest: "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
case MESSAGE_1:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.SnsRequest: "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
case MESSAGE_2:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsCtrlRequest: "),
my_head->message_2->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
default:
TTCN_error("Internal error: unknown message");
}
}
return ALT_YES;
}
}

alt_status NSint__SP__PT::trigger(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s will drop a message: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
remove_msg_queue_head();
return ALT_REPEAT;
} else {
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS, "Matching on port %s succeeded.", port_name);
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
switch (my_head->item_selection) {
case MESSAGE_0:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsUnitdataRequest: "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
case MESSAGE_1:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.SnsRequest: "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
case MESSAGE_2:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsCtrlRequest: "),
my_head->message_2->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
default:
TTCN_error("Internal error: unknown message");
}
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NSint__SP__PT::receive(const NsUnitdataRequest_template& value_template, NsUnitdataRequest *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_0) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @NS_Emulation.NsUnitdataRequest.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_0)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_0;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsUnitdataRequest : "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NSint__SP__PT::check_receive(const NsUnitdataRequest_template& value_template, NsUnitdataRequest *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Check-receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_0) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @NS_Emulation.NsUnitdataRequest.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_0)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_0;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsUnitdataRequest : "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
return ALT_YES;
}
}

alt_status NSint__SP__PT::trigger(const NsUnitdataRequest_template& value_template, NsUnitdataRequest *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Trigger operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s will drop a message: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
remove_msg_queue_head();
return ALT_REPEAT;
} else if (my_head->item_selection != MESSAGE_0) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s will drop a message: Type of the first message in the queue is not @NS_Emulation.NsUnitdataRequest.", port_name);
remove_msg_queue_head();
return ALT_REPEAT;
} else if (!value_template.match(*my_head->message_0)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
remove_msg_queue_head();
return ALT_REPEAT;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_0;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsUnitdataRequest : "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NSint__SP__PT::receive(const SnsRequest_template& value_template, SnsRequest *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_1) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @NS_Emulation.SnsRequest.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_1)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_1;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.SnsRequest : "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NSint__SP__PT::check_receive(const SnsRequest_template& value_template, SnsRequest *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Check-receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_1) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @NS_Emulation.SnsRequest.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_1)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_1;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.SnsRequest : "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
return ALT_YES;
}
}

alt_status NSint__SP__PT::trigger(const SnsRequest_template& value_template, SnsRequest *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Trigger operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s will drop a message: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
remove_msg_queue_head();
return ALT_REPEAT;
} else if (my_head->item_selection != MESSAGE_1) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s will drop a message: Type of the first message in the queue is not @NS_Emulation.SnsRequest.", port_name);
remove_msg_queue_head();
return ALT_REPEAT;
} else if (!value_template.match(*my_head->message_1)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
remove_msg_queue_head();
return ALT_REPEAT;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_1;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.SnsRequest : "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NSint__SP__PT::receive(const NsCtrlRequest_template& value_template, NsCtrlRequest *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_2) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @NS_Emulation.NsCtrlRequest.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_2)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_2),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_2;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_2),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsCtrlRequest : "),
my_head->message_2->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NSint__SP__PT::check_receive(const NsCtrlRequest_template& value_template, NsCtrlRequest *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Check-receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_2) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @NS_Emulation.NsCtrlRequest.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_2)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_2),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_2;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_2),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsCtrlRequest : "),
my_head->message_2->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
return ALT_YES;
}
}

alt_status NSint__SP__PT::trigger(const NsCtrlRequest_template& value_template, NsCtrlRequest *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Trigger operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s will drop a message: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
remove_msg_queue_head();
return ALT_REPEAT;
} else if (my_head->item_selection != MESSAGE_2) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s will drop a message: Type of the first message in the queue is not @NS_Emulation.NsCtrlRequest.", port_name);
remove_msg_queue_head();
return ALT_REPEAT;
} else if (!value_template.match(*my_head->message_2)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_2),
 TTCN_Logger::end_event_log2str()));
}
remove_msg_queue_head();
return ALT_REPEAT;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_2;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_2),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsCtrlRequest : "),
my_head->message_2->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

void NSint__SP__PT::incoming_message(const NsUnitdataRequest& incoming_par, component sender_component)
{
if (!is_started) {
if (is_halted) {
TTCN_warning("A message that arrived on port %s has been discarded, because the port is not started.", port_name);
return;
}
else {
TTCN_error("Port %s is not started but a message has arrived on it.", port_name);
}
}
msg_tail_count++;
if (TTCN_Logger::log_this_event(TTCN_Logger::PORTEVENT_MQUEUE)) {
TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::enqueue__msg, port_name, sender_component, msg_tail_count,
CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MQUEUE, TRUE), TTCN_Logger::log_event_str(" @NS_Emulation.NsUnitdataRequest : "), incoming_par.log(), TTCN_Logger::end_event_log2str()));
}
msg_queue_item *new_item = new msg_queue_item;
new_item->item_selection = MESSAGE_0;
new_item->message_0 = new NsUnitdataRequest(incoming_par);
new_item->sender_component = sender_component;
append_to_msg_queue(new_item);
}

void NSint__SP__PT::incoming_message(const SnsRequest& incoming_par, component sender_component)
{
if (!is_started) {
if (is_halted) {
TTCN_warning("A message that arrived on port %s has been discarded, because the port is not started.", port_name);
return;
}
else {
TTCN_error("Port %s is not started but a message has arrived on it.", port_name);
}
}
msg_tail_count++;
if (TTCN_Logger::log_this_event(TTCN_Logger::PORTEVENT_MQUEUE)) {
TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::enqueue__msg, port_name, sender_component, msg_tail_count,
CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MQUEUE, TRUE), TTCN_Logger::log_event_str(" @NS_Emulation.SnsRequest : "), incoming_par.log(), TTCN_Logger::end_event_log2str()));
}
msg_queue_item *new_item = new msg_queue_item;
new_item->item_selection = MESSAGE_1;
new_item->message_1 = new SnsRequest(incoming_par);
new_item->sender_component = sender_component;
append_to_msg_queue(new_item);
}

void NSint__SP__PT::incoming_message(const NsCtrlRequest& incoming_par, component sender_component)
{
if (!is_started) {
if (is_halted) {
TTCN_warning("A message that arrived on port %s has been discarded, because the port is not started.", port_name);
return;
}
else {
TTCN_error("Port %s is not started but a message has arrived on it.", port_name);
}
}
msg_tail_count++;
if (TTCN_Logger::log_this_event(TTCN_Logger::PORTEVENT_MQUEUE)) {
TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::enqueue__msg, port_name, sender_component, msg_tail_count,
CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MQUEUE, TRUE), TTCN_Logger::log_event_str(" @NS_Emulation.NsCtrlRequest : "), incoming_par.log(), TTCN_Logger::end_event_log2str()));
}
msg_queue_item *new_item = new msg_queue_item;
new_item->item_selection = MESSAGE_2;
new_item->message_2 = new NsCtrlRequest(incoming_par);
new_item->sender_component = sender_component;
append_to_msg_queue(new_item);
}

boolean NSint__SP__PT::process_message(const char *message_type, Text_Buf& incoming_buf, component sender_component, OCTETSTRING&)
{
if (!strcmp(message_type, "@NS_Emulation.NsUnitdataRequest")) {
NsUnitdataRequest incoming_par;
incoming_par.decode_text(incoming_buf);
incoming_message(incoming_par, sender_component);
return TRUE;
} else if (!strcmp(message_type, "@NS_Emulation.SnsRequest")) {
SnsRequest incoming_par;
incoming_par.decode_text(incoming_buf);
incoming_message(incoming_par, sender_component);
return TRUE;
} else if (!strcmp(message_type, "@NS_Emulation.NsCtrlRequest")) {
NsCtrlRequest incoming_par;
incoming_par.decode_text(incoming_buf);
incoming_message(incoming_par, sender_component);
return TRUE;
} else return FALSE;
}

void NSint__PT::remove_msg_queue_head()
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
switch (my_head->item_selection) {
case MESSAGE_0:
delete (my_head)->message_0;
break;
case MESSAGE_1:
delete (my_head)->message_1;
break;
case MESSAGE_2:
delete (my_head)->message_2;
break;
case MESSAGE_3:
delete (my_head)->message_3;
break;
default:
TTCN_error("Internal error: Invalid message selector in the queue of port %s.", port_name);
}
msg_queue_item_base *next_item = msg_queue_head->next_item;
delete (msg_queue_item*)msg_queue_head;
msg_queue_head = next_item;
if (next_item == NULL) msg_queue_tail = NULL;
TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::extract__msg, port_name, 0, ++msg_head_count, CHARSTRING(0,NULL), CHARSTRING(0,NULL));}

void NSint__PT::clear_queue()
{
while (msg_queue_head != NULL) remove_msg_queue_head();
}

NSint__PT::NSint__PT(const char *par_port_name)
 : PORT(par_port_name)
{
msg_queue_head = NULL;
msg_queue_tail = NULL;
}

NSint__PT::~NSint__PT()
{
clear_queue();
}

void NSint__PT::send(const NsUnitdataRequest& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name);
if (!destination_component.is_bound()) TTCN_error("Unbound component reference in the to clause of send operation.");
const TTCN_Logger::Severity log_sev = destination_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMSEND:TTCN_Logger::PORTEVENT_MCSEND;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_send(port_name, destination_component,
(TTCN_Logger::begin_event(log_sev, TRUE), TTCN_Logger::log_event_str(" @NS_Emulation.NsUnitdataRequest : "),
send_par.log(), TTCN_Logger::end_event_log2str()));
}
if (destination_component == SYSTEM_COMPREF) TTCN_error("Message cannot be sent to system on internal port %s.", port_name);
else {
Text_Buf text_buf;
prepare_message(text_buf, "@NS_Emulation.NsUnitdataRequest");
send_par.encode_text(text_buf);
send_data(text_buf, destination_component);
}
}

void NSint__PT::send(const NsUnitdataRequest& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect)
{
for (size_t i = 0; i < nof_components; ++i) send(send_par, destination_components[i], timestamp_redirect);
}

void NSint__PT::send(const NsUnitdataRequest& send_par, boolean broadcast, FLOAT* timestamp_redirect)
{
if (broadcast) {
if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name);
Text_Buf text_buf;
prepare_message(text_buf, "@NS_Emulation.NsUnitdataRequest");
send_par.encode_text(text_buf);
send_data_broadcast(text_buf, PORT::OMT_SEND, (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MCSEND, TRUE),
TTCN_Logger::log_event_str(" @NS_Emulation.NsUnitdataRequest : "), send_par.log(), TTCN_Logger::end_event_log2str()));
}
else send(send_par, COMPONENT(get_default_destination()), timestamp_redirect);
}

void NSint__PT::send(const NsUnitdataRequest_template& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
const NsUnitdataRequest& send_par_value = NsUnitdataRequest(send_par.valueof());
send(send_par_value, destination_component, timestamp_redirect);
}

void NSint__PT::send(const NsUnitdataRequest_template& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect)
{
const NsUnitdataRequest& send_par_value = NsUnitdataRequest(send_par.valueof());
send(send_par_value, nof_components, destination_components, timestamp_redirect);
}

void NSint__PT::send(const NsUnitdataRequest_template& send_par, boolean broadcast, FLOAT* timestamp_redirect)
{
const NsUnitdataRequest& send_par_value = NsUnitdataRequest(send_par.valueof());
send(send_par_value, broadcast, timestamp_redirect);
}

void NSint__PT::send(const SnsRequest& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name);
if (!destination_component.is_bound()) TTCN_error("Unbound component reference in the to clause of send operation.");
const TTCN_Logger::Severity log_sev = destination_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMSEND:TTCN_Logger::PORTEVENT_MCSEND;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_send(port_name, destination_component,
(TTCN_Logger::begin_event(log_sev, TRUE), TTCN_Logger::log_event_str(" @NS_Emulation.SnsRequest : "),
send_par.log(), TTCN_Logger::end_event_log2str()));
}
if (destination_component == SYSTEM_COMPREF) TTCN_error("Message cannot be sent to system on internal port %s.", port_name);
else {
Text_Buf text_buf;
prepare_message(text_buf, "@NS_Emulation.SnsRequest");
send_par.encode_text(text_buf);
send_data(text_buf, destination_component);
}
}

void NSint__PT::send(const SnsRequest& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect)
{
for (size_t i = 0; i < nof_components; ++i) send(send_par, destination_components[i], timestamp_redirect);
}

void NSint__PT::send(const SnsRequest& send_par, boolean broadcast, FLOAT* timestamp_redirect)
{
if (broadcast) {
if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name);
Text_Buf text_buf;
prepare_message(text_buf, "@NS_Emulation.SnsRequest");
send_par.encode_text(text_buf);
send_data_broadcast(text_buf, PORT::OMT_SEND, (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MCSEND, TRUE),
TTCN_Logger::log_event_str(" @NS_Emulation.SnsRequest : "), send_par.log(), TTCN_Logger::end_event_log2str()));
}
else send(send_par, COMPONENT(get_default_destination()), timestamp_redirect);
}

void NSint__PT::send(const SnsRequest_template& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
const SnsRequest& send_par_value = SnsRequest(send_par.valueof());
send(send_par_value, destination_component, timestamp_redirect);
}

void NSint__PT::send(const SnsRequest_template& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect)
{
const SnsRequest& send_par_value = SnsRequest(send_par.valueof());
send(send_par_value, nof_components, destination_components, timestamp_redirect);
}

void NSint__PT::send(const SnsRequest_template& send_par, boolean broadcast, FLOAT* timestamp_redirect)
{
const SnsRequest& send_par_value = SnsRequest(send_par.valueof());
send(send_par_value, broadcast, timestamp_redirect);
}

void NSint__PT::send(const NsCtrlRequest& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name);
if (!destination_component.is_bound()) TTCN_error("Unbound component reference in the to clause of send operation.");
const TTCN_Logger::Severity log_sev = destination_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMSEND:TTCN_Logger::PORTEVENT_MCSEND;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_send(port_name, destination_component,
(TTCN_Logger::begin_event(log_sev, TRUE), TTCN_Logger::log_event_str(" @NS_Emulation.NsCtrlRequest : "),
send_par.log(), TTCN_Logger::end_event_log2str()));
}
if (destination_component == SYSTEM_COMPREF) TTCN_error("Message cannot be sent to system on internal port %s.", port_name);
else {
Text_Buf text_buf;
prepare_message(text_buf, "@NS_Emulation.NsCtrlRequest");
send_par.encode_text(text_buf);
send_data(text_buf, destination_component);
}
}

void NSint__PT::send(const NsCtrlRequest& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect)
{
for (size_t i = 0; i < nof_components; ++i) send(send_par, destination_components[i], timestamp_redirect);
}

void NSint__PT::send(const NsCtrlRequest& send_par, boolean broadcast, FLOAT* timestamp_redirect)
{
if (broadcast) {
if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name);
Text_Buf text_buf;
prepare_message(text_buf, "@NS_Emulation.NsCtrlRequest");
send_par.encode_text(text_buf);
send_data_broadcast(text_buf, PORT::OMT_SEND, (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MCSEND, TRUE),
TTCN_Logger::log_event_str(" @NS_Emulation.NsCtrlRequest : "), send_par.log(), TTCN_Logger::end_event_log2str()));
}
else send(send_par, COMPONENT(get_default_destination()), timestamp_redirect);
}

void NSint__PT::send(const NsCtrlRequest_template& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
const NsCtrlRequest& send_par_value = NsCtrlRequest(send_par.valueof());
send(send_par_value, destination_component, timestamp_redirect);
}

void NSint__PT::send(const NsCtrlRequest_template& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect)
{
const NsCtrlRequest& send_par_value = NsCtrlRequest(send_par.valueof());
send(send_par_value, nof_components, destination_components, timestamp_redirect);
}

void NSint__PT::send(const NsCtrlRequest_template& send_par, boolean broadcast, FLOAT* timestamp_redirect)
{
const NsCtrlRequest& send_par_value = NsCtrlRequest(send_par.valueof());
send(send_par_value, broadcast, timestamp_redirect);
}

alt_status NSint__PT::receive(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else {
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS, "Matching on port %s succeeded.", port_name);
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
switch (my_head->item_selection) {
case MESSAGE_0:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @Socket_API_Definitions.PortEvent: "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
case MESSAGE_1:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsStatusIndication: "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
case MESSAGE_2:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.SnsIndication: "),
my_head->message_2->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
case MESSAGE_3:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsUnitdataIndication: "),
my_head->message_3->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
default:
TTCN_error("Internal error: unknown message");
}
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NSint__PT::check_receive(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else {
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS, "Matching on port %s succeeded.", port_name);
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
switch (my_head->item_selection) {
case MESSAGE_0:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @Socket_API_Definitions.PortEvent: "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
case MESSAGE_1:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsStatusIndication: "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
case MESSAGE_2:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.SnsIndication: "),
my_head->message_2->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
case MESSAGE_3:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsUnitdataIndication: "),
my_head->message_3->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
default:
TTCN_error("Internal error: unknown message");
}
}
return ALT_YES;
}
}

alt_status NSint__PT::trigger(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s will drop a message: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
remove_msg_queue_head();
return ALT_REPEAT;
} else {
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS, "Matching on port %s succeeded.", port_name);
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
switch (my_head->item_selection) {
case MESSAGE_0:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @Socket_API_Definitions.PortEvent: "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
case MESSAGE_1:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsStatusIndication: "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
case MESSAGE_2:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.SnsIndication: "),
my_head->message_2->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
case MESSAGE_3:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsUnitdataIndication: "),
my_head->message_3->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
default:
TTCN_error("Internal error: unknown message");
}
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NSint__PT::receive(const Socket__API__Definitions::PortEvent_template& value_template, Socket__API__Definitions::PortEvent *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_0) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @Socket_API_Definitions.PortEvent.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_0)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_0;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @Socket_API_Definitions.PortEvent : "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NSint__PT::check_receive(const Socket__API__Definitions::PortEvent_template& value_template, Socket__API__Definitions::PortEvent *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Check-receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_0) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @Socket_API_Definitions.PortEvent.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_0)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_0;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @Socket_API_Definitions.PortEvent : "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
return ALT_YES;
}
}

alt_status NSint__PT::trigger(const Socket__API__Definitions::PortEvent_template& value_template, Socket__API__Definitions::PortEvent *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Trigger operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s will drop a message: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
remove_msg_queue_head();
return ALT_REPEAT;
} else if (my_head->item_selection != MESSAGE_0) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s will drop a message: Type of the first message in the queue is not @Socket_API_Definitions.PortEvent.", port_name);
remove_msg_queue_head();
return ALT_REPEAT;
} else if (!value_template.match(*my_head->message_0)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
remove_msg_queue_head();
return ALT_REPEAT;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_0;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @Socket_API_Definitions.PortEvent : "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NSint__PT::receive(const NsStatusIndication_template& value_template, NsStatusIndication *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_1) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @NS_Emulation.NsStatusIndication.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_1)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_1;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsStatusIndication : "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NSint__PT::check_receive(const NsStatusIndication_template& value_template, NsStatusIndication *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Check-receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_1) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @NS_Emulation.NsStatusIndication.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_1)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_1;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsStatusIndication : "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
return ALT_YES;
}
}

alt_status NSint__PT::trigger(const NsStatusIndication_template& value_template, NsStatusIndication *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Trigger operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s will drop a message: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
remove_msg_queue_head();
return ALT_REPEAT;
} else if (my_head->item_selection != MESSAGE_1) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s will drop a message: Type of the first message in the queue is not @NS_Emulation.NsStatusIndication.", port_name);
remove_msg_queue_head();
return ALT_REPEAT;
} else if (!value_template.match(*my_head->message_1)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
remove_msg_queue_head();
return ALT_REPEAT;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_1;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsStatusIndication : "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NSint__PT::receive(const SnsIndication_template& value_template, SnsIndication *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_2) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @NS_Emulation.SnsIndication.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_2)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_2),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_2;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_2),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.SnsIndication : "),
my_head->message_2->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NSint__PT::check_receive(const SnsIndication_template& value_template, SnsIndication *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Check-receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_2) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @NS_Emulation.SnsIndication.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_2)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_2),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_2;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_2),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.SnsIndication : "),
my_head->message_2->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
return ALT_YES;
}
}

alt_status NSint__PT::trigger(const SnsIndication_template& value_template, SnsIndication *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Trigger operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s will drop a message: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
remove_msg_queue_head();
return ALT_REPEAT;
} else if (my_head->item_selection != MESSAGE_2) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s will drop a message: Type of the first message in the queue is not @NS_Emulation.SnsIndication.", port_name);
remove_msg_queue_head();
return ALT_REPEAT;
} else if (!value_template.match(*my_head->message_2)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_2),
 TTCN_Logger::end_event_log2str()));
}
remove_msg_queue_head();
return ALT_REPEAT;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_2;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_2),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.SnsIndication : "),
my_head->message_2->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NSint__PT::receive(const NsUnitdataIndication_template& value_template, NsUnitdataIndication *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_3) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @NS_Emulation.NsUnitdataIndication.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_3)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_3),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_3;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_3),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsUnitdataIndication : "),
my_head->message_3->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status NSint__PT::check_receive(const NsUnitdataIndication_template& value_template, NsUnitdataIndication *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Check-receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_3) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @NS_Emulation.NsUnitdataIndication.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_3)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_3),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_3;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_3),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsUnitdataIndication : "),
my_head->message_3->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
return ALT_YES;
}
}

alt_status NSint__PT::trigger(const NsUnitdataIndication_template& value_template, NsUnitdataIndication *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Trigger operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s will drop a message: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
remove_msg_queue_head();
return ALT_REPEAT;
} else if (my_head->item_selection != MESSAGE_3) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s will drop a message: Type of the first message in the queue is not @NS_Emulation.NsUnitdataIndication.", port_name);
remove_msg_queue_head();
return ALT_REPEAT;
} else if (!value_template.match(*my_head->message_3)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_3),
 TTCN_Logger::end_event_log2str()));
}
remove_msg_queue_head();
return ALT_REPEAT;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_3;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_3),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @NS_Emulation.NsUnitdataIndication : "),
my_head->message_3->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

void NSint__PT::incoming_message(const Socket__API__Definitions::PortEvent& incoming_par, component sender_component)
{
if (!is_started) {
if (is_halted) {
TTCN_warning("A message that arrived on port %s has been discarded, because the port is not started.", port_name);
return;
}
else {
TTCN_error("Port %s is not started but a message has arrived on it.", port_name);
}
}
msg_tail_count++;
if (TTCN_Logger::log_this_event(TTCN_Logger::PORTEVENT_MQUEUE)) {
TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::enqueue__msg, port_name, sender_component, msg_tail_count,
CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MQUEUE, TRUE), TTCN_Logger::log_event_str(" @Socket_API_Definitions.PortEvent : "), incoming_par.log(), TTCN_Logger::end_event_log2str()));
}
msg_queue_item *new_item = new msg_queue_item;
new_item->item_selection = MESSAGE_0;
new_item->message_0 = new Socket__API__Definitions::PortEvent(incoming_par);
new_item->sender_component = sender_component;
append_to_msg_queue(new_item);
}

void NSint__PT::incoming_message(const NsStatusIndication& incoming_par, component sender_component)
{
if (!is_started) {
if (is_halted) {
TTCN_warning("A message that arrived on port %s has been discarded, because the port is not started.", port_name);
return;
}
else {
TTCN_error("Port %s is not started but a message has arrived on it.", port_name);
}
}
msg_tail_count++;
if (TTCN_Logger::log_this_event(TTCN_Logger::PORTEVENT_MQUEUE)) {
TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::enqueue__msg, port_name, sender_component, msg_tail_count,
CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MQUEUE, TRUE), TTCN_Logger::log_event_str(" @NS_Emulation.NsStatusIndication : "), incoming_par.log(), TTCN_Logger::end_event_log2str()));
}
msg_queue_item *new_item = new msg_queue_item;
new_item->item_selection = MESSAGE_1;
new_item->message_1 = new NsStatusIndication(incoming_par);
new_item->sender_component = sender_component;
append_to_msg_queue(new_item);
}

void NSint__PT::incoming_message(const SnsIndication& incoming_par, component sender_component)
{
if (!is_started) {
if (is_halted) {
TTCN_warning("A message that arrived on port %s has been discarded, because the port is not started.", port_name);
return;
}
else {
TTCN_error("Port %s is not started but a message has arrived on it.", port_name);
}
}
msg_tail_count++;
if (TTCN_Logger::log_this_event(TTCN_Logger::PORTEVENT_MQUEUE)) {
TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::enqueue__msg, port_name, sender_component, msg_tail_count,
CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MQUEUE, TRUE), TTCN_Logger::log_event_str(" @NS_Emulation.SnsIndication : "), incoming_par.log(), TTCN_Logger::end_event_log2str()));
}
msg_queue_item *new_item = new msg_queue_item;
new_item->item_selection = MESSAGE_2;
new_item->message_2 = new SnsIndication(incoming_par);
new_item->sender_component = sender_component;
append_to_msg_queue(new_item);
}

void NSint__PT::incoming_message(const NsUnitdataIndication& incoming_par, component sender_component)
{
if (!is_started) {
if (is_halted) {
TTCN_warning("A message that arrived on port %s has been discarded, because the port is not started.", port_name);
return;
}
else {
TTCN_error("Port %s is not started but a message has arrived on it.", port_name);
}
}
msg_tail_count++;
if (TTCN_Logger::log_this_event(TTCN_Logger::PORTEVENT_MQUEUE)) {
TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::enqueue__msg, port_name, sender_component, msg_tail_count,
CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MQUEUE, TRUE), TTCN_Logger::log_event_str(" @NS_Emulation.NsUnitdataIndication : "), incoming_par.log(), TTCN_Logger::end_event_log2str()));
}
msg_queue_item *new_item = new msg_queue_item;
new_item->item_selection = MESSAGE_3;
new_item->message_3 = new NsUnitdataIndication(incoming_par);
new_item->sender_component = sender_component;
append_to_msg_queue(new_item);
}

boolean NSint__PT::process_message(const char *message_type, Text_Buf& incoming_buf, component sender_component, OCTETSTRING&)
{
if (!strcmp(message_type, "@Socket_API_Definitions.PortEvent")) {
Socket__API__Definitions::PortEvent incoming_par;
incoming_par.decode_text(incoming_buf);
incoming_message(incoming_par, sender_component);
return TRUE;
} else if (!strcmp(message_type, "@NS_Emulation.NsStatusIndication")) {
NsStatusIndication incoming_par;
incoming_par.decode_text(incoming_buf);
incoming_message(incoming_par, sender_component);
return TRUE;
} else if (!strcmp(message_type, "@NS_Emulation.SnsIndication")) {
SnsIndication incoming_par;
incoming_par.decode_text(incoming_buf);
incoming_message(incoming_par, sender_component);
return TRUE;
} else if (!strcmp(message_type, "@NS_Emulation.NsUnitdataIndication")) {
NsUnitdataIndication incoming_par;
incoming_par.decode_text(incoming_buf);
incoming_message(incoming_par, sender_component);
return TRUE;
} else return FALSE;
}

SnsIndication::SnsIndication()
{
}

SnsIndication::SnsIndication(const INTEGER& par_nsvci,
    const NS__Types::PDU__NS& par_ns)
  :   field_nsvci(par_nsvci),
  field_ns(par_ns)
{
}

SnsIndication::SnsIndication(const SnsIndication& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @NS_Emulation.SnsIndication.");
if (other_value.nsvci().is_bound()) field_nsvci = other_value.nsvci();
else field_nsvci.clean_up();
if (other_value.ns().is_bound()) field_ns = other_value.ns();
else field_ns.clean_up();
}

void SnsIndication::clean_up()
{
field_nsvci.clean_up();
field_ns.clean_up();
}

const TTCN_Typedescriptor_t* SnsIndication::get_descriptor() const { return &SnsIndication_descr_; }
SnsIndication& SnsIndication::operator=(const SnsIndication& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @NS_Emulation.SnsIndication.");
  if (other_value.nsvci().is_bound()) field_nsvci = other_value.nsvci();
  else field_nsvci.clean_up();
  if (other_value.ns().is_bound()) field_ns = other_value.ns();
  else field_ns.clean_up();
}
return *this;
}

boolean SnsIndication::operator==(const SnsIndication& other_value) const
{
return field_nsvci==other_value.field_nsvci
  && field_ns==other_value.field_ns;
}

boolean SnsIndication::is_bound() const
{
return (field_nsvci.is_bound())
  || (field_ns.is_bound());
}
boolean SnsIndication::is_value() const
{
return field_nsvci.is_value()
  && field_ns.is_value();
}
void SnsIndication::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ nsvci := ");
field_nsvci.log();
TTCN_Logger::log_event_str(", ns := ");
field_ns.log();
TTCN_Logger::log_event_str(" }");
}

void SnsIndication::set_implicit_omit()
{
if (nsvci().is_bound()) nsvci().set_implicit_omit();
if (ns().is_bound()) ns().set_implicit_omit();
}

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

void SnsIndication::encode_text(Text_Buf& text_buf) const
{
field_nsvci.encode_text(text_buf);
field_ns.encode_text(text_buf);
}

void SnsIndication::decode_text(Text_Buf& text_buf)
{
field_nsvci.decode_text(text_buf);
field_ns.decode_text(text_buf);
}

struct SnsIndication_template::single_value_struct {
INTEGER_template field_nsvci;
NS__Types::PDU__NS_template field_ns;
};

void SnsIndication_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_nsvci = ANY_VALUE;
single_value->field_ns = ANY_VALUE;
}
}
}

void SnsIndication_template::copy_value(const SnsIndication& other_value)
{
single_value = new single_value_struct;
if (other_value.nsvci().is_bound()) {
  single_value->field_nsvci = other_value.nsvci();
} else {
  single_value->field_nsvci.clean_up();
}
if (other_value.ns().is_bound()) {
  single_value->field_ns = other_value.ns();
} else {
  single_value->field_ns.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void SnsIndication_template::copy_template(const SnsIndication_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.nsvci().get_selection()) {
single_value->field_nsvci = other_value.nsvci();
} else {
single_value->field_nsvci.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ns().get_selection()) {
single_value->field_ns = other_value.ns();
} else {
single_value->field_ns.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 SnsIndication_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 SnsIndication_template(*other_value.implication_.precondition);
implication_.implied_template = new SnsIndication_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 @NS_Emulation.SnsIndication.");
break;
}
set_selection(other_value);
}

SnsIndication_template::SnsIndication_template()
{
}

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

SnsIndication_template::SnsIndication_template(const SnsIndication& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean SnsIndication_template::match(const SnsIndication& 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.nsvci().is_bound()) return FALSE;
if(!single_value->field_nsvci.match(other_value.nsvci(), legacy))return FALSE;
if(!other_value.ns().is_bound()) return FALSE;
if(!single_value->field_ns.match(other_value.ns(), 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 @NS_Emulation.SnsIndication.");
}
return FALSE;
}

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

boolean SnsIndication_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_nsvci.is_value()
 && single_value->field_ns.is_value();
}

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

SnsIndication SnsIndication_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 @NS_Emulation.SnsIndication.");
SnsIndication ret_val;
if (single_value->field_nsvci.is_bound()) {
ret_val.nsvci() = single_value->field_nsvci.valueof();
}
if (single_value->field_ns.is_bound()) {
ret_val.ns() = single_value->field_ns.valueof();
}
return ret_val;
}

void SnsIndication_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 @NS_Emulation.SnsIndication.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new SnsIndication_template[list_length];
}

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

INTEGER_template& SnsIndication_template::nsvci()
{
set_specific();
return single_value->field_nsvci;
}

const INTEGER_template& SnsIndication_template::nsvci() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field nsvci of a non-specific template of type @NS_Emulation.SnsIndication.");
return single_value->field_nsvci;
}

NS__Types::PDU__NS_template& SnsIndication_template::ns()
{
set_specific();
return single_value->field_ns;
}

const NS__Types::PDU__NS_template& SnsIndication_template::ns() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ns of a non-specific template of type @NS_Emulation.SnsIndication.");
return single_value->field_ns;
}

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

void SnsIndication_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ nsvci := ");
single_value->field_nsvci.log();
TTCN_Logger::log_event_str(", ns := ");
single_value->field_ns.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 SnsIndication_template::log_match(const SnsIndication& 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_nsvci.match(match_value.nsvci(), legacy)){
TTCN_Logger::log_logmatch_info(".nsvci");
single_value->field_nsvci.log_match(match_value.nsvci(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ns.match(match_value.ns(), legacy)){
TTCN_Logger::log_logmatch_info(".ns");
single_value->field_ns.log_match(match_value.ns(), 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("{ nsvci := ");
single_value->field_nsvci.log_match(match_value.nsvci(), legacy);
TTCN_Logger::log_event_str(", ns := ");
single_value->field_ns.log_match(match_value.ns(), 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 SnsIndication_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (nsvci().is_bound()) nsvci().set_implicit_omit();
if (ns().is_bound()) ns().set_implicit_omit();
}

void SnsIndication_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_nsvci.encode_text(text_buf);
single_value->field_ns.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 @NS_Emulation.SnsIndication.");
}
}

void SnsIndication_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_nsvci.decode_text(text_buf);
single_value->field_ns.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 SnsIndication_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 @NS_Emulation.SnsIndication.");
}
}

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

void SnsIndication_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_nsvci.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.SnsIndication");
single_value->field_ns.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.SnsIndication");
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 : "@NS_Emulation.SnsIndication");
}

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

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

SnsRequest::SnsRequest()
{
}

SnsRequest::SnsRequest(const INTEGER& par_nsvci,
    const NS__Types::PDU__NS& par_ns)
  :   field_nsvci(par_nsvci),
  field_ns(par_ns)
{
}

SnsRequest::SnsRequest(const SnsRequest& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @NS_Emulation.SnsRequest.");
if (other_value.nsvci().is_bound()) field_nsvci = other_value.nsvci();
else field_nsvci.clean_up();
if (other_value.ns().is_bound()) field_ns = other_value.ns();
else field_ns.clean_up();
}

void SnsRequest::clean_up()
{
field_nsvci.clean_up();
field_ns.clean_up();
}

const TTCN_Typedescriptor_t* SnsRequest::get_descriptor() const { return &SnsRequest_descr_; }
SnsRequest& SnsRequest::operator=(const SnsRequest& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @NS_Emulation.SnsRequest.");
  if (other_value.nsvci().is_bound()) field_nsvci = other_value.nsvci();
  else field_nsvci.clean_up();
  if (other_value.ns().is_bound()) field_ns = other_value.ns();
  else field_ns.clean_up();
}
return *this;
}

boolean SnsRequest::operator==(const SnsRequest& other_value) const
{
return field_nsvci==other_value.field_nsvci
  && field_ns==other_value.field_ns;
}

boolean SnsRequest::is_bound() const
{
return (field_nsvci.is_bound())
  || (field_ns.is_bound());
}
boolean SnsRequest::is_value() const
{
return field_nsvci.is_value()
  && field_ns.is_value();
}
void SnsRequest::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ nsvci := ");
field_nsvci.log();
TTCN_Logger::log_event_str(", ns := ");
field_ns.log();
TTCN_Logger::log_event_str(" }");
}

void SnsRequest::set_implicit_omit()
{
if (nsvci().is_bound()) nsvci().set_implicit_omit();
if (ns().is_bound()) ns().set_implicit_omit();
}

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

void SnsRequest::encode_text(Text_Buf& text_buf) const
{
field_nsvci.encode_text(text_buf);
field_ns.encode_text(text_buf);
}

void SnsRequest::decode_text(Text_Buf& text_buf)
{
field_nsvci.decode_text(text_buf);
field_ns.decode_text(text_buf);
}

struct SnsRequest_template::single_value_struct {
INTEGER_template field_nsvci;
NS__Types::PDU__NS_template field_ns;
};

void SnsRequest_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_nsvci = ANY_VALUE;
single_value->field_ns = ANY_VALUE;
}
}
}

void SnsRequest_template::copy_value(const SnsRequest& other_value)
{
single_value = new single_value_struct;
if (other_value.nsvci().is_bound()) {
  single_value->field_nsvci = other_value.nsvci();
} else {
  single_value->field_nsvci.clean_up();
}
if (other_value.ns().is_bound()) {
  single_value->field_ns = other_value.ns();
} else {
  single_value->field_ns.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void SnsRequest_template::copy_template(const SnsRequest_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.nsvci().get_selection()) {
single_value->field_nsvci = other_value.nsvci();
} else {
single_value->field_nsvci.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ns().get_selection()) {
single_value->field_ns = other_value.ns();
} else {
single_value->field_ns.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 SnsRequest_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 SnsRequest_template(*other_value.implication_.precondition);
implication_.implied_template = new SnsRequest_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 @NS_Emulation.SnsRequest.");
break;
}
set_selection(other_value);
}

SnsRequest_template::SnsRequest_template()
{
}

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

SnsRequest_template::SnsRequest_template(const SnsRequest& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean SnsRequest_template::match(const SnsRequest& 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.nsvci().is_bound()) return FALSE;
if(!single_value->field_nsvci.match(other_value.nsvci(), legacy))return FALSE;
if(!other_value.ns().is_bound()) return FALSE;
if(!single_value->field_ns.match(other_value.ns(), 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 @NS_Emulation.SnsRequest.");
}
return FALSE;
}

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

boolean SnsRequest_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_nsvci.is_value()
 && single_value->field_ns.is_value();
}

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

SnsRequest SnsRequest_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 @NS_Emulation.SnsRequest.");
SnsRequest ret_val;
if (single_value->field_nsvci.is_bound()) {
ret_val.nsvci() = single_value->field_nsvci.valueof();
}
if (single_value->field_ns.is_bound()) {
ret_val.ns() = single_value->field_ns.valueof();
}
return ret_val;
}

void SnsRequest_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 @NS_Emulation.SnsRequest.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new SnsRequest_template[list_length];
}

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

INTEGER_template& SnsRequest_template::nsvci()
{
set_specific();
return single_value->field_nsvci;
}

const INTEGER_template& SnsRequest_template::nsvci() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field nsvci of a non-specific template of type @NS_Emulation.SnsRequest.");
return single_value->field_nsvci;
}

NS__Types::PDU__NS_template& SnsRequest_template::ns()
{
set_specific();
return single_value->field_ns;
}

const NS__Types::PDU__NS_template& SnsRequest_template::ns() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ns of a non-specific template of type @NS_Emulation.SnsRequest.");
return single_value->field_ns;
}

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

void SnsRequest_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ nsvci := ");
single_value->field_nsvci.log();
TTCN_Logger::log_event_str(", ns := ");
single_value->field_ns.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 SnsRequest_template::log_match(const SnsRequest& 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_nsvci.match(match_value.nsvci(), legacy)){
TTCN_Logger::log_logmatch_info(".nsvci");
single_value->field_nsvci.log_match(match_value.nsvci(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ns.match(match_value.ns(), legacy)){
TTCN_Logger::log_logmatch_info(".ns");
single_value->field_ns.log_match(match_value.ns(), 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("{ nsvci := ");
single_value->field_nsvci.log_match(match_value.nsvci(), legacy);
TTCN_Logger::log_event_str(", ns := ");
single_value->field_ns.log_match(match_value.ns(), 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 SnsRequest_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (nsvci().is_bound()) nsvci().set_implicit_omit();
if (ns().is_bound()) ns().set_implicit_omit();
}

void SnsRequest_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_nsvci.encode_text(text_buf);
single_value->field_ns.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 @NS_Emulation.SnsRequest.");
}
}

void SnsRequest_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_nsvci.decode_text(text_buf);
single_value->field_ns.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 SnsRequest_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 @NS_Emulation.SnsRequest.");
}
}

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

void SnsRequest_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_nsvci.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.SnsRequest");
single_value->field_ns.check_restriction(t_res, t_name ? t_name : "@NS_Emulation.SnsRequest");
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 : "@NS_Emulation.SnsRequest");
}

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

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

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

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

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

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

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

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

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

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

boolean NsCtrlRequest::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 @NS_Emulation.NsCtrlRequest.");
return enum_value == other_value;
}

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

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

boolean NsCtrlRequest::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 @NS_Emulation.NsCtrlRequest.");
return enum_value < other_value;
}

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

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

boolean NsCtrlRequest::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 @NS_Emulation.NsCtrlRequest.");
return enum_value > other_value;
}

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

const char *NsCtrlRequest::enum_to_str(enum_type enum_par)
{
switch (enum_par) {
case StartAliveProcedure: return "StartAliveProcedure";
case DisableReq: return "DisableReq";
case EnableReq: return "EnableReq";
case ForceAliveState: return "ForceAliveState";
default:
return "<unknown>";
}
}

NsCtrlRequest::enum_type NsCtrlRequest::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, "StartAliveProcedure")) return StartAliveProcedure;
if (!strcmp(str_par, "DisableReq")) return DisableReq;
if (!strcmp(str_par, "EnableReq")) return EnableReq;
if (!strcmp(str_par, "ForceAliveState")) return ForceAliveState;
}
return UNKNOWN_VALUE;
}

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

int NsCtrlRequest::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 @NS_Emulation.NsCtrlRequest.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par;
}

int NsCtrlRequest::enum2int(const NsCtrlRequest& 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 @NS_Emulation.NsCtrlRequest.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par.enum_value;
}

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

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

void NsCtrlRequest::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 NsCtrlRequest::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", "@NS_Emulation.NsCtrlRequest");
  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 @NS_Emulation.NsCtrlRequest.");
  }
}

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

void NsCtrlRequest::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 @NS_Emulation.NsCtrlRequest.", enum_value);
}

void NsCtrlRequest_template::copy_template(const NsCtrlRequest_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 NsCtrlRequest_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 NsCtrlRequest_template(*other_value.implication_.precondition);
implication_.implied_template = new NsCtrlRequest_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 @NS_Emulation.NsCtrlRequest.");
}
}

NsCtrlRequest_template::NsCtrlRequest_template()
{
}

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

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

NsCtrlRequest_template::NsCtrlRequest_template(NsCtrlRequest::enum_type other_value)
 : Base_Template(SPECIFIC_VALUE)
{
single_value = other_value;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

NsCtrlRequest_template& NsCtrlRequest_template::operator=(const OPTIONAL<NsCtrlRequest>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (NsCtrlRequest::enum_type)(const NsCtrlRequest&)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 @NS_Emulation.NsCtrlRequest.");
}
return *this;
}

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

boolean NsCtrlRequest_template::match(NsCtrlRequest::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 @NS_Emulation.NsCtrlRequest.");
}
return FALSE;
}

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

NsCtrlRequest::enum_type NsCtrlRequest_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 @NS_Emulation.NsCtrlRequest.");
return single_value;
}

void NsCtrlRequest_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 NsCtrlRequest_template[list_length];
break;
default:
TTCN_error("Setting an invalid type for a template of enumerated type @NS_Emulation.NsCtrlRequest.");
}
}

NsCtrlRequest_template& NsCtrlRequest_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 @NS_Emulation.NsCtrlRequest.");
if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @NS_Emulation.NsCtrlRequest.");
return value_list.list_value[list_index];
}

void NsCtrlRequest_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_enum(NsCtrlRequest::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 NsCtrlRequest_template::log_match(const NsCtrlRequest& 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 NsCtrlRequest_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 @NS_Emulation.NsCtrlRequest.");
}
}

void NsCtrlRequest_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = (NsCtrlRequest::enum_type)text_buf.pull_int().get_val();
if (!NsCtrlRequest::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @NS_Emulation.NsCtrlRequest.", 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 NsCtrlRequest_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 @NS_Emulation.NsCtrlRequest.");
}
}

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

boolean NsCtrlRequest_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 NsCtrlRequest_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: {
    NsCtrlRequest_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: {
    NsCtrlRequest::enum_type enum_val = NsCtrlRequest::str_to_enum(m_p->get_enumerated(), m_p->get_enumerated_value());
    if (!NsCtrlRequest::is_valid_enum(enum_val)) {
      param.error("Invalid enumerated value for type @NS_Emulation.NsCtrlRequest.");
    }
    *this = enum_val;
  } break;
  case Module_Param::MP_Implication_Template: {
    NsCtrlRequest_template* precondition = new NsCtrlRequest_template;
    precondition->set_param(*m_p->get_elem(0));
    NsCtrlRequest_template* implied_template = new NsCtrlRequest_template;
    implied_template->set_param(*m_p->get_elem(1));
    *this = NsCtrlRequest_template(precondition, implied_template);
  } break;
  default:
    param.type_error("enumerated template", "@NS_Emulation.NsCtrlRequest");
  }
  is_ifpresent = param.get_ifpresent();
}

void NsCtrlRequest_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 : "@NS_Emulation.NsCtrlRequest");
}

as__ns__common__status_Default::as__ns__common__status_Default()
 : Default_Base("as_ns_common_status")
{
}

alt_status as__ns__common__status_Default::call_altstep(boolean first_alt_run)
{
return as__ns__common__status_instance(first_alt_run);
}

as__ns__common_Default::as__ns__common_Default()
 : Default_Base("as_ns_common")
{
}

alt_status as__ns__common_Default::call_altstep(boolean first_alt_run)
{
return as__ns__common_instance(first_alt_run);
}

as__vcg__sns__pcu_Default::as__vcg__sns__pcu_Default()
 : Default_Base("as_vcg_sns_pcu")
{
}

alt_status as__vcg__sns__pcu_Default::call_altstep(boolean first_alt_run)
{
return as__vcg__sns__pcu_instance(first_alt_run);
}

as__vcg__sns__sgsn_Default::as__vcg__sns__sgsn_Default()
 : Default_Base("as_vcg_sns_sgsn")
{
}

alt_status as__vcg__sns__sgsn_Default::call_altstep(boolean first_alt_run)
{
return as__vcg__sns__sgsn_instance(first_alt_run);
}

as__allstate_Default::as__allstate_Default()
 : Default_Base("as_allstate")
{
}

alt_status as__allstate_Default::call_altstep(boolean first_alt_run)
{
return as__allstate_instance(first_alt_run);
}

as__disabled_Default::as__disabled_Default()
 : Default_Base("as_disabled")
{
}

alt_status as__disabled_Default::call_altstep(boolean first_alt_run)
{
return as__disabled_instance(first_alt_run);
}

as__handle__reset_Default::as__handle__reset_Default()
 : Default_Base("as_handle_reset")
{
}

alt_status as__handle__reset_Default::call_altstep(boolean first_alt_run)
{
return as__handle__reset_instance(first_alt_run);
}

as__nsvc__sns_Default::as__nsvc__sns_Default()
 : Default_Base("as_nsvc_sns")
{
}

alt_status as__nsvc__sns_Default::call_altstep(boolean first_alt_run)
{
return as__nsvc__sns_instance(first_alt_run);
}

as__alive__blocked_Default::as__alive__blocked_Default()
 : Default_Base("as_alive_blocked")
{
}

alt_status as__alive__blocked_Default::call_altstep(boolean first_alt_run)
{
return as__alive__blocked_instance(first_alt_run);
}

as__alive__unblocked_Default::as__alive__unblocked_Default()
 : Default_Base("as_alive_unblocked")
{
}

alt_status as__alive__unblocked_Default::call_altstep(boolean first_alt_run)
{
return as__alive__unblocked_instance(first_alt_run);
}

as__alive__unblocked__data_Default::as__alive__unblocked__data_Default()
 : Default_Base("as_alive_unblocked_data")
{
}

alt_status as__alive__unblocked__data_Default::call_altstep(boolean first_alt_run)
{
return as__alive__unblocked__data_instance(first_alt_run);
}

as__alive__unblocked__sig_Default::as__alive__unblocked__sig_Default()
 : Default_Base("as_alive_unblocked_sig")
{
}

alt_status as__alive__unblocked__sig_Default::call_altstep(boolean first_alt_run)
{
return as__alive__unblocked__sig_instance(first_alt_run);
}

as__wait__reset_Default::as__wait__reset_Default()
 : Default_Base("as_wait_reset")
{
}

alt_status as__wait__reset_Default::call_altstep(boolean first_alt_run)
{
return as__wait__reset_instance(first_alt_run);
}


/* Bodies of functions, altsteps and testcases */

NsUnitdataRequest_template tr__NsUdReq(const INTEGER_template& nsei, const INTEGER_template& bvci, const INTEGER_template& lsp, const OCTETSTRING_template& sdu, const BSSGP__Types::PDU__BSSGP_template& bssgp)
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 32, TTCN_Location::LOCATION_TEMPLATE, "tr_NsUdReq");
NsUnitdataRequest_template ret_val;
ret_val.bvci() = bvci;
ret_val.nsei() = nsei;
ret_val.lsp() = lsp;
ret_val.sdu() = sdu;
ret_val.bssgp() = bssgp;
return ret_val;
}

NsUnitdataRequest_template ts__NsUdReq(const INTEGER_template& nsei, const INTEGER_template& bvci, const INTEGER_template& lsp, const OCTETSTRING_template& sdu, const BSSGP__Types::PDU__BSSGP_template& bssgp)
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 41, TTCN_Location::LOCATION_TEMPLATE, "ts_NsUdReq");
NsUnitdataRequest_template ret_val;
ret_val.bvci() = bvci;
ret_val.nsei() = nsei;
ret_val.lsp() = lsp;
ret_val.sdu() = sdu;
ret_val.bssgp() = bssgp;
return ret_val;
}

NsUnitdataIndication_template tr__NsUdInd(const INTEGER_template& nsei, const INTEGER_template& bvci, const OCTETSTRING_template& sdu)
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 61, TTCN_Location::LOCATION_TEMPLATE, "tr_NsUdInd");
NsUnitdataIndication_template ret_val;
ret_val.bvci() = bvci;
ret_val.nsei() = nsei;
ret_val.nsvci() = ANY_VALUE;
ret_val.sdu() = sdu;
ret_val.bssgp() = ANY_VALUE;
return ret_val;
}

NsUnitdataIndication_template ts__NsUdInd(const INTEGER& nsei, const INTEGER& nsvci, const INTEGER& bvci, const OCTETSTRING& sdu)
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 71, TTCN_Location::LOCATION_TEMPLATE, "ts_NsUdInd");
NsUnitdataIndication_template ret_val;
ret_val.bvci() = bvci;
ret_val.nsei() = nsei;
ret_val.nsvci() = nsvci;
ret_val.sdu() = sdu;
ret_val.bssgp() = BSSGP__Types::dec__PDU__BSSGP(sdu);
return ret_val;
}

NsStatusIndication_template tr__NsStsInd(const INTEGER_template& nsei, const INTEGER_template& nsvci, const NsvcState_template& old__state, const NsvcState_template& state, const BOOLEAN_template& first__or__last)
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 87, TTCN_Location::LOCATION_TEMPLATE, "tr_NsStsInd");
NsStatusIndication_template ret_val;
ret_val.nsei() = nsei;
ret_val.nsvci() = nsvci;
ret_val.old__state() = old__state;
ret_val.new__state() = state;
ret_val.first__or__last() = first__or__last;
return ret_val;
}

NsStatusIndication_template ts__NsStsInd(const INTEGER& nsei, const INTEGER& nsvci, const NsvcState& old__state, const NsvcState& state, const BOOLEAN& first__or__last)
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 100, TTCN_Location::LOCATION_TEMPLATE, "ts_NsStsInd");
NsStatusIndication_template ret_val;
ret_val.nsei() = nsei;
ret_val.nsvci() = nsvci;
ret_val.old__state() = old__state;
ret_val.new__state() = state;
ret_val.first__or__last() = first__or__last;
return ret_val;
}

boolean operator==(null_type, const NSVCConfigurations& other_value)
{
if (other_value.val_ptr == NULL)
TTCN_error("The right operand of comparison is an unbound value of type @NS_Emulation.NSVCConfigurations.");
return other_value.val_ptr->n_elements == 0;
}

boolean operator==(null_type, const IpEndpointTable& other_value)
{
if (other_value.val_ptr == NULL)
TTCN_error("The right operand of comparison is an unbound value of type @NS_Emulation.IpEndpointTable.");
return other_value.val_ptr->n_elements == 0;
}

boolean operator==(null_type, const NsvcTable& other_value)
{
if (other_value.val_ptr == NULL)
TTCN_error("The right operand of comparison is an unbound value of type @NS_Emulation.NsvcTable.");
return other_value.val_ptr->n_elements == 0;
}

BOOLEAN f__ipep__find(const Osmocom__Types::AddressFamily& af, const INTEGER& local__udp__port, const CHARSTRING& local__ip, IpEndpointTableEntry& ret)
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 286, TTCN_Location::LOCATION_FUNCTION, "f_ipep_find");
current_location.update_lineno(289);
/* NS_Emulation.ttcnpp, line 289 */
INTEGER i;
current_location.update_lineno(290);
/* NS_Emulation.ttcnpp, line 290 */
i = 0;
current_location.update_lineno(290);
/* NS_Emulation.ttcnpp, line 290 */
for ( ; ; ) {
current_location.update_lineno(290);
/* NS_Emulation.ttcnpp, line 290 */
if (!(i < NS__CT_component_g__ip__endpoints.lengthof())) break;
current_location.update_lineno(291);
/* NS_Emulation.ttcnpp, line 291 */
IpEndpointTableEntry ipep(const_cast< const IpEndpointTable&>(NS__CT_component_g__ip__endpoints)[i]);
current_location.update_lineno(292);
/* NS_Emulation.ttcnpp, line 292 */
{
boolean tmp_1;
{
boolean tmp_2;
tmp_2 = (const_cast< const IpEndpointTableEntry&>(ipep).address__family() == af);
if (tmp_2) tmp_2 = (const_cast< const IpEndpointTableEntry&>(ipep).local__udp__port() == local__udp__port);
tmp_1 = tmp_2;
}
if (tmp_1) tmp_1 = (const_cast< const IpEndpointTableEntry&>(ipep).local__ip() == local__ip);
if (tmp_1) {
current_location.update_lineno(294);
/* NS_Emulation.ttcnpp, line 294 */
ret = ipep;
current_location.update_lineno(295);
/* NS_Emulation.ttcnpp, line 295 */
return TRUE;
}
}
current_location.update_lineno(290);
/* NS_Emulation.ttcnpp, line 290 */
{
INTEGER tmp_4;
++i;
}
}
current_location.update_lineno(298);
/* NS_Emulation.ttcnpp, line 298 */
return FALSE;
}

void start_f__ipep__find(const COMPONENT& component_reference, const Osmocom__Types::AddressFamily& af, const INTEGER& local__udp__port, const CHARSTRING& local__ip, IpEndpointTableEntry& ret)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_ipep_find(");
af.log();
TTCN_Logger::log_event_str(", ");
local__udp__port.log();
TTCN_Logger::log_event_str(", ");
local__ip.log();
TTCN_Logger::log_event_str(", ");
ret.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "NS_Emulation", "f_ipep_find", text_buf);
af.encode_text(text_buf);
local__udp__port.encode_text(text_buf);
local__ip.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

COMPONENT f__ipep__find__or__create(const NSVCConfiguration& nsvc__cfg)
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 302, TTCN_Location::LOCATION_FUNCTION, "f_ipep_find_or_create");
current_location.update_lineno(304);
/* NS_Emulation.ttcnpp, line 304 */
IpEndpointTableEntry ipep;
current_location.update_lineno(305);
/* NS_Emulation.ttcnpp, line 305 */
{
boolean tmp_7;
{
IpEndpointTableEntry tmp_5;
BOOLEAN tmp_6 = f__ipep__find(const_cast< const NSVCConfiguration&>(nsvc__cfg).provider().ip().address__family(), const_cast< const NSVCConfiguration&>(nsvc__cfg).provider().ip().local__udp__port(), const_cast< const NSVCConfiguration&>(nsvc__cfg).provider().ip().local__ip(), tmp_5);
if (tmp_5.is_bound()) ipep = tmp_5;
tmp_7 = tmp_6;
}
if (tmp_7) {
current_location.update_lineno(308);
/* NS_Emulation.ttcnpp, line 308 */
return const_cast< const IpEndpointTableEntry&>(ipep).provider__ct();
}
else {
current_location.update_lineno(310);
/* NS_Emulation.ttcnpp, line 310 */
CHARSTRING nsvc__id(((NS__CT_component_g__id + cs_0) + int2str(const_cast< const NSVCConfiguration&>(nsvc__cfg).nsvci())));
current_location.update_lineno(311);
/* NS_Emulation.ttcnpp, line 311 */
ipep.address__family() = const_cast< const NSVCConfiguration&>(nsvc__cfg).provider().ip().address__family();
ipep.local__udp__port() = const_cast< const NSVCConfiguration&>(nsvc__cfg).provider().ip().local__udp__port();
ipep.local__ip() = const_cast< const NSVCConfiguration&>(nsvc__cfg).provider().ip().local__ip();
ipep.data__weight() = const_cast< const NSVCConfiguration&>(nsvc__cfg).provider().ip().data__weight();
ipep.signalling__weight() = const_cast< const NSVCConfiguration&>(nsvc__cfg).provider().ip().signalling__weight();
current_location.update_lineno(320);
/* NS_Emulation.ttcnpp, line 320 */
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("Creating NSIP provider for ");
const_cast< const IpEndpointTableEntry&>(ipep).local__ip().log();
TTCN_Logger::log_char(':');
const_cast< const IpEndpointTableEntry&>(ipep).local__udp__port().log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(322);
/* NS_Emulation.ttcnpp, line 322 */
ipep.provider__ct() = TTCN_Runtime::create_component("NS_Provider_IPL4", "NS_Provider_IPL4_CT", (nsvc__id + cs_1), NULL, TRUE);
current_location.update_lineno(323);
/* NS_Emulation.ttcnpp, line 323 */
TTCN_Runtime::connect_port(self, NS__CT_component_NSPIP__PROC.get_name(), const_cast< const IpEndpointTableEntry&>(ipep).provider__ct(), NS__Provider__IPL4::NS__Provider__IPL4__CT_component_PROC.get_name());
current_location.update_lineno(324);
/* NS_Emulation.ttcnpp, line 324 */
NS__Provider__IPL4::start_main_(const_cast< const IpEndpointTableEntry&>(ipep).provider__ct(), nsvc__cfg, NS__CT_component_g__config, nsvc__id);
current_location.update_lineno(325);
/* NS_Emulation.ttcnpp, line 325 */
{
IpEndpointTable tmp_10;
{
IpEndpointTable tmp_11;
tmp_11.set_size(1);
tmp_11[0] = ipep;
tmp_10 = (NS__CT_component_g__ip__endpoints + tmp_11);
}
NS__CT_component_g__ip__endpoints = tmp_10;
}
current_location.update_lineno(326);
/* NS_Emulation.ttcnpp, line 326 */
return const_cast< const IpEndpointTableEntry&>(ipep).provider__ct();
}
}
}

void start_f__ipep__find__or__create(const COMPONENT& component_reference, const NSVCConfiguration& nsvc__cfg)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_ipep_find_or_create(");
nsvc__cfg.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "NS_Emulation", "f_ipep_find_or_create", text_buf);
nsvc__cfg.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

void f__nsvc__add(const NSVCConfiguration& nsvc__cfg)
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 331, TTCN_Location::LOCATION_FUNCTION, "f_nsvc_add");
current_location.update_lineno(332);
/* NS_Emulation.ttcnpp, line 332 */
CHARSTRING nsvc__id(((NS__CT_component_g__id + cs_0) + int2str(const_cast< const NSVCConfiguration&>(nsvc__cfg).nsvci())));
current_location.update_lineno(333);
/* NS_Emulation.ttcnpp, line 333 */
NsvcTableEntry te;
current_location.update_lineno(334);
/* NS_Emulation.ttcnpp, line 334 */
COMPONENT vc__ipep(NULL_COMPREF);
current_location.update_lineno(339);
/* NS_Emulation.ttcnpp, line 339 */
{
boolean tmp_15;
{
boolean tmp_12 = nsvc__cfg.is_bound();
if(tmp_12) {
const NSVCConfiguration& tmp_13 = nsvc__cfg;
const NSVCConfigurationP& tmp_14 = tmp_13.provider();
tmp_12 = tmp_14.is_bound();
if (tmp_12) {
tmp_12 = tmp_14.ischosen(NSVCConfigurationP::ALT_ip);
}
}
tmp_15 = tmp_12;
}
if (tmp_15) {
current_location.update_lineno(340);
/* NS_Emulation.ttcnpp, line 340 */
vc__ipep = f__ipep__find__or__create(nsvc__cfg);
}
}
current_location.update_lineno(345);
/* NS_Emulation.ttcnpp, line 345 */
te.cfg() = nsvc__cfg;
current_location.update_lineno(346);
/* NS_Emulation.ttcnpp, line 346 */
te.vc__conn() = TTCN_Runtime::create_component("NS_Emulation", "NSVC_CT", nsvc__id, NULL, TRUE);
current_location.update_lineno(347);
/* NS_Emulation.ttcnpp, line 347 */
te.state() = NsvcState::NSVC__S__DEAD__BLOCKED;
current_location.update_lineno(349);
/* NS_Emulation.ttcnpp, line 349 */
TTCN_Runtime::connect_port(self, NS__CT_component_NSVC.get_name(), const_cast< const NsvcTableEntry&>(te).vc__conn(), NSVC__CT_component_NS__SP.get_name());
current_location.update_lineno(350);
/* NS_Emulation.ttcnpp, line 350 */
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("Starting NSVC component for ");
nsvc__cfg.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(351);
/* NS_Emulation.ttcnpp, line 351 */
start_NSVCStart(const_cast< const NsvcTableEntry&>(te).vc__conn(), nsvc__cfg, NS__CT_component_g__config, nsvc__id, vc__ipep);
current_location.update_lineno(353);
/* NS_Emulation.ttcnpp, line 353 */
{
NsvcTable tmp_20;
{
NsvcTable tmp_21;
tmp_21.set_size(1);
tmp_21[0] = te;
tmp_20 = (NS__CT_component_g__nsvcs + tmp_21);
}
NS__CT_component_g__nsvcs = tmp_20;
}
current_location.update_lineno(357);
/* NS_Emulation.ttcnpp, line 357 */
{
boolean tmp_25;
{
boolean tmp_22 = nsvc__cfg.is_bound();
if(tmp_22) {
const NSVCConfiguration& tmp_23 = nsvc__cfg;
const NSVCConfigurationP& tmp_24 = tmp_23.provider();
tmp_22 = tmp_24.is_bound();
if (tmp_22) {
tmp_22 = tmp_24.ischosen(NSVCConfigurationP::ALT_ip);
}
}
tmp_25 = tmp_22;
}
if (tmp_25) {
current_location.update_lineno(359);
/* NS_Emulation.ttcnpp, line 359 */
NS__Provider__IPL4::f__nspip__add__nsvc(vc__ipep, const_cast< const NSVCConfiguration&>(nsvc__cfg).provider().ip().remote__ip(), const_cast< const NSVCConfiguration&>(nsvc__cfg).provider().ip().remote__udp__port(), const_cast< const NsvcTableEntry&>(te).vc__conn());
}
}
}

void start_f__nsvc__add(const COMPONENT& component_reference, const NSVCConfiguration& nsvc__cfg)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_nsvc_add(");
nsvc__cfg.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "NS_Emulation", "f_nsvc_add", text_buf);
nsvc__cfg.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

INTEGER f__nsvc__find__idx(const INTEGER& nsvci)
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 364, TTCN_Location::LOCATION_FUNCTION, "f_nsvc_find_idx");
current_location.update_lineno(365);
/* NS_Emulation.ttcnpp, line 365 */
INTEGER i;
current_location.update_lineno(366);
/* NS_Emulation.ttcnpp, line 366 */
i = 0;
current_location.update_lineno(366);
/* NS_Emulation.ttcnpp, line 366 */
for ( ; ; ) {
current_location.update_lineno(366);
/* NS_Emulation.ttcnpp, line 366 */
if (!(i < NS__CT_component_g__nsvcs.lengthof())) break;
current_location.update_lineno(367);
/* NS_Emulation.ttcnpp, line 367 */
if ((const_cast< const NsvcTable&>(NS__CT_component_g__nsvcs)[i].cfg().nsvci() == nsvci)) {
current_location.update_lineno(368);
/* NS_Emulation.ttcnpp, line 368 */
return i;
}
current_location.update_lineno(366);
/* NS_Emulation.ttcnpp, line 366 */
{
INTEGER tmp_27;
++i;
}
}
current_location.update_lineno(371);
/* NS_Emulation.ttcnpp, line 371 */
return -1;
}

void start_f__nsvc__find__idx(const COMPONENT& component_reference, const INTEGER& nsvci)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_nsvc_find_idx(");
nsvci.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "NS_Emulation", "f_nsvc_find_idx", text_buf);
nsvci.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

COMPONENT f__nsvc__find(const INTEGER& nsvci)
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 374, TTCN_Location::LOCATION_FUNCTION, "f_nsvc_find");
current_location.update_lineno(375);
/* NS_Emulation.ttcnpp, line 375 */
INTEGER i(f__nsvc__find__idx(nsvci));
current_location.update_lineno(376);
/* NS_Emulation.ttcnpp, line 376 */
if ((i < 0)) {
current_location.update_lineno(377);
/* NS_Emulation.ttcnpp, line 377 */
return NULL_COMPREF;
}
else {
current_location.update_lineno(379);
/* NS_Emulation.ttcnpp, line 379 */
return const_cast< const NsvcTable&>(NS__CT_component_g__nsvcs)[i].vc__conn();
}
}

void start_f__nsvc__find(const COMPONENT& component_reference, const INTEGER& nsvci)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_nsvc_find(");
nsvci.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "NS_Emulation", "f_nsvc_find", text_buf);
nsvci.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

void f__nsvc__update__state(const INTEGER& nsvci, const NsvcState& state)
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 383, TTCN_Location::LOCATION_FUNCTION, "f_nsvc_update_state");
current_location.update_lineno(384);
/* NS_Emulation.ttcnpp, line 384 */
INTEGER i(f__nsvc__find__idx(nsvci));
current_location.update_lineno(385);
/* NS_Emulation.ttcnpp, line 385 */
if ((i < 0)) {
current_location.update_lineno(386);
/* NS_Emulation.ttcnpp, line 386 */
return;
}
current_location.update_lineno(388);
/* NS_Emulation.ttcnpp, line 388 */
{
boolean tmp_28;
tmp_28 = (const_cast< const NsvcTable&>(NS__CT_component_g__nsvcs)[i].state() != NsvcState::NSVC__S__ALIVE__UNBLOCKED);
if (tmp_28) tmp_28 = (state == NsvcState::NSVC__S__ALIVE__UNBLOCKED);
if (tmp_28) {
current_location.update_lineno(390);
/* NS_Emulation.ttcnpp, line 390 */
{
boolean tmp_29;
{
boolean tmp_30 = NS__CT_component_g__nsvcs.is_bound();
if(tmp_30) {
const int tmp_31 = i;
tmp_30 = (tmp_31 >= 0) && (NS__CT_component_g__nsvcs.size_of() > tmp_31);
if(tmp_30) {
const NsvcTableEntry& tmp_32 = NS__CT_component_g__nsvcs[tmp_31];
tmp_30 = tmp_32.is_bound();
if(tmp_30) {
const NsvcTableEntry& tmp_33 = tmp_32;
const NSVCConfiguration& tmp_34 = tmp_33.cfg();
tmp_30 = tmp_34.is_bound();
if(tmp_30) {
const NSVCConfiguration& tmp_35 = tmp_34;
const NSVCConfigurationP& tmp_36 = tmp_35.provider();
tmp_30 = tmp_36.is_bound();
if (tmp_30) {
tmp_30 = tmp_36.ischosen(NSVCConfigurationP::ALT_ip);
}
}
}
}
}
tmp_29 = (!(tmp_30));
}
if (!tmp_29) tmp_29 = (const_cast< const NsvcTable&>(NS__CT_component_g__nsvcs)[i].cfg().provider().ip().signalling__weight() > 0);
if (tmp_29) {
current_location.update_lineno(392);
/* NS_Emulation.ttcnpp, line 392 */
Osmocom__Types::ro__integer__add__unique(NS__CT_component_g__unblocked__nsvcs__sig, i);
}
}
current_location.update_lineno(394);
/* NS_Emulation.ttcnpp, line 394 */
{
boolean tmp_37;
{
boolean tmp_38 = NS__CT_component_g__nsvcs.is_bound();
if(tmp_38) {
const int tmp_39 = i;
tmp_38 = (tmp_39 >= 0) && (NS__CT_component_g__nsvcs.size_of() > tmp_39);
if(tmp_38) {
const NsvcTableEntry& tmp_40 = NS__CT_component_g__nsvcs[tmp_39];
tmp_38 = tmp_40.is_bound();
if(tmp_38) {
const NsvcTableEntry& tmp_41 = tmp_40;
const NSVCConfiguration& tmp_42 = tmp_41.cfg();
tmp_38 = tmp_42.is_bound();
if(tmp_38) {
const NSVCConfiguration& tmp_43 = tmp_42;
const NSVCConfigurationP& tmp_44 = tmp_43.provider();
tmp_38 = tmp_44.is_bound();
if (tmp_38) {
tmp_38 = tmp_44.ischosen(NSVCConfigurationP::ALT_ip);
}
}
}
}
}
tmp_37 = (!(tmp_38));
}
if (!tmp_37) tmp_37 = (const_cast< const NsvcTable&>(NS__CT_component_g__nsvcs)[i].cfg().provider().ip().data__weight() > 0);
if (tmp_37) {
current_location.update_lineno(396);
/* NS_Emulation.ttcnpp, line 396 */
Osmocom__Types::ro__integer__add__unique(NS__CT_component_g__unblocked__nsvcs__data, i);
}
}
}
else {
current_location.update_lineno(398);
/* NS_Emulation.ttcnpp, line 398 */
boolean tmp_45;
tmp_45 = (const_cast< const NsvcTable&>(NS__CT_component_g__nsvcs)[i].state() == NsvcState::NSVC__S__ALIVE__UNBLOCKED);
if (tmp_45) tmp_45 = (state != NsvcState::NSVC__S__ALIVE__UNBLOCKED);
if (tmp_45) {
current_location.update_lineno(400);
/* NS_Emulation.ttcnpp, line 400 */
Osmocom__Types::ro__integer__del(NS__CT_component_g__unblocked__nsvcs__sig, i);
current_location.update_lineno(401);
/* NS_Emulation.ttcnpp, line 401 */
Osmocom__Types::ro__integer__del(NS__CT_component_g__unblocked__nsvcs__data, i);
}
}
}
current_location.update_lineno(403);
/* NS_Emulation.ttcnpp, line 403 */
NS__CT_component_g__nsvcs[i].state() = state;
}

void start_f__nsvc__update__state(const COMPONENT& component_reference, const INTEGER& nsvci, const NsvcState& state)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_nsvc_update_state(");
nsvci.log();
TTCN_Logger::log_event_str(", ");
state.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "NS_Emulation", "f_nsvc_update_state", text_buf);
nsvci.encode_text(text_buf);
state.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

void NSStart(const NSConfiguration& init__config, const CHARSTRING& id)
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 406, TTCN_Location::LOCATION_FUNCTION, "NSStart");
current_location.update_lineno(407);
/* NS_Emulation.ttcnpp, line 407 */
NS__CT_component_g__config = init__config;
current_location.update_lineno(408);
/* NS_Emulation.ttcnpp, line 408 */
NS__CT_component_g__id = id;
{
current_location.update_lineno(411);
/* NS_Emulation.ttcnpp, line 411 */
INTEGER i(0);
current_location.update_lineno(411);
/* NS_Emulation.ttcnpp, line 411 */
for ( ; ; ) {
current_location.update_lineno(411);
/* NS_Emulation.ttcnpp, line 411 */
if (!(i < const_cast< const NSConfiguration&>(NS__CT_component_g__config).nsvc().lengthof())) break;
current_location.update_lineno(412);
/* NS_Emulation.ttcnpp, line 412 */
NSVCConfiguration nsvc__cfg(const_cast< const NSConfiguration&>(NS__CT_component_g__config).nsvc()[i]);
current_location.update_lineno(413);
/* NS_Emulation.ttcnpp, line 413 */
f__nsvc__add(nsvc__cfg);
current_location.update_lineno(411);
/* NS_Emulation.ttcnpp, line 411 */
{
INTEGER tmp_49;
++i;
}
}
}
current_location.update_lineno(416);
/* NS_Emulation.ttcnpp, line 416 */
{
boolean tmp_50;
tmp_50 = const_cast< const NSConfiguration&>(NS__CT_component_g__config).handle__sns();
if (tmp_50) tmp_50 = (!(const_cast< const NSConfiguration&>(NS__CT_component_g__config).role__sgsn()));
if (tmp_50) {
current_location.update_lineno(417);
/* NS_Emulation.ttcnpp, line 417 */
f__sns__outbound__size__config(f__sns__outbound__size__config_idx_defval);
}
}
for ( ; ; ) {
current_location.update_lineno(420);
/* NS_Emulation.ttcnpp, line 420 */
{
tmp_51:
alt_status tmp_51_alt_flag_0 = ALT_MAYBE;
alt_status tmp_51_default_flag = ALT_MAYBE;
boolean first_run = TRUE;
TTCN_Snapshot::take_new(FALSE);
for ( ; ; ) {
if (tmp_51_alt_flag_0 == ALT_MAYBE) {
current_location.update_lineno(421);
/* NS_Emulation.ttcnpp, line 421 */
tmp_51_alt_flag_0 = as__ns__common_instance(first_run);
if (tmp_51_alt_flag_0 == ALT_REPEAT) goto tmp_51;
if (tmp_51_alt_flag_0 == ALT_BREAK) break;
if (tmp_51_alt_flag_0 == ALT_YES) break;
}
if (tmp_51_default_flag == ALT_MAYBE) {
tmp_51_default_flag = TTCN_Default::try_altsteps(first_run);
if (tmp_51_default_flag == ALT_YES || tmp_51_default_flag == ALT_BREAK) break;
else if (tmp_51_default_flag == ALT_REPEAT) goto tmp_51;
}
current_location.update_lineno(420);
/* NS_Emulation.ttcnpp, line 420 */
if (tmp_51_alt_flag_0 == ALT_NO && tmp_51_default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in the alt statement in file NS_Emulation.ttcnpp between lines 420 and 422.");
TTCN_Snapshot::take_new(TRUE);
first_run = FALSE;
}
}
}
}

void start_NSStart(const COMPONENT& component_reference, const NSConfiguration& init__config, const CHARSTRING& id)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function NSStart(");
init__config.log();
TTCN_Logger::log_event_str(", ");
id.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "NS_Emulation", "NSStart", text_buf);
init__config.encode_text(text_buf);
id.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

INTEGER f__count__nsvcs__in__state(const NsvcState_template& state)
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 426, TTCN_Location::LOCATION_FUNCTION, "f_count_nsvcs_in_state");
current_location.update_lineno(427);
/* NS_Emulation.ttcnpp, line 427 */
INTEGER i;
current_location.update_lineno(428);
/* NS_Emulation.ttcnpp, line 428 */
INTEGER res(0);
current_location.update_lineno(429);
/* NS_Emulation.ttcnpp, line 429 */
i = 0;
current_location.update_lineno(429);
/* NS_Emulation.ttcnpp, line 429 */
for ( ; ; ) {
current_location.update_lineno(429);
/* NS_Emulation.ttcnpp, line 429 */
if (!(i < NS__CT_component_g__nsvcs.lengthof())) break;
current_location.update_lineno(430);
/* NS_Emulation.ttcnpp, line 430 */
if (state.match(const_cast< const NsvcTable&>(NS__CT_component_g__nsvcs)[i].state())) {
current_location.update_lineno(431);
/* NS_Emulation.ttcnpp, line 431 */
{
INTEGER tmp_53;
++res;
}
}
current_location.update_lineno(429);
/* NS_Emulation.ttcnpp, line 429 */
{
INTEGER tmp_54;
++i;
}
}
current_location.update_lineno(434);
/* NS_Emulation.ttcnpp, line 434 */
return res;
}

void start_f__count__nsvcs__in__state(const COMPONENT& component_reference, const NsvcState_template& state)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_count_nsvcs_in_state(");
state.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "NS_Emulation", "f_count_nsvcs_in_state", text_buf);
state.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

alt_status as__ns__common__status_instance(boolean first_alt_run)
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 437, TTCN_Location::LOCATION_ALTSTEP, "as_ns_common_status");
current_location.update_lineno(438);
/* NS_Emulation.ttcnpp, line 438 */
NsStatusIndication rx__nssi;
alt_status ret_val = ALT_NO;
current_location.update_lineno(439);
/* NS_Emulation.ttcnpp, line 439 */
switch (NS__CT_component_NSVC.receive(tr__NsStsInd(INTEGER_template(const_cast< const NSConfiguration&>(NS__CT_component_g__config).nsei()), INTEGER_template(ANY_VALUE), NsvcState_template(ANY_VALUE), NsvcState_template(NsvcState::NSVC__S__ALIVE__UNBLOCKED), tr__NsStsInd_first__or__last_defval), &(rx__nssi), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(441);
/* NS_Emulation.ttcnpp, line 441 */
INTEGER num__nsvc__unblocked(f__count__nsvcs__in__state(NsvcState_template(NsvcState::NSVC__S__ALIVE__UNBLOCKED)));
current_location.update_lineno(442);
/* NS_Emulation.ttcnpp, line 442 */
f__nsvc__update__state(const_cast< const NsStatusIndication&>(rx__nssi).nsvci(), const_cast< const NsStatusIndication&>(rx__nssi).new__state());
current_location.update_lineno(443);
/* NS_Emulation.ttcnpp, line 443 */
if ((num__nsvc__unblocked == 0)) {
current_location.update_lineno(444);
/* NS_Emulation.ttcnpp, line 444 */
rx__nssi.first__or__last() = TRUE;
}
current_location.update_lineno(446);
/* NS_Emulation.ttcnpp, line 446 */
NS__CT_component_NS__SP.send(rx__nssi, FALSE, NULL);
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
current_location.update_lineno(448);
/* NS_Emulation.ttcnpp, line 448 */
switch (NS__CT_component_NSVC.receive(tr__NsStsInd(INTEGER_template(const_cast< const NSConfiguration&>(NS__CT_component_g__config).nsei()), INTEGER_template(ANY_VALUE), NsvcState_template(ANY_VALUE), NsvcState_template(NsvcState::NSVC__S__DEAD__BLOCKED), tr__NsStsInd_first__or__last_defval), &(rx__nssi), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(449);
/* NS_Emulation.ttcnpp, line 449 */
f__nsvc__update__state(const_cast< const NsStatusIndication&>(rx__nssi).nsvci(), const_cast< const NsStatusIndication&>(rx__nssi).new__state());
current_location.update_lineno(451);
/* NS_Emulation.ttcnpp, line 451 */
INTEGER num__nsvc__unblocked(f__count__nsvcs__in__state(NsvcState_template(NsvcState::NSVC__S__ALIVE__UNBLOCKED)));
current_location.update_lineno(452);
/* NS_Emulation.ttcnpp, line 452 */
if ((num__nsvc__unblocked == 0)) {
current_location.update_lineno(453);
/* NS_Emulation.ttcnpp, line 453 */
rx__nssi.first__or__last() = TRUE;
}
current_location.update_lineno(455);
/* NS_Emulation.ttcnpp, line 455 */
NS__CT_component_NS__SP.send(rx__nssi, FALSE, NULL);
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
current_location.update_lineno(457);
/* NS_Emulation.ttcnpp, line 457 */
switch (NS__CT_component_NSVC.receive(tr__NsStsInd(INTEGER_template(const_cast< const NSConfiguration&>(NS__CT_component_g__config).nsei()), INTEGER_template(ANY_VALUE), NsvcState_template(ANY_VALUE), NsvcState_template(ANY_VALUE), tr__NsStsInd_first__or__last_defval), &(rx__nssi), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(458);
/* NS_Emulation.ttcnpp, line 458 */
f__nsvc__update__state(const_cast< const NsStatusIndication&>(rx__nssi).nsvci(), const_cast< const NsStatusIndication&>(rx__nssi).new__state());
current_location.update_lineno(459);
/* NS_Emulation.ttcnpp, line 459 */
NS__CT_component_NS__SP.send(rx__nssi, FALSE, NULL);
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
current_location.update_lineno(461);
/* NS_Emulation.ttcnpp, line 461 */
switch (NS__CT_component_NSVC.receive(tr__NsStsInd(tr__NsStsInd_nsei_defval, tr__NsStsInd_nsvci_defval, tr__NsStsInd_old__state_defval, tr__NsStsInd_state_defval, tr__NsStsInd_first__or__last_defval), &(rx__nssi), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(462);
/* NS_Emulation.ttcnpp, line 462 */
Misc__Helpers::f__shutdown(cs_2, 462, FAIL, (TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Received NsStatusInd for invalid NSEI: "),rx__nssi.log(),TTCN_Logger::end_event_log2str()));
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
return ret_val;
}

void as__ns__common__status(boolean nodefault_modifier)
{
altstep_begin:
boolean block_flag = FALSE;
alt_status altstep_flag = ALT_UNCHECKED, default_flag = ALT_UNCHECKED;
for ( ; ; ) {
TTCN_Snapshot::take_new(block_flag);
if (altstep_flag != ALT_NO) {
altstep_flag = as__ns__common__status_instance(!block_flag);
if (altstep_flag == ALT_YES || altstep_flag == ALT_BREAK) return;
else if (altstep_flag == ALT_REPEAT) goto altstep_begin;
}
if (!nodefault_modifier && default_flag != ALT_NO) {
default_flag = TTCN_Default::try_altsteps(!block_flag);
if (default_flag == ALT_YES || default_flag == ALT_BREAK) return;
else if (default_flag == ALT_REPEAT) goto altstep_begin;
}
if (altstep_flag == ALT_NO && default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in altstep as_ns_common_status.");
else block_flag = TRUE;
}
}

Default_Base *activate_as__ns__common__status()
{
return new as__ns__common__status_Default();
}

alt_status as__ns__common_instance(boolean first_alt_run)
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 467, TTCN_Location::LOCATION_ALTSTEP, "as_ns_common");
current_location.update_lineno(468);
/* NS_Emulation.ttcnpp, line 468 */
NsUnitdataIndication rx__nsudi;
current_location.update_lineno(469);
/* NS_Emulation.ttcnpp, line 469 */
NsUnitdataRequest rx__nsudr;
current_location.update_lineno(470);
/* NS_Emulation.ttcnpp, line 470 */
NsDisableVcRequest rx__disar;
current_location.update_lineno(471);
/* NS_Emulation.ttcnpp, line 471 */
NsEnableVcRequest rx__enar;
alt_status ret_val = ALT_NO;
current_location.update_lineno(473);
/* NS_Emulation.ttcnpp, line 473 */
switch (as__ns__common__status_instance(first_alt_run)) {
case ALT_YES:
return ALT_YES;
case ALT_REPEAT:
return ALT_REPEAT;
case ALT_BREAK:
return ALT_BREAK;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
current_location.update_lineno(474);
/* NS_Emulation.ttcnpp, line 474 */
switch (NS__CT_component_NSVC.receive(tr__NsUdInd(INTEGER_template(const_cast< const NSConfiguration&>(NS__CT_component_g__config).nsei()), INTEGER_template(ANY_VALUE), OCTETSTRING_template(ANY_VALUE)), &(rx__nsudi), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(475);
/* NS_Emulation.ttcnpp, line 475 */
NS__CT_component_NS__SP.send(rx__nsudi, FALSE, NULL);
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
current_location.update_lineno(478);
/* NS_Emulation.ttcnpp, line 478 */
static boolean guard_expr_2 = FALSE;
if (first_alt_run) {
guard_expr_2 = (const_cast< const NSConfiguration&>(NS__CT_component_g__config).handle__sns() && const_cast< const NSConfiguration&>(NS__CT_component_g__config).role__sgsn());
}
if (guard_expr_2) {
current_location.update_lineno(478);
/* NS_Emulation.ttcnpp, line 478 */
switch (as__vcg__sns__sgsn_instance(first_alt_run)) {
case ALT_YES:
return ALT_YES;
case ALT_REPEAT:
return ALT_REPEAT;
case ALT_BREAK:
return ALT_BREAK;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
}
current_location.update_lineno(479);
/* NS_Emulation.ttcnpp, line 479 */
static boolean guard_expr_3 = FALSE;
if (first_alt_run) {
boolean tmp_57;
tmp_57 = const_cast< const NSConfiguration&>(NS__CT_component_g__config).handle__sns();
if (tmp_57) tmp_57 = (!(const_cast< const NSConfiguration&>(NS__CT_component_g__config).role__sgsn()));
guard_expr_3 = tmp_57;
}
if (guard_expr_3) {
current_location.update_lineno(479);
/* NS_Emulation.ttcnpp, line 479 */
switch (as__vcg__sns__pcu_instance(first_alt_run)) {
case ALT_YES:
return ALT_YES;
case ALT_REPEAT:
return ALT_REPEAT;
case ALT_BREAK:
return ALT_BREAK;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
}
current_location.update_lineno(481);
/* NS_Emulation.ttcnpp, line 481 */
switch (NS__CT_component_NSVC.receive(tr__NsUdInd(INTEGER_template(ANY_VALUE), INTEGER_template(ANY_VALUE), OCTETSTRING_template(ANY_VALUE)), &(rx__nsudi), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(482);
/* NS_Emulation.ttcnpp, line 482 */
Misc__Helpers::f__shutdown(cs_2, 482, FAIL, (TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Received UnitDataInd for invalid NSEI: "),rx__nsudi.log(),TTCN_Logger::end_event_log2str()));
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
current_location.update_lineno(486);
/* NS_Emulation.ttcnpp, line 486 */
switch (NS__CT_component_NS__CTRL.receive(NsDisableVcRequest_template(ANY_VALUE), &(rx__disar), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(487);
/* NS_Emulation.ttcnpp, line 487 */
INTEGER nsvc__idx(f__nsvc__find__idx(const_cast< const NsDisableVcRequest&>(rx__disar).nsvci()));
current_location.update_lineno(488);
/* NS_Emulation.ttcnpp, line 488 */
NS__CT_component_NSVC.send(NsCtrlRequest(NsCtrlRequest::DisableReq), COMPONENT(const_cast< const NsvcTable&>(NS__CT_component_g__nsvcs)[nsvc__idx].vc__conn()), NULL);
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
current_location.update_lineno(490);
/* NS_Emulation.ttcnpp, line 490 */
switch (NS__CT_component_NS__CTRL.receive(NsEnableVcRequest_template(ANY_VALUE), &(rx__enar), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(491);
/* NS_Emulation.ttcnpp, line 491 */
INTEGER nsvc__idx(f__nsvc__find__idx(const_cast< const NsEnableVcRequest&>(rx__enar).nsvci()));
current_location.update_lineno(492);
/* NS_Emulation.ttcnpp, line 492 */
NS__CT_component_NSVC.send(NsCtrlRequest(NsCtrlRequest::EnableReq), COMPONENT(const_cast< const NsvcTable&>(NS__CT_component_g__nsvcs)[nsvc__idx].vc__conn()), NULL);
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
current_location.update_lineno(494);
/* NS_Emulation.ttcnpp, line 494 */
switch (NS__CT_component_NS__SP.receive(tr__NsUdReq(INTEGER_template(const_cast< const NSConfiguration&>(NS__CT_component_g__config).nsei()), INTEGER_template(0), INTEGER_template(ANY_VALUE), OCTETSTRING_template(ANY_VALUE), BSSGP__Types::PDU__BSSGP_template(ANY_OR_OMIT)), &(rx__nsudr), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(496);
/* NS_Emulation.ttcnpp, line 496 */
INTEGER nsvc__idx(const_cast< const Osmocom__Types::ro__integer&>(NS__CT_component_g__unblocked__nsvcs__sig)[mod(const_cast< const NsUnitdataRequest&>(rx__nsudr).lsp(), NS__CT_component_g__unblocked__nsvcs__sig.lengthof())]);
current_location.update_lineno(497);
/* NS_Emulation.ttcnpp, line 497 */
NS__CT_component_NSVC.send(rx__nsudr, COMPONENT(const_cast< const NsvcTable&>(NS__CT_component_g__nsvcs)[nsvc__idx].vc__conn()), NULL);
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
current_location.update_lineno(499);
/* NS_Emulation.ttcnpp, line 499 */
switch (NS__CT_component_NS__SP.receive(tr__NsUdReq(INTEGER_template(const_cast< const NSConfiguration&>(NS__CT_component_g__config).nsei()), INTEGER_template(ANY_VALUE), INTEGER_template(ANY_VALUE), OCTETSTRING_template(ANY_VALUE), BSSGP__Types::PDU__BSSGP_template(ANY_OR_OMIT)), &(rx__nsudr), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(501);
/* NS_Emulation.ttcnpp, line 501 */
INTEGER nsvc__idx(const_cast< const Osmocom__Types::ro__integer&>(NS__CT_component_g__unblocked__nsvcs__data)[mod(const_cast< const NsUnitdataRequest&>(rx__nsudr).lsp(), NS__CT_component_g__unblocked__nsvcs__data.lengthof())]);
current_location.update_lineno(502);
/* NS_Emulation.ttcnpp, line 502 */
NS__CT_component_NSVC.send(rx__nsudr, COMPONENT(const_cast< const NsvcTable&>(NS__CT_component_g__nsvcs)[nsvc__idx].vc__conn()), NULL);
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
current_location.update_lineno(505);
/* NS_Emulation.ttcnpp, line 505 */
switch (NS__CT_component_NS__SP.receive(tr__NsUdReq(INTEGER_template(ANY_VALUE), INTEGER_template(ANY_VALUE), INTEGER_template(ANY_VALUE), OCTETSTRING_template(ANY_VALUE), BSSGP__Types::PDU__BSSGP_template(ANY_OR_OMIT)), &(rx__nsudr), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(506);
/* NS_Emulation.ttcnpp, line 506 */
Misc__Helpers::f__shutdown(cs_2, 506, FAIL, (TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Received NsUnitdataReq for invalid NSEI: "),rx__nsudr.log(),TTCN_Logger::end_event_log2str()));
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
return ret_val;
}

void as__ns__common(boolean nodefault_modifier)
{
altstep_begin:
boolean block_flag = FALSE;
alt_status altstep_flag = ALT_UNCHECKED, default_flag = ALT_UNCHECKED;
for ( ; ; ) {
TTCN_Snapshot::take_new(block_flag);
if (altstep_flag != ALT_NO) {
altstep_flag = as__ns__common_instance(!block_flag);
if (altstep_flag == ALT_YES || altstep_flag == ALT_BREAK) return;
else if (altstep_flag == ALT_REPEAT) goto altstep_begin;
}
if (!nodefault_modifier && default_flag != ALT_NO) {
default_flag = TTCN_Default::try_altsteps(!block_flag);
if (default_flag == ALT_YES || default_flag == ALT_BREAK) return;
else if (default_flag == ALT_REPEAT) goto altstep_begin;
}
if (altstep_flag == ALT_NO && default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in altstep as_ns_common.");
else block_flag = TRUE;
}
}

Default_Base *activate_as__ns__common()
{
return new as__ns__common_Default();
}

void gen__sns__ip__elems(NS__Types::IP4__Elements_template& v4__out, NS__Types::IP6__Elements_template& v6__out)
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 512, TTCN_Location::LOCATION_FUNCTION, "gen_sns_ip_elems");
current_location.update_lineno(514);
/* NS_Emulation.ttcnpp, line 514 */
INTEGER i;
current_location.update_lineno(515);
/* NS_Emulation.ttcnpp, line 515 */
NS__Types::IP4__Elements v4(NULL_VALUE);
current_location.update_lineno(516);
/* NS_Emulation.ttcnpp, line 516 */
NS__Types::IP6__Elements v6(NULL_VALUE);
current_location.update_lineno(518);
/* NS_Emulation.ttcnpp, line 518 */
i = 0;
current_location.update_lineno(518);
/* NS_Emulation.ttcnpp, line 518 */
for ( ; ; ) {
current_location.update_lineno(518);
/* NS_Emulation.ttcnpp, line 518 */
if (!(i < NS__CT_component_g__ip__endpoints.lengthof())) break;
current_location.update_lineno(519);
/* NS_Emulation.ttcnpp, line 519 */
IpEndpointTableEntry ipep(const_cast< const IpEndpointTable&>(NS__CT_component_g__ip__endpoints)[i]);
current_location.update_lineno(520);
/* NS_Emulation.ttcnpp, line 520 */
if ((const_cast< const IpEndpointTableEntry&>(ipep).address__family() == Osmocom__Types::AddressFamily::AF__INET)) {
current_location.update_lineno(521);
/* NS_Emulation.ttcnpp, line 521 */
{
NS__Types::IP4__Elements tmp_59;
{
NS__Types::IP4__Elements tmp_60;
tmp_60.set_size(1);
tmp_60[0] = Osmocom__Gb__Types::ts__SNS__IPv4(const_cast< const IpEndpointTableEntry&>(ipep).local__ip(), const_cast< const IpEndpointTableEntry&>(ipep).local__udp__port(), const_cast< const IpEndpointTableEntry&>(ipep).signalling__weight(), const_cast< const IpEndpointTableEntry&>(ipep).data__weight()).valueof();
tmp_59 = (v4 + tmp_60);
}
v4 = tmp_59;
}
}
else {
current_location.update_lineno(525);
/* NS_Emulation.ttcnpp, line 525 */
if ((const_cast< const IpEndpointTableEntry&>(ipep).address__family() == Osmocom__Types::AddressFamily::AF__INET6)) {
current_location.update_lineno(526);
/* NS_Emulation.ttcnpp, line 526 */
{
NS__Types::IP6__Elements tmp_61;
{
NS__Types::IP6__Elements tmp_62;
tmp_62.set_size(1);
tmp_62[0] = Osmocom__Gb__Types::ts__SNS__IPv6(const_cast< const IpEndpointTableEntry&>(ipep).local__ip(), const_cast< const IpEndpointTableEntry&>(ipep).local__udp__port(), const_cast< const IpEndpointTableEntry&>(ipep).signalling__weight(), const_cast< const IpEndpointTableEntry&>(ipep).data__weight()).valueof();
tmp_61 = (v6 + tmp_62);
}
v6 = tmp_61;
}
}
}
current_location.update_lineno(518);
/* NS_Emulation.ttcnpp, line 518 */
{
INTEGER tmp_63;
++i;
}
}
current_location.update_lineno(534);
/* NS_Emulation.ttcnpp, line 534 */
if ((v4.lengthof() == 0)) {
current_location.update_lineno(535);
/* NS_Emulation.ttcnpp, line 535 */
v4__out = OMIT_VALUE;
}
else {
current_location.update_lineno(537);
/* NS_Emulation.ttcnpp, line 537 */
v4__out = v4;
}
current_location.update_lineno(539);
/* NS_Emulation.ttcnpp, line 539 */
if ((v6.lengthof() == 0)) {
current_location.update_lineno(540);
/* NS_Emulation.ttcnpp, line 540 */
v6__out = OMIT_VALUE;
}
else {
current_location.update_lineno(542);
/* NS_Emulation.ttcnpp, line 542 */
v6__out = v6;
}
}

void start_gen__sns__ip__elems(const COMPONENT& component_reference, NS__Types::IP4__Elements_template& v4__out, NS__Types::IP6__Elements_template& v6__out)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function gen_sns_ip_elems(");
v4__out.log();
TTCN_Logger::log_event_str(", ");
v6__out.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "NS_Emulation", "gen_sns_ip_elems", text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

void f__broadcast__ns__ctrl(const NsCtrlRequest_template& req)
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 546, TTCN_Location::LOCATION_FUNCTION, "f_broadcast_ns_ctrl");
{
current_location.update_lineno(547);
/* NS_Emulation.ttcnpp, line 547 */
INTEGER i(0);
current_location.update_lineno(547);
/* NS_Emulation.ttcnpp, line 547 */
for ( ; ; ) {
current_location.update_lineno(547);
/* NS_Emulation.ttcnpp, line 547 */
if (!(i < NS__CT_component_g__nsvcs.lengthof())) break;
current_location.update_lineno(548);
/* NS_Emulation.ttcnpp, line 548 */
NS__CT_component_NSVC.send(req, COMPONENT(const_cast< const NsvcTable&>(NS__CT_component_g__nsvcs)[i].vc__conn()), NULL);
current_location.update_lineno(547);
/* NS_Emulation.ttcnpp, line 547 */
{
INTEGER tmp_68;
++i;
}
}
}
}

void start_f__broadcast__ns__ctrl(const COMPONENT& component_reference, const NsCtrlRequest_template& req)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_broadcast_ns_ctrl(");
req.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "NS_Emulation", "f_broadcast_ns_ctrl", text_buf);
req.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

void f__sns__outbound__size__config(const INTEGER& idx)
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 553, TTCN_Location::LOCATION_FUNCTION, "f_sns_outbound_size_config");
current_location.update_lineno(554);
/* NS_Emulation.ttcnpp, line 554 */
NSVCConfiguration nsvc__cfg(const_cast< const NSConfiguration&>(NS__CT_component_g__config).nsvc()[idx]);
current_location.update_lineno(555);
/* NS_Emulation.ttcnpp, line 555 */
COMPONENT vc;
current_location.update_lineno(557);
/* NS_Emulation.ttcnpp, line 557 */
if ((const_cast< const NSVCConfiguration&>(nsvc__cfg).provider().ip().address__family() == Osmocom__Types::AddressFamily::AF__INET)) {
current_location.update_lineno(558);
/* NS_Emulation.ttcnpp, line 558 */
{
SnsRequest_template tmp_69;
tmp_69.nsvci() = const_cast< const NSVCConfiguration&>(nsvc__cfg).nsvci();
tmp_69.ns() = Osmocom__Gb__Types::ts__SNS__SIZE(const_cast< const NSConfiguration&>(NS__CT_component_g__config).nsei(), TRUE, 1, INTEGER_template(1), INTEGER_template(OMIT_VALUE));
NS__CT_component_NSVC.send(tmp_69, FALSE, NULL);
}
}
else {
current_location.update_lineno(562);
/* NS_Emulation.ttcnpp, line 562 */
{
SnsRequest_template tmp_70;
tmp_70.nsvci() = const_cast< const NSVCConfiguration&>(nsvc__cfg).nsvci();
tmp_70.ns() = Osmocom__Gb__Types::ts__SNS__SIZE(const_cast< const NSConfiguration&>(NS__CT_component_g__config).nsei(), TRUE, 1, INTEGER_template(OMIT_VALUE), INTEGER_template(1));
NS__CT_component_NSVC.send(tmp_70, FALSE, NULL);
}
}
current_location.update_lineno(567);
/* NS_Emulation.ttcnpp, line 567 */
{
tmp_71:
alt_status tmp_71_alt_flag_0 = ALT_MAYBE;
alt_status tmp_71_alt_flag_1 = ALT_MAYBE;
alt_status tmp_71_default_flag = ALT_MAYBE;
boolean first_run = TRUE;
TTCN_Snapshot::take_new(FALSE);
for ( ; ; ) {
if (tmp_71_alt_flag_0 == ALT_MAYBE) {
current_location.update_lineno(568);
/* NS_Emulation.ttcnpp, line 568 */
{
SnsIndication_template tmp_72;
tmp_72.nsvci() = ANY_VALUE;
tmp_72.ns() = Osmocom__Gb__Types::tr__SNS__SIZE__ACK(INTEGER_template(const_cast< const NSConfiguration&>(NS__CT_component_g__config).nsei()), Osmocom__Gb__Types::NsCause_template(OMIT_VALUE));
tmp_71_alt_flag_0 = NS__CT_component_NSVC.receive(tmp_72, NULL, any_compref, &(vc), NULL, NULL);
}
if (tmp_71_alt_flag_0 == ALT_YES) break;
}
if (tmp_71_alt_flag_1 == ALT_MAYBE) {
current_location.update_lineno(569);
/* NS_Emulation.ttcnpp, line 569 */
tmp_71_alt_flag_1 = NS__CT_component_NSVC.receive(NsStatusIndication_template(ANY_VALUE), NULL, any_compref, NULL, NULL, NULL);
if (tmp_71_alt_flag_1 == ALT_YES) {
current_location.update_lineno(569);
/* NS_Emulation.ttcnpp, line 569 */
goto tmp_71;
}
}
if (tmp_71_default_flag == ALT_MAYBE) {
tmp_71_default_flag = TTCN_Default::try_altsteps(first_run);
if (tmp_71_default_flag == ALT_YES || tmp_71_default_flag == ALT_BREAK) break;
else if (tmp_71_default_flag == ALT_REPEAT) goto tmp_71;
}
current_location.update_lineno(567);
/* NS_Emulation.ttcnpp, line 567 */
if (tmp_71_alt_flag_0 == ALT_NO && tmp_71_alt_flag_1 == ALT_NO && tmp_71_default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in the alt statement in file NS_Emulation.ttcnpp between lines 567 and 570.");
TTCN_Snapshot::take_new(TRUE);
first_run = FALSE;
}
}
current_location.update_lineno(572);
/* NS_Emulation.ttcnpp, line 572 */
NS__Types::IP4__Elements_template v4;
current_location.update_lineno(573);
/* NS_Emulation.ttcnpp, line 573 */
NS__Types::IP6__Elements_template v6;
current_location.update_lineno(574);
/* NS_Emulation.ttcnpp, line 574 */
{
NS__Types::IP4__Elements_template tmp_73;
NS__Types::IP6__Elements_template tmp_74;
gen__sns__ip__elems(tmp_73, tmp_74);
if (tmp_73.is_bound()) v4 = tmp_73;
if (tmp_74.is_bound()) v6 = tmp_74;
}
current_location.update_lineno(575);
/* NS_Emulation.ttcnpp, line 575 */
{
SnsRequest_template tmp_75;
tmp_75.nsvci() = const_cast< const NSVCConfiguration&>(nsvc__cfg).nsvci();
tmp_75.ns() = Osmocom__Gb__Types::ts__SNS__CONFIG(const_cast< const NSConfiguration&>(NS__CT_component_g__config).nsei(), TRUE, v4, v6);
NS__CT_component_NSVC.send(tmp_75, COMPONENT(vc), NULL);
}
current_location.update_lineno(577);
/* NS_Emulation.ttcnpp, line 577 */
{
tmp_76:
alt_status tmp_76_alt_flag_0 = ALT_MAYBE;
alt_status tmp_76_alt_flag_1 = ALT_MAYBE;
alt_status tmp_76_alt_flag_2 = ALT_MAYBE;
alt_status tmp_76_default_flag = ALT_MAYBE;
boolean first_run = TRUE;
TTCN_Snapshot::take_new(FALSE);
for ( ; ; ) {
if (tmp_76_alt_flag_0 == ALT_MAYBE) {
current_location.update_lineno(578);
/* NS_Emulation.ttcnpp, line 578 */
tmp_76_alt_flag_0 = as__ns__common__status_instance(first_run);
if (tmp_76_alt_flag_0 == ALT_REPEAT) goto tmp_76;
if (tmp_76_alt_flag_0 == ALT_BREAK) break;
if (tmp_76_alt_flag_0 == ALT_YES) {
current_location.update_lineno(579);
/* NS_Emulation.ttcnpp, line 579 */
goto tmp_76;
}
}
if (tmp_76_alt_flag_1 == ALT_MAYBE) {
current_location.update_lineno(581);
/* NS_Emulation.ttcnpp, line 581 */
{
SnsIndication_template tmp_77;
tmp_77.nsvci() = ANY_VALUE;
tmp_77.ns() = Osmocom__Gb__Types::tr__SNS__CONFIG__ACK(INTEGER_template(const_cast< const NSConfiguration&>(NS__CT_component_g__config).nsei()), Osmocom__Gb__Types::NsCause_template(OMIT_VALUE));
tmp_76_alt_flag_1 = NS__CT_component_NSVC.receive(tmp_77, NULL, COMPONENT_template(vc), NULL, NULL, NULL);
}
if (tmp_76_alt_flag_1 == ALT_YES) {
current_location.update_lineno(584);
/* NS_Emulation.ttcnpp, line 584 */
TTCN_Logger::log_str(TTCN_USER, "Outbound SNS Config succeeded.");
break;
}
}
if (tmp_76_alt_flag_2 == ALT_MAYBE) {
current_location.update_lineno(586);
/* NS_Emulation.ttcnpp, line 586 */
{
SnsIndication_template tmp_78;
tmp_78.nsvci() = ANY_VALUE;
tmp_78.ns() = Osmocom__Gb__Types::tr__SNS__CONFIG__ACK(INTEGER_template(const_cast< const NSConfiguration&>(NS__CT_component_g__config).nsei()), Osmocom__Gb__Types::NsCause_template(ANY_VALUE));
tmp_76_alt_flag_2 = NS__CT_component_NSVC.receive(tmp_78, NULL, COMPONENT_template(vc), NULL, NULL, NULL);
}
if (tmp_76_alt_flag_2 == ALT_YES) {
current_location.update_lineno(588);
/* NS_Emulation.ttcnpp, line 588 */
TTCN_Runtime::setverdict(FAIL,(TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Unexpected SNS-CONFIG-NACK"),TTCN_Logger::end_event_log2str()));
current_location.update_lineno(589);
/* NS_Emulation.ttcnpp, line 589 */
TTCN_Runtime::stop_execution();
}
}
if (tmp_76_default_flag == ALT_MAYBE) {
tmp_76_default_flag = TTCN_Default::try_altsteps(first_run);
if (tmp_76_default_flag == ALT_YES || tmp_76_default_flag == ALT_BREAK) break;
else if (tmp_76_default_flag == ALT_REPEAT) goto tmp_76;
}
current_location.update_lineno(577);
/* NS_Emulation.ttcnpp, line 577 */
if (tmp_76_alt_flag_0 == ALT_NO && tmp_76_alt_flag_1 == ALT_NO && tmp_76_alt_flag_2 == ALT_NO && tmp_76_default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in the alt statement in file NS_Emulation.ttcnpp between lines 577 and 591.");
TTCN_Snapshot::take_new(TRUE);
first_run = FALSE;
}
}
}

void start_f__sns__outbound__size__config(const COMPONENT& component_reference, const INTEGER& idx)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_sns_outbound_size_config(");
idx.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "NS_Emulation", "f_sns_outbound_size_config", text_buf);
idx.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

alt_status as__vcg__sns__pcu_instance(boolean first_alt_run)
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 596, TTCN_Location::LOCATION_ALTSTEP, "as_vcg_sns_pcu");
current_location.update_lineno(597);
/* NS_Emulation.ttcnpp, line 597 */
SnsIndication sind;
current_location.update_lineno(598);
/* NS_Emulation.ttcnpp, line 598 */
COMPONENT vc;
alt_status ret_val = ALT_NO;
current_location.update_lineno(601);
/* NS_Emulation.ttcnpp, line 601 */
{
alt_status tmp_81;
{
SnsIndication_template tmp_79;
tmp_79.nsvci() = ANY_VALUE;
{
NS__Types::IP4__Elements_template tmp_80;
tmp_80.set_size(1);
tmp_80[0] = Osmocom__Gb__Types::tr__SNS__IPv4(CHARSTRING_template(const_cast< const NSConfiguration&>(NS__CT_component_g__config).nsvc()[0].provider().ip().remote__ip()), INTEGER_template(const_cast< const NSConfiguration&>(NS__CT_component_g__config).nsvc()[0].provider().ip().remote__udp__port()), Osmocom__Gb__Types::tr__SNS__IPv4_sig__weight_defval, Osmocom__Gb__Types::tr__SNS__IPv4_data__weight_defval);
tmp_79.ns() = Osmocom__Gb__Types::tr__SNS__CONFIG(INTEGER_template(const_cast< const NSConfiguration&>(NS__CT_component_g__config).nsei()), BOOLEAN_template(TRUE), tmp_80, Osmocom__Gb__Types::tr__SNS__CONFIG_v6_defval);
}
tmp_81 = NS__CT_component_NSVC.receive(tmp_79, &(sind), any_compref, &(vc), NULL, NULL);
}
switch (tmp_81) {
case ALT_YES:
{
current_location.update_lineno(606);
/* NS_Emulation.ttcnpp, line 606 */
{
SnsRequest_template tmp_82;
tmp_82.nsvci() = const_cast< const SnsIndication&>(sind).nsvci();
tmp_82.ns() = Osmocom__Gb__Types::ts__SNS__CONFIG__ACK(const_cast< const NSConfiguration&>(NS__CT_component_g__config).nsei(), Osmocom__Gb__Types::NsCause_template(OMIT_VALUE));
NS__CT_component_NSVC.send(tmp_82, COMPONENT(vc), NULL);
}
current_location.update_lineno(607);
/* NS_Emulation.ttcnpp, line 607 */
TTCN_Logger::log_str(TTCN_USER, "Inbound SNS Config succeeded.");
current_location.update_lineno(611);
/* NS_Emulation.ttcnpp, line 611 */
f__broadcast__ns__ctrl(NsCtrlRequest_template(NsCtrlRequest::ForceAliveState));
current_location.update_lineno(613);
/* NS_Emulation.ttcnpp, line 613 */
f__broadcast__ns__ctrl(NsCtrlRequest_template(NsCtrlRequest::StartAliveProcedure));
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
}
current_location.update_lineno(615);
/* NS_Emulation.ttcnpp, line 615 */
{
alt_status tmp_84;
{
SnsIndication_template tmp_83;
tmp_83.nsvci() = ANY_VALUE;
tmp_83.ns() = Osmocom__Gb__Types::tr__SNS__CONFIG(INTEGER_template(const_cast< const NSConfiguration&>(NS__CT_component_g__config).nsei()), BOOLEAN_template(FALSE), NS__Types::IP4__Elements_template(ANY_VALUE), Osmocom__Gb__Types::tr__SNS__CONFIG_v6_defval);
tmp_84 = NS__CT_component_NSVC.receive(tmp_83, NULL, any_compref, NULL, NULL, NULL);
}
switch (tmp_84) {
case ALT_YES:
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
}
current_location.update_lineno(616);
/* NS_Emulation.ttcnpp, line 616 */
{
alt_status tmp_86;
{
SnsIndication_template tmp_85;
tmp_85.nsvci() = ANY_VALUE;
tmp_85.ns() = Osmocom__Gb__Types::tr__SNS__CONFIG(INTEGER_template(const_cast< const NSConfiguration&>(NS__CT_component_g__config).nsei()), BOOLEAN_template(TRUE), NS__Types::IP4__Elements_template(ANY_VALUE), Osmocom__Gb__Types::tr__SNS__CONFIG_v6_defval);
tmp_86 = NS__CT_component_NSVC.receive(tmp_85, NULL, any_compref, NULL, NULL, NULL);
}
switch (tmp_86) {
case ALT_YES:
{
current_location.update_lineno(617);
/* NS_Emulation.ttcnpp, line 617 */
TTCN_Runtime::setverdict(FAIL,(TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Unexpected SNS-CONFIG content"),TTCN_Logger::end_event_log2str()));
current_location.update_lineno(618);
/* NS_Emulation.ttcnpp, line 618 */
TTCN_Runtime::stop_execution();
}
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
}
current_location.update_lineno(620);
/* NS_Emulation.ttcnpp, line 620 */
{
alt_status tmp_88;
{
SnsIndication_template tmp_87;
tmp_87.nsvci() = ANY_VALUE;
tmp_87.ns() = Osmocom__Gb__Types::tr__SNS__CONFIG(INTEGER_template(ANY_VALUE), BOOLEAN_template(ANY_VALUE), NS__Types::IP4__Elements_template(ANY_VALUE), Osmocom__Gb__Types::tr__SNS__CONFIG_v6_defval);
tmp_88 = NS__CT_component_NSVC.receive(tmp_87, NULL, any_compref, NULL, NULL, NULL);
}
switch (tmp_88) {
case ALT_YES:
{
current_location.update_lineno(621);
/* NS_Emulation.ttcnpp, line 621 */
TTCN_Runtime::setverdict(FAIL,(TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("SNS-CONFIG from unexpected NSEI"),TTCN_Logger::end_event_log2str()));
current_location.update_lineno(622);
/* NS_Emulation.ttcnpp, line 622 */
TTCN_Runtime::stop_execution();
}
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
}
return ret_val;
}

void as__vcg__sns__pcu(boolean nodefault_modifier)
{
altstep_begin:
boolean block_flag = FALSE;
alt_status altstep_flag = ALT_UNCHECKED, default_flag = ALT_UNCHECKED;
for ( ; ; ) {
TTCN_Snapshot::take_new(block_flag);
if (altstep_flag != ALT_NO) {
altstep_flag = as__vcg__sns__pcu_instance(!block_flag);
if (altstep_flag == ALT_YES || altstep_flag == ALT_BREAK) return;
else if (altstep_flag == ALT_REPEAT) goto altstep_begin;
}
if (!nodefault_modifier && default_flag != ALT_NO) {
default_flag = TTCN_Default::try_altsteps(!block_flag);
if (default_flag == ALT_YES || default_flag == ALT_BREAK) return;
else if (default_flag == ALT_REPEAT) goto altstep_begin;
}
if (altstep_flag == ALT_NO && default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in altstep as_vcg_sns_pcu.");
else block_flag = TRUE;
}
}

Default_Base *activate_as__vcg__sns__pcu()
{
return new as__vcg__sns__pcu_Default();
}

alt_status as__vcg__sns__sgsn_instance(boolean first_alt_run)
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 629, TTCN_Location::LOCATION_ALTSTEP, "as_vcg_sns_sgsn");
current_location.update_lineno(630);
/* NS_Emulation.ttcnpp, line 630 */
SnsIndication sind;
current_location.update_lineno(631);
/* NS_Emulation.ttcnpp, line 631 */
COMPONENT vc;
alt_status ret_val = ALT_NO;
current_location.update_lineno(632);
/* NS_Emulation.ttcnpp, line 632 */
{
alt_status tmp_90;
{
SnsIndication_template tmp_89;
tmp_89.nsvci() = ANY_VALUE;
tmp_89.ns() = Osmocom__Gb__Types::tr__SNS__SIZE(INTEGER_template(const_cast< const NSConfiguration&>(NS__CT_component_g__config).nsei()), Osmocom__Gb__Types::tr__SNS__SIZE_rst__flag_defval, Osmocom__Gb__Types::tr__SNS__SIZE_max__nsvcs_defval, Osmocom__Gb__Types::tr__SNS__SIZE_num__v4_defval, Osmocom__Gb__Types::tr__SNS__SIZE_num__v6_defval);
tmp_90 = NS__CT_component_NSVC.receive(tmp_89, &(sind), any_compref, &(vc), NULL, NULL);
}
switch (tmp_90) {
case ALT_YES:
{
current_location.update_lineno(634);
/* NS_Emulation.ttcnpp, line 634 */
{
SnsRequest_template tmp_91;
tmp_91.nsvci() = const_cast< const SnsIndication&>(sind).nsvci();
tmp_91.ns() = Osmocom__Gb__Types::ts__SNS__SIZE__ACK(const_cast< const NSConfiguration&>(NS__CT_component_g__config).nsei(), Osmocom__Gb__Types::NsCause_template(OMIT_VALUE));
NS__CT_component_NSVC.send(tmp_91, COMPONENT(vc), NULL);
}
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
}
current_location.update_lineno(637);
/* NS_Emulation.ttcnpp, line 637 */
{
alt_status tmp_94;
{
SnsIndication_template tmp_92;
tmp_92.nsvci() = ANY_VALUE;
{
NS__Types::IP4__Elements_template tmp_93;
tmp_93.set_size(1);
tmp_93[0] = Osmocom__Gb__Types::tr__SNS__IPv4(CHARSTRING_template(const_cast< const NSConfiguration&>(NS__CT_component_g__config).nsvc()[0].provider().ip().remote__ip()), INTEGER_template(const_cast< const NSConfiguration&>(NS__CT_component_g__config).nsvc()[0].provider().ip().remote__udp__port()), Osmocom__Gb__Types::tr__SNS__IPv4_sig__weight_defval, Osmocom__Gb__Types::tr__SNS__IPv4_data__weight_defval);
tmp_92.ns() = Osmocom__Gb__Types::tr__SNS__CONFIG(INTEGER_template(const_cast< const NSConfiguration&>(NS__CT_component_g__config).nsei()), BOOLEAN_template(TRUE), tmp_93, Osmocom__Gb__Types::tr__SNS__CONFIG_v6_defval);
}
tmp_94 = NS__CT_component_NSVC.receive(tmp_92, &(sind), any_compref, &(vc), NULL, NULL);
}
switch (tmp_94) {
case ALT_YES:
{
current_location.update_lineno(642);
/* NS_Emulation.ttcnpp, line 642 */
{
SnsRequest_template tmp_95;
tmp_95.nsvci() = const_cast< const SnsIndication&>(sind).nsvci();
tmp_95.ns() = Osmocom__Gb__Types::ts__SNS__CONFIG__ACK(const_cast< const NSConfiguration&>(NS__CT_component_g__config).nsei(), Osmocom__Gb__Types::NsCause_template(OMIT_VALUE));
NS__CT_component_NSVC.send(tmp_95, COMPONENT(vc), NULL);
}
current_location.update_lineno(646);
/* NS_Emulation.ttcnpp, line 646 */
f__broadcast__ns__ctrl(NsCtrlRequest_template(NsCtrlRequest::ForceAliveState));
current_location.update_lineno(648);
/* NS_Emulation.ttcnpp, line 648 */
NS__Types::IP4__Elements_template v4;
current_location.update_lineno(649);
/* NS_Emulation.ttcnpp, line 649 */
NS__Types::IP6__Elements_template v6;
current_location.update_lineno(650);
/* NS_Emulation.ttcnpp, line 650 */
{
NS__Types::IP4__Elements_template tmp_96;
NS__Types::IP6__Elements_template tmp_97;
gen__sns__ip__elems(tmp_96, tmp_97);
if (tmp_96.is_bound()) v4 = tmp_96;
if (tmp_97.is_bound()) v6 = tmp_97;
}
current_location.update_lineno(651);
/* NS_Emulation.ttcnpp, line 651 */
{
SnsRequest_template tmp_98;
tmp_98.nsvci() = const_cast< const SnsIndication&>(sind).nsvci();
tmp_98.ns() = Osmocom__Gb__Types::ts__SNS__CONFIG(const_cast< const NSConfiguration&>(NS__CT_component_g__config).nsei(), TRUE, v4, v6);
NS__CT_component_NSVC.send(tmp_98, COMPONENT(vc), NULL);
}
current_location.update_lineno(653);
/* NS_Emulation.ttcnpp, line 653 */
{
tmp_99:
alt_status tmp_99_alt_flag_0 = ALT_MAYBE;
alt_status tmp_99_alt_flag_1 = ALT_MAYBE;
alt_status tmp_99_alt_flag_2 = ALT_MAYBE;
alt_status tmp_99_default_flag = ALT_MAYBE;
boolean first_run = TRUE;
TTCN_Snapshot::take_new(FALSE);
for ( ; ; ) {
if (tmp_99_alt_flag_0 == ALT_MAYBE) {
current_location.update_lineno(654);
/* NS_Emulation.ttcnpp, line 654 */
tmp_99_alt_flag_0 = as__ns__common__status_instance(first_run);
if (tmp_99_alt_flag_0 == ALT_REPEAT) goto tmp_99;
if (tmp_99_alt_flag_0 == ALT_BREAK) break;
if (tmp_99_alt_flag_0 == ALT_YES) {
current_location.update_lineno(655);
/* NS_Emulation.ttcnpp, line 655 */
goto tmp_99;
}
}
if (tmp_99_alt_flag_1 == ALT_MAYBE) {
current_location.update_lineno(657);
/* NS_Emulation.ttcnpp, line 657 */
{
SnsIndication_template tmp_100;
tmp_100.nsvci() = const_cast< const SnsIndication&>(sind).nsvci();
tmp_100.ns() = Osmocom__Gb__Types::tr__SNS__CONFIG__ACK(INTEGER_template(const_cast< const NSConfiguration&>(NS__CT_component_g__config).nsei()), Osmocom__Gb__Types::NsCause_template(OMIT_VALUE));
tmp_99_alt_flag_1 = NS__CT_component_NSVC.receive(tmp_100, NULL, COMPONENT_template(vc), NULL, NULL, NULL);
}
if (tmp_99_alt_flag_1 == ALT_YES) {
current_location.update_lineno(660);
/* NS_Emulation.ttcnpp, line 660 */
TTCN_Logger::log_str(TTCN_USER, "SNS Config succeeded. Sending Alive");
current_location.update_lineno(662);
/* NS_Emulation.ttcnpp, line 662 */
f__broadcast__ns__ctrl(NsCtrlRequest_template(NsCtrlRequest::StartAliveProcedure));
break;
}
}
if (tmp_99_alt_flag_2 == ALT_MAYBE) {
current_location.update_lineno(664);
/* NS_Emulation.ttcnpp, line 664 */
{
SnsIndication_template tmp_101;
tmp_101.nsvci() = const_cast< const SnsIndication&>(sind).nsvci();
tmp_101.ns() = Osmocom__Gb__Types::tr__SNS__CONFIG__ACK(INTEGER_template(const_cast< const NSConfiguration&>(NS__CT_component_g__config).nsei()), Osmocom__Gb__Types::NsCause_template(ANY_VALUE));
tmp_99_alt_flag_2 = NS__CT_component_NSVC.receive(tmp_101, NULL, COMPONENT_template(vc), NULL, NULL, NULL);
}
if (tmp_99_alt_flag_2 == ALT_YES) {
current_location.update_lineno(666);
/* NS_Emulation.ttcnpp, line 666 */
TTCN_Runtime::setverdict(FAIL,(TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Unexpected SNS-CONFIG-NACK"),TTCN_Logger::end_event_log2str()));
current_location.update_lineno(667);
/* NS_Emulation.ttcnpp, line 667 */
TTCN_Runtime::stop_execution();
}
}
if (tmp_99_default_flag == ALT_MAYBE) {
tmp_99_default_flag = TTCN_Default::try_altsteps(first_run);
if (tmp_99_default_flag == ALT_YES || tmp_99_default_flag == ALT_BREAK) break;
else if (tmp_99_default_flag == ALT_REPEAT) goto tmp_99;
}
current_location.update_lineno(653);
/* NS_Emulation.ttcnpp, line 653 */
if (tmp_99_alt_flag_0 == ALT_NO && tmp_99_alt_flag_1 == ALT_NO && tmp_99_alt_flag_2 == ALT_NO && tmp_99_default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in the alt statement in file NS_Emulation.ttcnpp between lines 653 and 669.");
TTCN_Snapshot::take_new(TRUE);
first_run = FALSE;
}
}
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
}
current_location.update_lineno(671);
/* NS_Emulation.ttcnpp, line 671 */
{
alt_status tmp_103;
{
SnsIndication_template tmp_102;
tmp_102.nsvci() = ANY_VALUE;
tmp_102.ns() = Osmocom__Gb__Types::tr__SNS__CONFIG(INTEGER_template(const_cast< const NSConfiguration&>(NS__CT_component_g__config).nsei()), BOOLEAN_template(FALSE), NS__Types::IP4__Elements_template(ANY_VALUE), Osmocom__Gb__Types::tr__SNS__CONFIG_v6_defval);
tmp_103 = NS__CT_component_NSVC.receive(tmp_102, NULL, any_compref, NULL, NULL, NULL);
}
switch (tmp_103) {
case ALT_YES:
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
}
current_location.update_lineno(672);
/* NS_Emulation.ttcnpp, line 672 */
{
alt_status tmp_105;
{
SnsIndication_template tmp_104;
tmp_104.nsvci() = ANY_VALUE;
tmp_104.ns() = Osmocom__Gb__Types::tr__SNS__CONFIG(INTEGER_template(const_cast< const NSConfiguration&>(NS__CT_component_g__config).nsei()), BOOLEAN_template(TRUE), NS__Types::IP4__Elements_template(ANY_VALUE), Osmocom__Gb__Types::tr__SNS__CONFIG_v6_defval);
tmp_105 = NS__CT_component_NSVC.receive(tmp_104, NULL, any_compref, NULL, NULL, NULL);
}
switch (tmp_105) {
case ALT_YES:
{
current_location.update_lineno(673);
/* NS_Emulation.ttcnpp, line 673 */
TTCN_Runtime::setverdict(FAIL,(TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Unexpected SNS-CONFIG content"),TTCN_Logger::end_event_log2str()));
current_location.update_lineno(674);
/* NS_Emulation.ttcnpp, line 674 */
TTCN_Runtime::stop_execution();
}
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
}
current_location.update_lineno(676);
/* NS_Emulation.ttcnpp, line 676 */
{
alt_status tmp_107;
{
SnsIndication_template tmp_106;
tmp_106.nsvci() = ANY_VALUE;
tmp_106.ns() = Osmocom__Gb__Types::tr__SNS__CONFIG(INTEGER_template(ANY_VALUE), BOOLEAN_template(ANY_VALUE), NS__Types::IP4__Elements_template(ANY_VALUE), Osmocom__Gb__Types::tr__SNS__CONFIG_v6_defval);
tmp_107 = NS__CT_component_NSVC.receive(tmp_106, NULL, any_compref, NULL, NULL, NULL);
}
switch (tmp_107) {
case ALT_YES:
{
current_location.update_lineno(677);
/* NS_Emulation.ttcnpp, line 677 */
TTCN_Runtime::setverdict(FAIL,(TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("SNS-CONFIG from unexpected NSEI"),TTCN_Logger::end_event_log2str()));
current_location.update_lineno(678);
/* NS_Emulation.ttcnpp, line 678 */
TTCN_Runtime::stop_execution();
}
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
}
return ret_val;
}

void as__vcg__sns__sgsn(boolean nodefault_modifier)
{
altstep_begin:
boolean block_flag = FALSE;
alt_status altstep_flag = ALT_UNCHECKED, default_flag = ALT_UNCHECKED;
for ( ; ; ) {
TTCN_Snapshot::take_new(block_flag);
if (altstep_flag != ALT_NO) {
altstep_flag = as__vcg__sns__sgsn_instance(!block_flag);
if (altstep_flag == ALT_YES || altstep_flag == ALT_BREAK) return;
else if (altstep_flag == ALT_REPEAT) goto altstep_begin;
}
if (!nodefault_modifier && default_flag != ALT_NO) {
default_flag = TTCN_Default::try_altsteps(!block_flag);
if (default_flag == ALT_YES || default_flag == ALT_BREAK) return;
else if (default_flag == ALT_REPEAT) goto altstep_begin;
}
if (altstep_flag == ALT_NO && default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in altstep as_vcg_sns_sgsn.");
else block_flag = TRUE;
}
}

Default_Base *activate_as__vcg__sns__sgsn()
{
return new as__vcg__sns__sgsn_Default();
}

void NSVCStart(const NSVCConfiguration& init__config, const NSConfiguration& init__g__config, const CHARSTRING& id, const COMPONENT& nsp__ip)
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 710, TTCN_Location::LOCATION_FUNCTION, "NSVCStart");
current_location.update_lineno(712);
/* NS_Emulation.ttcnpp, line 712 */
NSVC__CT_component_g__nsvc__config = init__config;
current_location.update_lineno(713);
/* NS_Emulation.ttcnpp, line 713 */
NSVC__CT_component_g__config = init__g__config;
current_location.update_lineno(714);
/* NS_Emulation.ttcnpp, line 714 */
f__init(((id + cs_3) + int2str(const_cast< const NSVCConfiguration&>(NSVC__CT_component_g__nsvc__config).nsvci())), nsp__ip);
current_location.update_lineno(715);
/* NS_Emulation.ttcnpp, line 715 */
f__ScanEvents();
}

void start_NSVCStart(const COMPONENT& component_reference, const NSVCConfiguration& init__config, const NSConfiguration& init__g__config, const CHARSTRING& id, const COMPONENT& nsp__ip)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function NSVCStart(");
init__config.log();
TTCN_Logger::log_event_str(", ");
init__g__config.log();
TTCN_Logger::log_event_str(", ");
id.log();
TTCN_Logger::log_event_str(", ");
nsp__ip.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "NS_Emulation", "NSVCStart", text_buf);
init__config.encode_text(text_buf);
init__g__config.encode_text(text_buf);
id.encode_text(text_buf);
nsp__ip.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

void f__init(const CHARSTRING& id, const COMPONENT& nsp__ip)
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 718, TTCN_Location::LOCATION_FUNCTION, "f_init");
current_location.update_lineno(719);
/* NS_Emulation.ttcnpp, line 719 */
{
boolean tmp_113;
{
boolean tmp_110 = NSVC__CT_component_g__nsvc__config.is_bound();
if(tmp_110) {
const NSVCConfiguration& tmp_111 = NSVC__CT_component_g__nsvc__config;
const NSVCConfigurationP& tmp_112 = tmp_111.provider();
tmp_110 = tmp_112.is_bound();
if (tmp_110) {
tmp_110 = tmp_112.ischosen(NSVCConfigurationP::ALT_ip);
}
}
tmp_113 = tmp_110;
}
if (tmp_113) {
current_location.update_lineno(721);
/* NS_Emulation.ttcnpp, line 721 */
NSVC__CT_component_vc__NSP__IP = nsp__ip;
}
else {
current_location.update_lineno(723);
/* NS_Emulation.ttcnpp, line 723 */
boolean tmp_118;
{
boolean tmp_115 = NSVC__CT_component_g__nsvc__config.is_bound();
if(tmp_115) {
const NSVCConfiguration& tmp_116 = NSVC__CT_component_g__nsvc__config;
const NSVCConfigurationP& tmp_117 = tmp_116.provider();
tmp_115 = tmp_117.is_bound();
if (tmp_115) {
tmp_115 = tmp_117.ischosen(NSVCConfigurationP::ALT_fr);
}
}
tmp_118 = tmp_115;
}
if (tmp_118) {
current_location.update_lineno(724);
/* NS_Emulation.ttcnpp, line 724 */
NSVC__CT_component_vc__NSP__FR = TTCN_Runtime::create_component("NS_Provider_FR", "NS_Provider_FR_CT", (id + cs_4), NULL, TRUE);
current_location.update_lineno(725);
/* NS_Emulation.ttcnpp, line 725 */
TTCN_Runtime::connect_port(self, NSVC__CT_component_NSCP.get_name(), NSVC__CT_component_vc__NSP__FR, NS__Provider__CT_component_NSE.get_name());
current_location.update_lineno(726);
/* NS_Emulation.ttcnpp, line 726 */
NS__Provider__FR::start_main_(NSVC__CT_component_vc__NSP__FR, NSVC__CT_component_g__nsvc__config, NSVC__CT_component_g__config, id);
}
else {
current_location.update_lineno(729);
/* NS_Emulation.ttcnpp, line 729 */
Misc__Helpers::f__shutdown(cs_2, 729, FAIL, cs_5);
}
}
}
current_location.update_lineno(732);
/* NS_Emulation.ttcnpp, line 732 */
f__change__state(NsvcState::NSVC__S__DEAD__BLOCKED);
}

void start_f__init(const COMPONENT& component_reference, const CHARSTRING& id, const COMPONENT& nsp__ip)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_init(");
id.log();
TTCN_Logger::log_event_str(", ");
nsp__ip.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "NS_Emulation", "f_init", text_buf);
id.encode_text(text_buf);
nsp__ip.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

void f__change__state(const NsvcState& new__state)
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 735, TTCN_Location::LOCATION_FUNCTION, "f_change_state");
current_location.update_lineno(736);
/* NS_Emulation.ttcnpp, line 736 */
NsvcState old__state(NSVC__CT_component_vc__state);
current_location.update_lineno(737);
/* NS_Emulation.ttcnpp, line 737 */
NSVC__CT_component_vc__state = new__state;
current_location.update_lineno(738);
/* NS_Emulation.ttcnpp, line 738 */
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("NSVC ");
const_cast< const NSVCConfiguration&>(NSVC__CT_component_g__nsvc__config).nsvci().log();
TTCN_Logger::log_event_str(" State Transition: ");
old__state.log();
TTCN_Logger::log_event_str(" -> ");
new__state.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(739);
/* NS_Emulation.ttcnpp, line 739 */
NSVC__CT_component_NS__SP.send(ts__NsStsInd(const_cast< const NSConfiguration&>(NSVC__CT_component_g__config).nsei(), const_cast< const NSVCConfiguration&>(NSVC__CT_component_g__nsvc__config).nsvci(), old__state, new__state, ts__NsStsInd_first__or__last_defval), FALSE, NULL);
}

void start_f__change__state(const COMPONENT& component_reference, const NsvcState& new__state)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_change_state(");
new__state.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "NS_Emulation", "f_change_state", text_buf);
new__state.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

void f__sendReset()
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 742, TTCN_Location::LOCATION_FUNCTION, "f_sendReset");
current_location.update_lineno(743);
/* NS_Emulation.ttcnpp, line 743 */
NSVC__CT_component_NSCP.send(Osmocom__Gb__Types::ts__NS__RESET(Osmocom__Gb__Types::NsCause::NS__CAUSE__OM__INTERVENTION, const_cast< const NSVCConfiguration&>(NSVC__CT_component_g__nsvc__config).nsvci(), const_cast< const NSConfiguration&>(NSVC__CT_component_g__config).nsei()), FALSE, NULL);
current_location.update_lineno(744);
/* NS_Emulation.ttcnpp, line 744 */
NSVC__CT_component_Tns__reset.start();
current_location.update_lineno(745);
/* NS_Emulation.ttcnpp, line 745 */
NSVC__CT_component_vc__state = NsvcState::NSVC__S__WAIT__RESET;
}

void start_f__sendReset(const COMPONENT& component_reference)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_sendReset(");
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "NS_Emulation", "f_sendReset", text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

void f__sendAlive()
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 748, TTCN_Location::LOCATION_FUNCTION, "f_sendAlive");
current_location.update_lineno(749);
/* NS_Emulation.ttcnpp, line 749 */
NSVC__CT_component_NSCP.send(Osmocom__Gb__Types::t__NS__ALIVE, FALSE, NULL);
current_location.update_lineno(750);
/* NS_Emulation.ttcnpp, line 750 */
NSVC__CT_component_Tns__alive.start();
}

void start_f__sendAlive(const COMPONENT& component_reference)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_sendAlive(");
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "NS_Emulation", "f_sendAlive", text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

void f__sendUnblock()
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 753, TTCN_Location::LOCATION_FUNCTION, "f_sendUnblock");
current_location.update_lineno(754);
/* NS_Emulation.ttcnpp, line 754 */
NSVC__CT_component_NSCP.send(Osmocom__Gb__Types::t__NS__UNBLOCK, FALSE, NULL);
current_location.update_lineno(755);
/* NS_Emulation.ttcnpp, line 755 */
NSVC__CT_component_Tns__block.start();
}

void start_f__sendUnblock(const COMPONENT& component_reference)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_sendUnblock(");
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "NS_Emulation", "f_sendUnblock", text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

void f__sendBlock(const Osmocom__Gb__Types::NsCause& cause)
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 758, TTCN_Location::LOCATION_FUNCTION, "f_sendBlock");
current_location.update_lineno(759);
/* NS_Emulation.ttcnpp, line 759 */
NSVC__CT_component_NSCP.send(Osmocom__Gb__Types::ts__NS__BLOCK(cause, const_cast< const NSVCConfiguration&>(NSVC__CT_component_g__nsvc__config).nsvci()), FALSE, NULL);
current_location.update_lineno(760);
/* NS_Emulation.ttcnpp, line 760 */
NSVC__CT_component_Tns__block.start();
}

void start_f__sendBlock(const COMPONENT& component_reference, const Osmocom__Gb__Types::NsCause& cause)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_sendBlock(");
cause.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "NS_Emulation", "f_sendBlock", text_buf);
cause.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

alt_status as__allstate_instance(boolean first_alt_run)
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 763, TTCN_Location::LOCATION_ALTSTEP, "as_allstate");
current_location.update_lineno(764);
/* NS_Emulation.ttcnpp, line 764 */
NS__Types::PDU__NS rf;
current_location.update_lineno(765);
/* NS_Emulation.ttcnpp, line 765 */
Socket__API__Definitions::PortEvent evt;
alt_status ret_val = ALT_NO;
current_location.update_lineno(767);
/* NS_Emulation.ttcnpp, line 767 */
{
alt_status tmp_123;
{
NS__Provider__Evt_template tmp_122;
tmp_122.link__status() = NS__Provider__LinkStatus::NS__PROV__LINK__STATUS__DOWN;
tmp_123 = NSVC__CT_component_NSCP.receive(tmp_122, NULL, any_compref, NULL, NULL, NULL);
}
switch (tmp_123) {
case ALT_YES:
{
current_location.update_lineno(768);
/* NS_Emulation.ttcnpp, line 768 */
TTCN_Logger::log_str(TTCN_USER, "Provider Link went down");
current_location.update_lineno(769);
/* NS_Emulation.ttcnpp, line 769 */
NSVC__CT_component_Tns__test.stop();
current_location.update_lineno(770);
/* NS_Emulation.ttcnpp, line 770 */
NSVC__CT_component_Tns__alive.stop();
current_location.update_lineno(771);
/* NS_Emulation.ttcnpp, line 771 */
f__change__state(NsvcState::NSVC__S__DEAD__BLOCKED);
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
}
current_location.update_lineno(774);
/* NS_Emulation.ttcnpp, line 774 */
switch (NSVC__CT_component_NS__SP.receive(NsCtrlRequest_template(NsCtrlRequest::DisableReq), NULL, any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(776);
/* NS_Emulation.ttcnpp, line 776 */
f__change__state(NsvcState::NSVC__S__DEAD__BLOCKED);
current_location.update_lineno(777);
/* NS_Emulation.ttcnpp, line 777 */
TTCN_Logger::log_str(TTCN_USER, "Disabling NSVC on user request");
current_location.update_lineno(778);
/* NS_Emulation.ttcnpp, line 778 */
f__change__state(NsvcState::NSVC__S__DISABLED);
current_location.update_lineno(779);
/* NS_Emulation.ttcnpp, line 779 */
NSVC__CT_component_Tns__test.stop();
current_location.update_lineno(780);
/* NS_Emulation.ttcnpp, line 780 */
NSVC__CT_component_Tns__alive.stop();
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
current_location.update_lineno(784);
/* NS_Emulation.ttcnpp, line 784 */
static boolean guard_expr_2 = FALSE;
if (first_alt_run) {
guard_expr_2 = NSVC__CT_component_Tns__alive.running(NULL);
}
if (guard_expr_2) {
current_location.update_lineno(784);
/* NS_Emulation.ttcnpp, line 784 */
switch (NSVC__CT_component_Tns__alive.timeout(NULL)) {
case ALT_YES:
{
current_location.update_lineno(785);
/* NS_Emulation.ttcnpp, line 785 */
TTCN_Logger::log_str(TTCN_USER, "Tns-alive expired: changing to DEAD_BLOCKED + starting Tns-test");
current_location.update_lineno(786);
/* NS_Emulation.ttcnpp, line 786 */
f__change__state(NsvcState::NSVC__S__DEAD__BLOCKED);
current_location.update_lineno(787);
/* NS_Emulation.ttcnpp, line 787 */
NSVC__CT_component_Tns__test.start();
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
}
current_location.update_lineno(790);
/* NS_Emulation.ttcnpp, line 790 */
static boolean guard_expr_3 = FALSE;
if (first_alt_run) {
guard_expr_3 = NSVC__CT_component_Tns__test.running(NULL);
}
if (guard_expr_3) {
current_location.update_lineno(790);
/* NS_Emulation.ttcnpp, line 790 */
switch (NSVC__CT_component_Tns__test.timeout(NULL)) {
case ALT_YES:
{
current_location.update_lineno(791);
/* NS_Emulation.ttcnpp, line 791 */
TTCN_Logger::log_str(TTCN_USER, "Tns-test expired: sending NS-ALIVE");
current_location.update_lineno(792);
/* NS_Emulation.ttcnpp, line 792 */
f__sendAlive();
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
}
current_location.update_lineno(796);
/* NS_Emulation.ttcnpp, line 796 */
static boolean guard_expr_4 = FALSE;
if (first_alt_run) {
guard_expr_4 = NSVC__CT_component_Tns__alive.running(NULL);
}
if (guard_expr_4) {
current_location.update_lineno(796);
/* NS_Emulation.ttcnpp, line 796 */
switch (NSVC__CT_component_NSCP.receive(Osmocom__Gb__Types::t__NS__ALIVE__ACK, NULL, any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(797);
/* NS_Emulation.ttcnpp, line 797 */
TTCN_Logger::log_str(TTCN_USER, "Rx NS-ALIVE-ACK: stopping Tns-alive; starting Tns-test");
current_location.update_lineno(798);
/* NS_Emulation.ttcnpp, line 798 */
NSVC__CT_component_Tns__alive.stop();
current_location.update_lineno(799);
/* NS_Emulation.ttcnpp, line 799 */
NSVC__CT_component_Tns__test.start();
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
}
current_location.update_lineno(803);
/* NS_Emulation.ttcnpp, line 803 */
switch (NSVC__CT_component_NSCP.receive(Osmocom__Gb__Types::t__NS__ALIVE, NULL, any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(804);
/* NS_Emulation.ttcnpp, line 804 */
NSVC__CT_component_NSCP.send(Osmocom__Gb__Types::t__NS__ALIVE__ACK, FALSE, NULL);
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
current_location.update_lineno(808);
/* NS_Emulation.ttcnpp, line 808 */
switch (NSVC__CT_component_NSCP.receive(Osmocom__Gb__Types::tr__NS__BLOCK(Osmocom__Gb__Types::NsCause_template(ANY_VALUE), INTEGER_template(ANY_VALUE)), &(rf), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(809);
/* NS_Emulation.ttcnpp, line 809 */
TTCN_Logger::log_str(TTCN_USER, "Rx NS-BLOCK for unknown NSVCI");
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
current_location.update_lineno(813);
/* NS_Emulation.ttcnpp, line 813 */
static boolean guard_expr_7 = FALSE;
if (first_alt_run) {
guard_expr_7 = (!(const_cast< const NSConfiguration&>(NSVC__CT_component_g__config).handle__sns()));
}
if (guard_expr_7) {
current_location.update_lineno(813);
/* NS_Emulation.ttcnpp, line 813 */
switch (as__handle__reset_instance(first_alt_run)) {
case ALT_YES:
return ALT_YES;
case ALT_REPEAT:
return ALT_REPEAT;
case ALT_BREAK:
return ALT_BREAK;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
}
current_location.update_lineno(815);
/* NS_Emulation.ttcnpp, line 815 */
static boolean guard_expr_8 = FALSE;
if (first_alt_run) {
boolean tmp_124;
tmp_124 = const_cast< const NSConfiguration&>(NSVC__CT_component_g__config).handle__sns();
if (tmp_124) {
boolean tmp_125 = NSVC__CT_component_g__nsvc__config.is_bound();
if(tmp_125) {
const NSVCConfiguration& tmp_126 = NSVC__CT_component_g__nsvc__config;
const NSVCConfigurationP& tmp_127 = tmp_126.provider();
tmp_125 = tmp_127.is_bound();
if (tmp_125) {
tmp_125 = tmp_127.ischosen(NSVCConfigurationP::ALT_ip);
}
}
tmp_124 = tmp_125;
}
guard_expr_8 = tmp_124;
}
if (guard_expr_8) {
current_location.update_lineno(815);
/* NS_Emulation.ttcnpp, line 815 */
switch (as__nsvc__sns_instance(first_alt_run)) {
case ALT_YES:
return ALT_YES;
case ALT_REPEAT:
return ALT_REPEAT;
case ALT_BREAK:
return ALT_BREAK;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
}
current_location.update_lineno(818);
/* NS_Emulation.ttcnpp, line 818 */
switch (NSVC__CT_component_NSCP.receive(Osmocom__Gb__Types::tr__NS__STATUS(Osmocom__Gb__Types::NsCause_template(ANY_VALUE)), &(rf), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(819);
/* NS_Emulation.ttcnpp, line 819 */
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("Rx NS-STATUS ");
rf.log();
TTCN_Logger::log_event_str(" in state ");
NSVC__CT_component_vc__state.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
current_location.update_lineno(822);
/* NS_Emulation.ttcnpp, line 822 */
switch (NSVC__CT_component_NSCP.receive(NS__Types::PDU__NS_template(ANY_VALUE), &(rf), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(823);
/* NS_Emulation.ttcnpp, line 823 */
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("Rx Unexpected NS PDU ");
rf.log();
TTCN_Logger::log_event_str(" in state ");
NSVC__CT_component_vc__state.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(824);
/* NS_Emulation.ttcnpp, line 824 */
NSVC__CT_component_NSCP.send(Osmocom__Gb__Types::ts__NS__STATUS(Osmocom__Gb__Types::NsCause::NS__CAUSE__PDU__NOT__COMPATIBLE__WITH__PROTOCOL__STATE, rf), FALSE, NULL);
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
return ret_val;
}

void as__allstate(boolean nodefault_modifier)
{
altstep_begin:
boolean block_flag = FALSE;
alt_status altstep_flag = ALT_UNCHECKED, default_flag = ALT_UNCHECKED;
for ( ; ; ) {
TTCN_Snapshot::take_new(block_flag);
if (altstep_flag != ALT_NO) {
altstep_flag = as__allstate_instance(!block_flag);
if (altstep_flag == ALT_YES || altstep_flag == ALT_BREAK) return;
else if (altstep_flag == ALT_REPEAT) goto altstep_begin;
}
if (!nodefault_modifier && default_flag != ALT_NO) {
default_flag = TTCN_Default::try_altsteps(!block_flag);
if (default_flag == ALT_YES || default_flag == ALT_BREAK) return;
else if (default_flag == ALT_REPEAT) goto altstep_begin;
}
if (altstep_flag == ALT_NO && default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in altstep as_allstate.");
else block_flag = TRUE;
}
}

Default_Base *activate_as__allstate()
{
return new as__allstate_Default();
}

alt_status as__disabled_instance(boolean first_alt_run)
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 828, TTCN_Location::LOCATION_ALTSTEP, "as_disabled");
alt_status ret_val = ALT_NO;
current_location.update_lineno(829);
/* NS_Emulation.ttcnpp, line 829 */
static boolean guard_expr_0 = FALSE;
if (first_alt_run) {
guard_expr_0 = (const_cast< const NSConfiguration&>(NSVC__CT_component_g__config).handle__sns() == TRUE);
}
if (guard_expr_0) {
current_location.update_lineno(829);
/* NS_Emulation.ttcnpp, line 829 */
switch (NSVC__CT_component_NS__SP.receive(NsCtrlRequest_template(NsCtrlRequest::EnableReq), NULL, any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(830);
/* NS_Emulation.ttcnpp, line 830 */
f__change__state(NsvcState::NSVC__S__ALIVE__UNBLOCKED);
current_location.update_lineno(831);
/* NS_Emulation.ttcnpp, line 831 */
f__sendAlive();
current_location.update_lineno(832);
/* NS_Emulation.ttcnpp, line 832 */
NSVC__CT_component_Tns__test.start();
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
}
current_location.update_lineno(834);
/* NS_Emulation.ttcnpp, line 834 */
static boolean guard_expr_1 = FALSE;
if (first_alt_run) {
guard_expr_1 = (const_cast< const NSConfiguration&>(NSVC__CT_component_g__config).handle__sns() == FALSE);
}
if (guard_expr_1) {
current_location.update_lineno(834);
/* NS_Emulation.ttcnpp, line 834 */
switch (NSVC__CT_component_NS__SP.receive(NsCtrlRequest_template(NsCtrlRequest::EnableReq), NULL, any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(835);
/* NS_Emulation.ttcnpp, line 835 */
f__change__state(NsvcState::NSVC__S__DEAD__BLOCKED);
current_location.update_lineno(836);
/* NS_Emulation.ttcnpp, line 836 */
NSVC__CT_component_Tns__test.start();
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
}
current_location.update_lineno(839);
/* NS_Emulation.ttcnpp, line 839 */
switch (NSVC__CT_component_NSCP.receive(any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(840);
/* NS_Emulation.ttcnpp, line 840 */
TTCN_Logger::log_str(TTCN_USER, "Dropping inbound NS mesage as NS-VC is disabled");
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
current_location.update_lineno(842);
/* NS_Emulation.ttcnpp, line 842 */
switch (NSVC__CT_component_NS__SP.receive(any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(843);
/* NS_Emulation.ttcnpp, line 843 */
TTCN_Logger::log_str(TTCN_USER, "Dropping user primitive as NS-VC is disabled");
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
return ret_val;
}

void as__disabled(boolean nodefault_modifier)
{
altstep_begin:
boolean block_flag = FALSE;
alt_status altstep_flag = ALT_UNCHECKED, default_flag = ALT_UNCHECKED;
for ( ; ; ) {
TTCN_Snapshot::take_new(block_flag);
if (altstep_flag != ALT_NO) {
altstep_flag = as__disabled_instance(!block_flag);
if (altstep_flag == ALT_YES || altstep_flag == ALT_BREAK) return;
else if (altstep_flag == ALT_REPEAT) goto altstep_begin;
}
if (!nodefault_modifier && default_flag != ALT_NO) {
default_flag = TTCN_Default::try_altsteps(!block_flag);
if (default_flag == ALT_YES || default_flag == ALT_BREAK) return;
else if (default_flag == ALT_REPEAT) goto altstep_begin;
}
if (altstep_flag == ALT_NO && default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in altstep as_disabled.");
else block_flag = TRUE;
}
}

Default_Base *activate_as__disabled()
{
return new as__disabled_Default();
}

alt_status as__handle__reset_instance(boolean first_alt_run)
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 847, TTCN_Location::LOCATION_ALTSTEP, "as_handle_reset");
current_location.update_lineno(848);
/* NS_Emulation.ttcnpp, line 848 */
NS__Types::PDU__NS rf;
alt_status ret_val = ALT_NO;
current_location.update_lineno(850);
/* NS_Emulation.ttcnpp, line 850 */
static boolean guard_expr_0 = FALSE;
if (first_alt_run) {
guard_expr_0 = const_cast< const NSConfiguration&>(NSVC__CT_component_g__config).role__sgsn();
}
if (guard_expr_0) {
current_location.update_lineno(850);
/* NS_Emulation.ttcnpp, line 850 */
alt_status tmp_129;
{
NS__Provider__Evt_template tmp_128;
tmp_128.link__status() = NS__Provider__LinkStatus::NS__PROV__LINK__STATUS__UP;
tmp_129 = NSVC__CT_component_NSCP.receive(tmp_128, NULL, any_compref, NULL, NULL, NULL);
}
switch (tmp_129) {
case ALT_YES:
{
current_location.update_lineno(851);
/* NS_Emulation.ttcnpp, line 851 */
TTCN_Logger::log_str(TTCN_USER, "Provider Link came up: waiting for NS-RESET");
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
}
current_location.update_lineno(854);
/* NS_Emulation.ttcnpp, line 854 */
static boolean guard_expr_1 = FALSE;
if (first_alt_run) {
guard_expr_1 = (!(const_cast< const NSConfiguration&>(NSVC__CT_component_g__config).role__sgsn()));
}
if (guard_expr_1) {
current_location.update_lineno(854);
/* NS_Emulation.ttcnpp, line 854 */
alt_status tmp_131;
{
NS__Provider__Evt_template tmp_130;
tmp_130.link__status() = NS__Provider__LinkStatus::NS__PROV__LINK__STATUS__UP;
tmp_131 = NSVC__CT_component_NSCP.receive(tmp_130, NULL, any_compref, NULL, NULL, NULL);
}
switch (tmp_131) {
case ALT_YES:
{
current_location.update_lineno(855);
/* NS_Emulation.ttcnpp, line 855 */
TTCN_Logger::log_str(TTCN_USER, "Provider Link came up: sending NS-RESET");
current_location.update_lineno(856);
/* NS_Emulation.ttcnpp, line 856 */
f__sendReset();
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
}
current_location.update_lineno(860);
/* NS_Emulation.ttcnpp, line 860 */
switch (NSVC__CT_component_NSCP.receive(Osmocom__Gb__Types::tr__NS__RESET(Osmocom__Gb__Types::NsCause_template(ANY_VALUE), INTEGER_template(const_cast< const NSVCConfiguration&>(NSVC__CT_component_g__nsvc__config).nsvci()), INTEGER_template(const_cast< const NSConfiguration&>(NSVC__CT_component_g__config).nsei())), &(rf), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(861);
/* NS_Emulation.ttcnpp, line 861 */
f__change__state(NsvcState::NSVC__S__ALIVE__BLOCKED);
current_location.update_lineno(862);
/* NS_Emulation.ttcnpp, line 862 */
NSVC__CT_component_NSCP.send(Osmocom__Gb__Types::ts__NS__RESET__ACK(const_cast< const NSVCConfiguration&>(NSVC__CT_component_g__nsvc__config).nsvci(), const_cast< const NSConfiguration&>(NSVC__CT_component_g__config).nsei()), FALSE, NULL);
current_location.update_lineno(863);
/* NS_Emulation.ttcnpp, line 863 */
TTCN_Logger::log_str(TTCN_USER, "Rx NS-RESET: Sending NS-ALIVE");
current_location.update_lineno(864);
/* NS_Emulation.ttcnpp, line 864 */
f__sendAlive();
current_location.update_lineno(865);
/* NS_Emulation.ttcnpp, line 865 */
NSVC__CT_component_Tns__test.start();
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
current_location.update_lineno(869);
/* NS_Emulation.ttcnpp, line 869 */
switch (NSVC__CT_component_NSCP.receive(Osmocom__Gb__Types::tr__NS__RESET(Osmocom__Gb__Types::NsCause_template(ANY_VALUE), INTEGER_template(ANY_VALUE), INTEGER_template(ANY_VALUE)), &(rf), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(870);
/* NS_Emulation.ttcnpp, line 870 */
TTCN_Logger::log_str(TTCN_USER, "Rx NS-RESET for unknown NSEI/NSVCI");
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
return ret_val;
}

void as__handle__reset(boolean nodefault_modifier)
{
altstep_begin:
boolean block_flag = FALSE;
alt_status altstep_flag = ALT_UNCHECKED, default_flag = ALT_UNCHECKED;
for ( ; ; ) {
TTCN_Snapshot::take_new(block_flag);
if (altstep_flag != ALT_NO) {
altstep_flag = as__handle__reset_instance(!block_flag);
if (altstep_flag == ALT_YES || altstep_flag == ALT_BREAK) return;
else if (altstep_flag == ALT_REPEAT) goto altstep_begin;
}
if (!nodefault_modifier && default_flag != ALT_NO) {
default_flag = TTCN_Default::try_altsteps(!block_flag);
if (default_flag == ALT_YES || default_flag == ALT_BREAK) return;
else if (default_flag == ALT_REPEAT) goto altstep_begin;
}
if (altstep_flag == ALT_NO && default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in altstep as_handle_reset.");
else block_flag = TRUE;
}
}

Default_Base *activate_as__handle__reset()
{
return new as__handle__reset_Default();
}

alt_status as__nsvc__sns_instance(boolean first_alt_run)
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 875, TTCN_Location::LOCATION_ALTSTEP, "as_nsvc_sns");
current_location.update_lineno(876);
/* NS_Emulation.ttcnpp, line 876 */
NS__Types::PDU__NS rf;
current_location.update_lineno(877);
/* NS_Emulation.ttcnpp, line 877 */
SnsRequest sreq;
alt_status ret_val = ALT_NO;
current_location.update_lineno(878);
/* NS_Emulation.ttcnpp, line 878 */
{
alt_status tmp_133;
{
NS__Provider__Evt_template tmp_132;
tmp_132.link__status() = NS__Provider__LinkStatus::NS__PROV__LINK__STATUS__UP;
tmp_133 = NSVC__CT_component_NSCP.receive(tmp_132, NULL, any_compref, NULL, NULL, NULL);
}
switch (tmp_133) {
case ALT_YES:
{
current_location.update_lineno(879);
/* NS_Emulation.ttcnpp, line 879 */
TTCN_Logger::log_str(TTCN_USER, "Provider Link came up. Waiting for SNS Size");
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
}
current_location.update_lineno(883);
/* NS_Emulation.ttcnpp, line 883 */
switch (NSVC__CT_component_NSCP.receive(Osmocom__Gb__Types::tr__SNS(INTEGER_template(const_cast< const NSConfiguration&>(NSVC__CT_component_g__config).nsei())), &(rf), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(884);
/* NS_Emulation.ttcnpp, line 884 */
{
SnsIndication_template tmp_134;
tmp_134.nsvci() = const_cast< const NSVCConfiguration&>(NSVC__CT_component_g__nsvc__config).nsvci();
tmp_134.ns() = rf;
NSVC__CT_component_NS__SP.send(tmp_134, FALSE, NULL);
}
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
current_location.update_lineno(886);
/* NS_Emulation.ttcnpp, line 886 */
switch (NSVC__CT_component_NSCP.receive(Osmocom__Gb__Types::tr__SNS(INTEGER_template(ANY_VALUE)), &(rf), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(887);
/* NS_Emulation.ttcnpp, line 887 */
TTCN_Runtime::setverdict(FAIL,(TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("SNS from unexpected NSEI: "),rf.log(),TTCN_Logger::end_event_log2str()));
current_location.update_lineno(888);
/* NS_Emulation.ttcnpp, line 888 */
TTCN_Runtime::stop_execution();
}
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
current_location.update_lineno(890);
/* NS_Emulation.ttcnpp, line 890 */
{
alt_status tmp_136;
{
SnsRequest_template tmp_135;
tmp_135.nsvci() = const_cast< const NSVCConfiguration&>(NSVC__CT_component_g__nsvc__config).nsvci();
tmp_135.ns() = ANY_VALUE;
tmp_136 = NSVC__CT_component_NS__SP.receive(tmp_135, &(sreq), any_compref, NULL, NULL, NULL);
}
switch (tmp_136) {
case ALT_YES:
{
current_location.update_lineno(891);
/* NS_Emulation.ttcnpp, line 891 */
NSVC__CT_component_NSCP.send(const_cast< const SnsRequest&>(sreq).ns(), FALSE, NULL);
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
}
current_location.update_lineno(893);
/* NS_Emulation.ttcnpp, line 893 */
switch (NSVC__CT_component_NS__SP.receive(SnsRequest_template(ANY_VALUE), &(sreq), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(894);
/* NS_Emulation.ttcnpp, line 894 */
TTCN_Runtime::setverdict(FAIL,(TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Unexpected SNS from NSVC: "),sreq.log(),TTCN_Logger::end_event_log2str()));
current_location.update_lineno(895);
/* NS_Emulation.ttcnpp, line 895 */
TTCN_Runtime::stop_execution();
}
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
current_location.update_lineno(897);
/* NS_Emulation.ttcnpp, line 897 */
switch (NSVC__CT_component_NS__SP.receive(NsCtrlRequest_template(NsCtrlRequest::ForceAliveState), NULL, any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(898);
/* NS_Emulation.ttcnpp, line 898 */
f__change__state(NsvcState::NSVC__S__ALIVE__UNBLOCKED);
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
current_location.update_lineno(900);
/* NS_Emulation.ttcnpp, line 900 */
switch (NSVC__CT_component_NS__SP.receive(NsCtrlRequest_template(NsCtrlRequest::StartAliveProcedure), NULL, any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(901);
/* NS_Emulation.ttcnpp, line 901 */
f__sendAlive();
current_location.update_lineno(902);
/* NS_Emulation.ttcnpp, line 902 */
NSVC__CT_component_Tns__test.start();
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
return ret_val;
}

void as__nsvc__sns(boolean nodefault_modifier)
{
altstep_begin:
boolean block_flag = FALSE;
alt_status altstep_flag = ALT_UNCHECKED, default_flag = ALT_UNCHECKED;
for ( ; ; ) {
TTCN_Snapshot::take_new(block_flag);
if (altstep_flag != ALT_NO) {
altstep_flag = as__nsvc__sns_instance(!block_flag);
if (altstep_flag == ALT_YES || altstep_flag == ALT_BREAK) return;
else if (altstep_flag == ALT_REPEAT) goto altstep_begin;
}
if (!nodefault_modifier && default_flag != ALT_NO) {
default_flag = TTCN_Default::try_altsteps(!block_flag);
if (default_flag == ALT_YES || default_flag == ALT_BREAK) return;
else if (default_flag == ALT_REPEAT) goto altstep_begin;
}
if (altstep_flag == ALT_NO && default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in altstep as_nsvc_sns.");
else block_flag = TRUE;
}
}

Default_Base *activate_as__nsvc__sns()
{
return new as__nsvc__sns_Default();
}

alt_status as__alive__blocked_instance(boolean first_alt_run)
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 906, TTCN_Location::LOCATION_ALTSTEP, "as_alive_blocked");
current_location.update_lineno(907);
/* NS_Emulation.ttcnpp, line 907 */
NS__Types::PDU__NS rf;
alt_status ret_val = ALT_NO;
current_location.update_lineno(909);
/* NS_Emulation.ttcnpp, line 909 */
switch (NSVC__CT_component_NSCP.receive(Osmocom__Gb__Types::tr__NS__BLOCK(Osmocom__Gb__Types::NsCause_template(ANY_VALUE), INTEGER_template(const_cast< const NSVCConfiguration&>(NSVC__CT_component_g__nsvc__config).nsvci())), &(rf), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(910);
/* NS_Emulation.ttcnpp, line 910 */
NSVC__CT_component_NSCP.send(Osmocom__Gb__Types::ts__NS__BLOCK__ACK(const_cast< const NSVCConfiguration&>(NSVC__CT_component_g__nsvc__config).nsvci()), FALSE, NULL);
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
current_location.update_lineno(913);
/* NS_Emulation.ttcnpp, line 913 */
switch (NSVC__CT_component_NSCP.receive(Osmocom__Gb__Types::t__NS__UNBLOCK, &(rf), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(914);
/* NS_Emulation.ttcnpp, line 914 */
NSVC__CT_component_NSCP.send(Osmocom__Gb__Types::t__NS__UNBLOCK__ACK, FALSE, NULL);
current_location.update_lineno(915);
/* NS_Emulation.ttcnpp, line 915 */
NSVC__CT_component_Tns__block.stop();
current_location.update_lineno(916);
/* NS_Emulation.ttcnpp, line 916 */
f__change__state(NsvcState::NSVC__S__ALIVE__UNBLOCKED);
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
current_location.update_lineno(918);
/* NS_Emulation.ttcnpp, line 918 */
switch (NSVC__CT_component_NSCP.receive(Osmocom__Gb__Types::t__NS__UNBLOCK__ACK, &(rf), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(919);
/* NS_Emulation.ttcnpp, line 919 */
NSVC__CT_component_Tns__block.stop();
current_location.update_lineno(920);
/* NS_Emulation.ttcnpp, line 920 */
f__change__state(NsvcState::NSVC__S__ALIVE__UNBLOCKED);
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
current_location.update_lineno(923);
/* NS_Emulation.ttcnpp, line 923 */
switch (NSVC__CT_component_NSCP.receive(Osmocom__Gb__Types::tr__NS__BLOCK__ACK(INTEGER_template(const_cast< const NSVCConfiguration&>(NSVC__CT_component_g__nsvc__config).nsvci())), &(rf), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
current_location.update_lineno(925);
/* NS_Emulation.ttcnpp, line 925 */
switch (NSVC__CT_component_Tns__block.timeout(NULL)) {
case ALT_YES:
{
current_location.update_lineno(927);
/* NS_Emulation.ttcnpp, line 927 */
f__sendUnblock();
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
return ret_val;
}

void as__alive__blocked(boolean nodefault_modifier)
{
altstep_begin:
boolean block_flag = FALSE;
alt_status altstep_flag = ALT_UNCHECKED, default_flag = ALT_UNCHECKED;
for ( ; ; ) {
TTCN_Snapshot::take_new(block_flag);
if (altstep_flag != ALT_NO) {
altstep_flag = as__alive__blocked_instance(!block_flag);
if (altstep_flag == ALT_YES || altstep_flag == ALT_BREAK) return;
else if (altstep_flag == ALT_REPEAT) goto altstep_begin;
}
if (!nodefault_modifier && default_flag != ALT_NO) {
default_flag = TTCN_Default::try_altsteps(!block_flag);
if (default_flag == ALT_YES || default_flag == ALT_BREAK) return;
else if (default_flag == ALT_REPEAT) goto altstep_begin;
}
if (altstep_flag == ALT_NO && default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in altstep as_alive_blocked.");
else block_flag = TRUE;
}
}

Default_Base *activate_as__alive__blocked()
{
return new as__alive__blocked_Default();
}

alt_status as__alive__unblocked_instance(boolean first_alt_run)
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 931, TTCN_Location::LOCATION_ALTSTEP, "as_alive_unblocked");
current_location.update_lineno(932);
/* NS_Emulation.ttcnpp, line 932 */
NsUnitdataRequest ud__req;
current_location.update_lineno(933);
/* NS_Emulation.ttcnpp, line 933 */
NS__Types::PDU__NS rf;
alt_status ret_val = ALT_NO;
current_location.update_lineno(935);
/* NS_Emulation.ttcnpp, line 935 */
switch (NSVC__CT_component_NSCP.receive(Osmocom__Gb__Types::t__NS__UNBLOCK, &(rf), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(936);
/* NS_Emulation.ttcnpp, line 936 */
NSVC__CT_component_NSCP.send(Osmocom__Gb__Types::t__NS__UNBLOCK__ACK, FALSE, NULL);
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
current_location.update_lineno(939);
/* NS_Emulation.ttcnpp, line 939 */
switch (NSVC__CT_component_NSCP.receive(Osmocom__Gb__Types::tr__NS__BLOCK(Osmocom__Gb__Types::NsCause_template(ANY_VALUE), INTEGER_template(const_cast< const NSVCConfiguration&>(NSVC__CT_component_g__nsvc__config).nsvci())), &(rf), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(940);
/* NS_Emulation.ttcnpp, line 940 */
NSVC__CT_component_NSCP.send(Osmocom__Gb__Types::ts__NS__BLOCK__ACK(const_cast< const NSVCConfiguration&>(NSVC__CT_component_g__nsvc__config).nsvci()), FALSE, NULL);
current_location.update_lineno(941);
/* NS_Emulation.ttcnpp, line 941 */
NSVC__CT_component_Tns__block.stop();
current_location.update_lineno(942);
/* NS_Emulation.ttcnpp, line 942 */
f__change__state(NsvcState::NSVC__S__ALIVE__BLOCKED);
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
current_location.update_lineno(944);
/* NS_Emulation.ttcnpp, line 944 */
switch (NSVC__CT_component_NSCP.receive(Osmocom__Gb__Types::tr__NS__BLOCK__ACK(INTEGER_template(const_cast< const NSVCConfiguration&>(NSVC__CT_component_g__nsvc__config).nsvci())), &(rf), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(945);
/* NS_Emulation.ttcnpp, line 945 */
NSVC__CT_component_Tns__block.stop();
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
current_location.update_lineno(948);
/* NS_Emulation.ttcnpp, line 948 */
switch (NSVC__CT_component_NSCP.receive(Osmocom__Gb__Types::t__NS__UNBLOCK__ACK, &(rf), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
current_location.update_lineno(951);
/* NS_Emulation.ttcnpp, line 951 */
static boolean guard_expr_4 = FALSE;
if (first_alt_run) {
boolean tmp_137;
{
boolean tmp_138 = NSVC__CT_component_g__nsvc__config.is_bound();
if(tmp_138) {
const NSVCConfiguration& tmp_139 = NSVC__CT_component_g__nsvc__config;
const NSVCConfigurationP& tmp_140 = tmp_139.provider();
tmp_138 = tmp_140.is_bound();
if (tmp_138) {
tmp_138 = tmp_140.ischosen(NSVCConfigurationP::ALT_ip);
}
}
tmp_137 = (!(tmp_138));
}
if (!tmp_137) tmp_137 = (const_cast< const NSVCConfiguration&>(NSVC__CT_component_g__nsvc__config).provider().ip().data__weight() > 0);
guard_expr_4 = tmp_137;
}
if (guard_expr_4) {
current_location.update_lineno(952);
/* NS_Emulation.ttcnpp, line 952 */
switch (as__alive__unblocked__data_instance(first_alt_run)) {
case ALT_YES:
return ALT_YES;
case ALT_REPEAT:
return ALT_REPEAT;
case ALT_BREAK:
return ALT_BREAK;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
}
current_location.update_lineno(954);
/* NS_Emulation.ttcnpp, line 954 */
static boolean guard_expr_5 = FALSE;
if (first_alt_run) {
boolean tmp_141;
{
boolean tmp_142 = NSVC__CT_component_g__nsvc__config.is_bound();
if(tmp_142) {
const NSVCConfiguration& tmp_143 = NSVC__CT_component_g__nsvc__config;
const NSVCConfigurationP& tmp_144 = tmp_143.provider();
tmp_142 = tmp_144.is_bound();
if (tmp_142) {
tmp_142 = tmp_144.ischosen(NSVCConfigurationP::ALT_ip);
}
}
tmp_141 = (!(tmp_142));
}
if (!tmp_141) tmp_141 = (const_cast< const NSVCConfiguration&>(NSVC__CT_component_g__nsvc__config).provider().ip().signalling__weight() > 0);
guard_expr_5 = tmp_141;
}
if (guard_expr_5) {
current_location.update_lineno(955);
/* NS_Emulation.ttcnpp, line 955 */
switch (as__alive__unblocked__sig_instance(first_alt_run)) {
case ALT_YES:
return ALT_YES;
case ALT_REPEAT:
return ALT_REPEAT;
case ALT_BREAK:
return ALT_BREAK;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
}
current_location.update_lineno(958);
/* NS_Emulation.ttcnpp, line 958 */
static boolean guard_expr_6 = FALSE;
if (first_alt_run) {
boolean tmp_145 = NSVC__CT_component_g__nsvc__config.is_bound();
if(tmp_145) {
const NSVCConfiguration& tmp_146 = NSVC__CT_component_g__nsvc__config;
const NSVCConfigurationP& tmp_147 = tmp_146.provider();
tmp_145 = tmp_147.is_bound();
if (tmp_145) {
tmp_145 = tmp_147.ischosen(NSVCConfigurationP::ALT_ip);
}
}
guard_expr_6 = tmp_145;
}
if (guard_expr_6) {
current_location.update_lineno(958);
/* NS_Emulation.ttcnpp, line 958 */
switch (NSVC__CT_component_NSCP.receive(Osmocom__Gb__Types::tr__NS__UNITDATA(NS__Types::NS__SDU__ControlBits_template(ANY_VALUE), INTEGER_template(ANY_VALUE), OCTETSTRING_template(ANY_VALUE)), &(rf), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(959);
/* NS_Emulation.ttcnpp, line 959 */
Misc__Helpers::f__shutdown(cs_2, 959, FAIL, (TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Unexpected Rx NS-UNITDATA on NSVC with data_weight="),const_cast< const NSVCConfiguration&>(NSVC__CT_component_g__nsvc__config).provider().ip().data__weight().log(),TTCN_Logger::log_event_str(", sig_weight="),const_cast< const NSVCConfiguration&>(NSVC__CT_component_g__nsvc__config).provider().ip().signalling__weight().log(),TTCN_Logger::log_event_str(": "),rf.log(),TTCN_Logger::end_event_log2str()));
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
}
current_location.update_lineno(964);
/* NS_Emulation.ttcnpp, line 964 */
static boolean guard_expr_7 = FALSE;
if (first_alt_run) {
boolean tmp_148 = NSVC__CT_component_g__nsvc__config.is_bound();
if(tmp_148) {
const NSVCConfiguration& tmp_149 = NSVC__CT_component_g__nsvc__config;
const NSVCConfigurationP& tmp_150 = tmp_149.provider();
tmp_148 = tmp_150.is_bound();
if (tmp_148) {
tmp_148 = tmp_150.ischosen(NSVCConfigurationP::ALT_ip);
}
}
guard_expr_7 = tmp_148;
}
if (guard_expr_7) {
current_location.update_lineno(964);
/* NS_Emulation.ttcnpp, line 964 */
switch (NSVC__CT_component_NS__SP.receive(tr__NsUdReq(INTEGER_template(const_cast< const NSConfiguration&>(NSVC__CT_component_g__config).nsei()), INTEGER_template(ANY_VALUE), INTEGER_template(ANY_VALUE), OCTETSTRING_template(ANY_OR_OMIT), BSSGP__Types::PDU__BSSGP_template(ANY_OR_OMIT)), &(ud__req), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(965);
/* NS_Emulation.ttcnpp, line 965 */
Misc__Helpers::f__shutdown(cs_2, 965, FAIL, (TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Unexpected Rx TX-UNITDATA on NSVC with data_weight="),const_cast< const NSVCConfiguration&>(NSVC__CT_component_g__nsvc__config).provider().ip().data__weight().log(),TTCN_Logger::log_event_str(", sig_weight="),const_cast< const NSVCConfiguration&>(NSVC__CT_component_g__nsvc__config).provider().ip().signalling__weight().log(),TTCN_Logger::log_event_str(": "),ud__req.log(),TTCN_Logger::end_event_log2str()));
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
}
return ret_val;
}

void as__alive__unblocked(boolean nodefault_modifier)
{
altstep_begin:
boolean block_flag = FALSE;
alt_status altstep_flag = ALT_UNCHECKED, default_flag = ALT_UNCHECKED;
for ( ; ; ) {
TTCN_Snapshot::take_new(block_flag);
if (altstep_flag != ALT_NO) {
altstep_flag = as__alive__unblocked_instance(!block_flag);
if (altstep_flag == ALT_YES || altstep_flag == ALT_BREAK) return;
else if (altstep_flag == ALT_REPEAT) goto altstep_begin;
}
if (!nodefault_modifier && default_flag != ALT_NO) {
default_flag = TTCN_Default::try_altsteps(!block_flag);
if (default_flag == ALT_YES || default_flag == ALT_BREAK) return;
else if (default_flag == ALT_REPEAT) goto altstep_begin;
}
if (altstep_flag == ALT_NO && default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in altstep as_alive_unblocked.");
else block_flag = TRUE;
}
}

Default_Base *activate_as__alive__unblocked()
{
return new as__alive__unblocked_Default();
}

alt_status as__alive__unblocked__data_instance(boolean first_alt_run)
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 973, TTCN_Location::LOCATION_ALTSTEP, "as_alive_unblocked_data");
current_location.update_lineno(974);
/* NS_Emulation.ttcnpp, line 974 */
NsUnitdataRequest ud__req;
current_location.update_lineno(975);
/* NS_Emulation.ttcnpp, line 975 */
NS__Types::PDU__NS rf;
alt_status ret_val = ALT_NO;
current_location.update_lineno(977);
/* NS_Emulation.ttcnpp, line 977 */
switch (NSVC__CT_component_NSCP.receive(Osmocom__Gb__Types::tr__NS__UNITDATA__User(NS__Types::NS__SDU__ControlBits_template(ANY_VALUE), OCTETSTRING_template(ANY_VALUE)), &(rf), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(978);
/* NS_Emulation.ttcnpp, line 978 */
NSVC__CT_component_NS__SP.send(ts__NsUdInd(const_cast< const NSConfiguration&>(NSVC__CT_component_g__config).nsei(), const_cast< const NSVCConfiguration&>(NSVC__CT_component_g__nsvc__config).nsvci(), oct2int(const_cast< const NS__Types::PDU__NS&>(rf).pDU__NS__Unitdata().bVCI()), const_cast< const NS__Types::PDU__NS&>(rf).pDU__NS__Unitdata().nS__SDU()), FALSE, NULL);
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
current_location.update_lineno(983);
/* NS_Emulation.ttcnpp, line 983 */
switch (NSVC__CT_component_NS__SP.receive(tr__NsUdReq(INTEGER_template(const_cast< const NSConfiguration&>(NSVC__CT_component_g__config).nsei()), Osmocom__Gb__Types::t__BssgpBvciUser, INTEGER_template(ANY_VALUE), OCTETSTRING_template(ANY_VALUE), BSSGP__Types::PDU__BSSGP_template(OMIT_VALUE)), &(ud__req), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(985);
/* NS_Emulation.ttcnpp, line 985 */
NSVC__CT_component_NSCP.send(Osmocom__Gb__Types::ts__NS__UNITDATA(Osmocom__Gb__Types::t__SduCtrlB, const_cast< const NsUnitdataRequest&>(ud__req).bvci(), const_cast< const NsUnitdataRequest&>(ud__req).sdu()), FALSE, NULL);
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
current_location.update_lineno(987);
/* NS_Emulation.ttcnpp, line 987 */
switch (NSVC__CT_component_NS__SP.receive(tr__NsUdReq(INTEGER_template(const_cast< const NSConfiguration&>(NSVC__CT_component_g__config).nsei()), Osmocom__Gb__Types::t__BssgpBvciUser, INTEGER_template(ANY_VALUE), OCTETSTRING_template(OMIT_VALUE), BSSGP__Types::PDU__BSSGP_template(ANY_VALUE)), &(ud__req), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(989);
/* NS_Emulation.ttcnpp, line 989 */
OCTETSTRING enc(BSSGP__Types::enc__PDU__BSSGP(const_cast< const NsUnitdataRequest&>(ud__req).bssgp()));
current_location.update_lineno(990);
/* NS_Emulation.ttcnpp, line 990 */
NSVC__CT_component_NSCP.send(Osmocom__Gb__Types::ts__NS__UNITDATA(Osmocom__Gb__Types::t__SduCtrlB, const_cast< const NsUnitdataRequest&>(ud__req).bvci(), enc), FALSE, NULL);
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
return ret_val;
}

void as__alive__unblocked__data(boolean nodefault_modifier)
{
altstep_begin:
boolean block_flag = FALSE;
alt_status altstep_flag = ALT_UNCHECKED, default_flag = ALT_UNCHECKED;
for ( ; ; ) {
TTCN_Snapshot::take_new(block_flag);
if (altstep_flag != ALT_NO) {
altstep_flag = as__alive__unblocked__data_instance(!block_flag);
if (altstep_flag == ALT_YES || altstep_flag == ALT_BREAK) return;
else if (altstep_flag == ALT_REPEAT) goto altstep_begin;
}
if (!nodefault_modifier && default_flag != ALT_NO) {
default_flag = TTCN_Default::try_altsteps(!block_flag);
if (default_flag == ALT_YES || default_flag == ALT_BREAK) return;
else if (default_flag == ALT_REPEAT) goto altstep_begin;
}
if (altstep_flag == ALT_NO && default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in altstep as_alive_unblocked_data.");
else block_flag = TRUE;
}
}

Default_Base *activate_as__alive__unblocked__data()
{
return new as__alive__unblocked__data_Default();
}

alt_status as__alive__unblocked__sig_instance(boolean first_alt_run)
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 995, TTCN_Location::LOCATION_ALTSTEP, "as_alive_unblocked_sig");
current_location.update_lineno(996);
/* NS_Emulation.ttcnpp, line 996 */
NsUnitdataRequest ud__req;
current_location.update_lineno(997);
/* NS_Emulation.ttcnpp, line 997 */
NS__Types::PDU__NS rf;
alt_status ret_val = ALT_NO;
current_location.update_lineno(999);
/* NS_Emulation.ttcnpp, line 999 */
switch (NSVC__CT_component_NSCP.receive(Osmocom__Gb__Types::tr__NS__UNITDATA(NS__Types::NS__SDU__ControlBits_template(ANY_VALUE), INTEGER_template(0), OCTETSTRING_template(ANY_VALUE)), &(rf), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(1000);
/* NS_Emulation.ttcnpp, line 1000 */
NSVC__CT_component_NS__SP.send(ts__NsUdInd(const_cast< const NSConfiguration&>(NSVC__CT_component_g__config).nsei(), const_cast< const NSVCConfiguration&>(NSVC__CT_component_g__nsvc__config).nsvci(), oct2int(const_cast< const NS__Types::PDU__NS&>(rf).pDU__NS__Unitdata().bVCI()), const_cast< const NS__Types::PDU__NS&>(rf).pDU__NS__Unitdata().nS__SDU()), FALSE, NULL);
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
current_location.update_lineno(1005);
/* NS_Emulation.ttcnpp, line 1005 */
switch (NSVC__CT_component_NS__SP.receive(tr__NsUdReq(INTEGER_template(const_cast< const NSConfiguration&>(NSVC__CT_component_g__config).nsei()), INTEGER_template(0), INTEGER_template(ANY_VALUE), OCTETSTRING_template(ANY_VALUE), BSSGP__Types::PDU__BSSGP_template(OMIT_VALUE)), &(ud__req), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(1007);
/* NS_Emulation.ttcnpp, line 1007 */
NSVC__CT_component_NSCP.send(Osmocom__Gb__Types::ts__NS__UNITDATA(Osmocom__Gb__Types::t__SduCtrlB, const_cast< const NsUnitdataRequest&>(ud__req).bvci(), const_cast< const NsUnitdataRequest&>(ud__req).sdu()), FALSE, NULL);
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
current_location.update_lineno(1009);
/* NS_Emulation.ttcnpp, line 1009 */
switch (NSVC__CT_component_NS__SP.receive(tr__NsUdReq(INTEGER_template(const_cast< const NSConfiguration&>(NSVC__CT_component_g__config).nsei()), INTEGER_template(0), INTEGER_template(ANY_VALUE), OCTETSTRING_template(OMIT_VALUE), BSSGP__Types::PDU__BSSGP_template(ANY_VALUE)), &(ud__req), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(1011);
/* NS_Emulation.ttcnpp, line 1011 */
OCTETSTRING enc(BSSGP__Types::enc__PDU__BSSGP(const_cast< const NsUnitdataRequest&>(ud__req).bssgp()));
current_location.update_lineno(1012);
/* NS_Emulation.ttcnpp, line 1012 */
NSVC__CT_component_NSCP.send(Osmocom__Gb__Types::ts__NS__UNITDATA(Osmocom__Gb__Types::t__SduCtrlB, const_cast< const NsUnitdataRequest&>(ud__req).bvci(), enc), FALSE, NULL);
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
return ret_val;
}

void as__alive__unblocked__sig(boolean nodefault_modifier)
{
altstep_begin:
boolean block_flag = FALSE;
alt_status altstep_flag = ALT_UNCHECKED, default_flag = ALT_UNCHECKED;
for ( ; ; ) {
TTCN_Snapshot::take_new(block_flag);
if (altstep_flag != ALT_NO) {
altstep_flag = as__alive__unblocked__sig_instance(!block_flag);
if (altstep_flag == ALT_YES || altstep_flag == ALT_BREAK) return;
else if (altstep_flag == ALT_REPEAT) goto altstep_begin;
}
if (!nodefault_modifier && default_flag != ALT_NO) {
default_flag = TTCN_Default::try_altsteps(!block_flag);
if (default_flag == ALT_YES || default_flag == ALT_BREAK) return;
else if (default_flag == ALT_REPEAT) goto altstep_begin;
}
if (altstep_flag == ALT_NO && default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in altstep as_alive_unblocked_sig.");
else block_flag = TRUE;
}
}

Default_Base *activate_as__alive__unblocked__sig()
{
return new as__alive__unblocked__sig_Default();
}

alt_status as__wait__reset_instance(boolean first_alt_run)
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 1016, TTCN_Location::LOCATION_ALTSTEP, "as_wait_reset");
current_location.update_lineno(1017);
/* NS_Emulation.ttcnpp, line 1017 */
NS__Types::PDU__NS rf;
alt_status ret_val = ALT_NO;
current_location.update_lineno(1018);
/* NS_Emulation.ttcnpp, line 1018 */
switch (NSVC__CT_component_Tns__reset.timeout(NULL)) {
case ALT_YES:
{
current_location.update_lineno(1022);
/* NS_Emulation.ttcnpp, line 1022 */
f__sendReset();
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
current_location.update_lineno(1024);
/* NS_Emulation.ttcnpp, line 1024 */
switch (NSVC__CT_component_NSCP.receive(Osmocom__Gb__Types::tr__NS__RESET__ACK(INTEGER_template(const_cast< const NSVCConfiguration&>(NSVC__CT_component_g__nsvc__config).nsvci()), INTEGER_template(const_cast< const NSConfiguration&>(NSVC__CT_component_g__config).nsei())), &(rf), any_compref, NULL, NULL, NULL)) {
case ALT_YES:
{
current_location.update_lineno(1025);
/* NS_Emulation.ttcnpp, line 1025 */
NSVC__CT_component_Tns__reset.stop();
current_location.update_lineno(1026);
/* NS_Emulation.ttcnpp, line 1026 */
f__change__state(NsvcState::NSVC__S__ALIVE__BLOCKED);
current_location.update_lineno(1027);
/* NS_Emulation.ttcnpp, line 1027 */
f__sendAlive();
current_location.update_lineno(1028);
/* NS_Emulation.ttcnpp, line 1028 */
f__sendUnblock();
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
return ret_val;
}

void as__wait__reset(boolean nodefault_modifier)
{
altstep_begin:
boolean block_flag = FALSE;
alt_status altstep_flag = ALT_UNCHECKED, default_flag = ALT_UNCHECKED;
for ( ; ; ) {
TTCN_Snapshot::take_new(block_flag);
if (altstep_flag != ALT_NO) {
altstep_flag = as__wait__reset_instance(!block_flag);
if (altstep_flag == ALT_YES || altstep_flag == ALT_BREAK) return;
else if (altstep_flag == ALT_REPEAT) goto altstep_begin;
}
if (!nodefault_modifier && default_flag != ALT_NO) {
default_flag = TTCN_Default::try_altsteps(!block_flag);
if (default_flag == ALT_YES || default_flag == ALT_BREAK) return;
else if (default_flag == ALT_REPEAT) goto altstep_begin;
}
if (altstep_flag == ALT_NO && default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in altstep as_wait_reset.");
else block_flag = TRUE;
}
}

Default_Base *activate_as__wait__reset()
{
return new as__wait__reset_Default();
}

void f__ScanEvents()
{
TTCN_Location current_location("NS_Emulation.ttcnpp", 1032, TTCN_Location::LOCATION_FUNCTION, "f_ScanEvents");
current_location.update_lineno(1033);
/* NS_Emulation.ttcnpp, line 1033 */
NS__Types::PDU__NS rf;
for ( ; ; ) {
current_location.update_lineno(1035);
/* NS_Emulation.ttcnpp, line 1035 */
{
tmp_151:
alt_status tmp_151_alt_flag_0 = ALT_UNCHECKED;
alt_status tmp_151_alt_flag_1 = ALT_UNCHECKED;
alt_status tmp_151_alt_flag_2 = ALT_UNCHECKED;
alt_status tmp_151_alt_flag_3 = ALT_UNCHECKED;
alt_status tmp_151_alt_flag_4 = ALT_UNCHECKED;
alt_status tmp_151_default_flag = ALT_MAYBE;
boolean first_run = TRUE;
TTCN_Snapshot::take_new(FALSE);
for ( ; ; ) {
if (tmp_151_alt_flag_0 == ALT_UNCHECKED) {
current_location.update_lineno(1036);
/* NS_Emulation.ttcnpp, line 1036 */
if ((NSVC__CT_component_vc__state == NsvcState::NSVC__S__WAIT__RESET)) tmp_151_alt_flag_0 = ALT_MAYBE;
else tmp_151_alt_flag_0 = ALT_NO;
}
if (tmp_151_alt_flag_0 == ALT_MAYBE) {
current_location.update_lineno(1036);
/* NS_Emulation.ttcnpp, line 1036 */
tmp_151_alt_flag_0 = as__wait__reset_instance(first_run);
if (tmp_151_alt_flag_0 == ALT_REPEAT) goto tmp_151;
if (tmp_151_alt_flag_0 == ALT_BREAK) break;
if (tmp_151_alt_flag_0 == ALT_YES) break;
}
if (tmp_151_alt_flag_1 == ALT_UNCHECKED) {
current_location.update_lineno(1037);
/* NS_Emulation.ttcnpp, line 1037 */
if ((NSVC__CT_component_vc__state == NsvcState::NSVC__S__ALIVE__BLOCKED)) tmp_151_alt_flag_1 = ALT_MAYBE;
else tmp_151_alt_flag_1 = ALT_NO;
}
if (tmp_151_alt_flag_1 == ALT_MAYBE) {
current_location.update_lineno(1037);
/* NS_Emulation.ttcnpp, line 1037 */
tmp_151_alt_flag_1 = as__alive__blocked_instance(first_run);
if (tmp_151_alt_flag_1 == ALT_REPEAT) goto tmp_151;
if (tmp_151_alt_flag_1 == ALT_BREAK) break;
if (tmp_151_alt_flag_1 == ALT_YES) break;
}
if (tmp_151_alt_flag_2 == ALT_UNCHECKED) {
current_location.update_lineno(1038);
/* NS_Emulation.ttcnpp, line 1038 */
if ((NSVC__CT_component_vc__state == NsvcState::NSVC__S__ALIVE__UNBLOCKED)) tmp_151_alt_flag_2 = ALT_MAYBE;
else tmp_151_alt_flag_2 = ALT_NO;
}
if (tmp_151_alt_flag_2 == ALT_MAYBE) {
current_location.update_lineno(1038);
/* NS_Emulation.ttcnpp, line 1038 */
tmp_151_alt_flag_2 = as__alive__unblocked_instance(first_run);
if (tmp_151_alt_flag_2 == ALT_REPEAT) goto tmp_151;
if (tmp_151_alt_flag_2 == ALT_BREAK) break;
if (tmp_151_alt_flag_2 == ALT_YES) break;
}
if (tmp_151_alt_flag_3 == ALT_UNCHECKED) {
current_location.update_lineno(1039);
/* NS_Emulation.ttcnpp, line 1039 */
if ((NSVC__CT_component_vc__state == NsvcState::NSVC__S__DISABLED)) tmp_151_alt_flag_3 = ALT_MAYBE;
else tmp_151_alt_flag_3 = ALT_NO;
}
if (tmp_151_alt_flag_3 == ALT_MAYBE) {
current_location.update_lineno(1039);
/* NS_Emulation.ttcnpp, line 1039 */
tmp_151_alt_flag_3 = as__disabled_instance(first_run);
if (tmp_151_alt_flag_3 == ALT_REPEAT) goto tmp_151;
if (tmp_151_alt_flag_3 == ALT_BREAK) break;
if (tmp_151_alt_flag_3 == ALT_YES) break;
}
if (tmp_151_alt_flag_4 == ALT_UNCHECKED) {
current_location.update_lineno(1040);
/* NS_Emulation.ttcnpp, line 1040 */
if ((NSVC__CT_component_vc__state != NsvcState::NSVC__S__DISABLED)) tmp_151_alt_flag_4 = ALT_MAYBE;
else tmp_151_alt_flag_4 = ALT_NO;
}
if (tmp_151_alt_flag_4 == ALT_MAYBE) {
current_location.update_lineno(1040);
/* NS_Emulation.ttcnpp, line 1040 */
tmp_151_alt_flag_4 = as__allstate_instance(first_run);
if (tmp_151_alt_flag_4 == ALT_REPEAT) goto tmp_151;
if (tmp_151_alt_flag_4 == ALT_BREAK) break;
if (tmp_151_alt_flag_4 == ALT_YES) break;
}
if (tmp_151_default_flag == ALT_MAYBE) {
tmp_151_default_flag = TTCN_Default::try_altsteps(first_run);
if (tmp_151_default_flag == ALT_YES || tmp_151_default_flag == ALT_BREAK) break;
else if (tmp_151_default_flag == ALT_REPEAT) goto tmp_151;
}
current_location.update_lineno(1035);
/* NS_Emulation.ttcnpp, line 1035 */
if (tmp_151_alt_flag_0 == ALT_NO && tmp_151_alt_flag_1 == ALT_NO && tmp_151_alt_flag_2 == ALT_NO && tmp_151_alt_flag_3 == ALT_NO && tmp_151_alt_flag_4 == ALT_NO && tmp_151_default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in the alt statement in file NS_Emulation.ttcnpp between lines 1035 and 1041.");
TTCN_Snapshot::take_new(TRUE);
first_run = FALSE;
}
}
}
}

void start_f__ScanEvents(const COMPONENT& component_reference)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_ScanEvents(");
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "NS_Emulation", "f_ScanEvents", text_buf);
TTCN_Runtime::send_start_component(text_buf);
}


/* Bodies of static functions */

void pre_init_module()
{
TTCN_Location current_location("NS_Emulation.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "NS_Emulation");
Osmocom__Gb__Types::module_object.pre_init_module();
NS__Provider__IPL4::module_object.pre_init_module();
NS__Provider__FR::module_object.pre_init_module();
IPL4asp__Types::module_object.pre_init_module();
module_object.add_function("f_ipep_find", (genericfunc_t)&f__ipep__find, (genericfunc_t)&start_f__ipep__find);
module_object.add_function("f_ipep_find_or_create", (genericfunc_t)&f__ipep__find__or__create, (genericfunc_t)&start_f__ipep__find__or__create);
module_object.add_function("f_nsvc_add", (genericfunc_t)&f__nsvc__add, (genericfunc_t)&start_f__nsvc__add);
module_object.add_function("f_nsvc_find_idx", (genericfunc_t)&f__nsvc__find__idx, (genericfunc_t)&start_f__nsvc__find__idx);
module_object.add_function("f_nsvc_find", (genericfunc_t)&f__nsvc__find, (genericfunc_t)&start_f__nsvc__find);
module_object.add_function("f_nsvc_update_state", (genericfunc_t)&f__nsvc__update__state, (genericfunc_t)&start_f__nsvc__update__state);
module_object.add_function("NSStart", (genericfunc_t)&NSStart, (genericfunc_t)&start_NSStart);
module_object.add_function("f_count_nsvcs_in_state", (genericfunc_t)&f__count__nsvcs__in__state, (genericfunc_t)&start_f__count__nsvcs__in__state);
module_object.add_altstep("as_ns_common_status", (genericfunc_t)&as__ns__common__status_instance, (genericfunc_t )&activate_as__ns__common__status, (genericfunc_t )&as__ns__common__status);
module_object.add_altstep("as_ns_common", (genericfunc_t)&as__ns__common_instance, (genericfunc_t )&activate_as__ns__common, (genericfunc_t )&as__ns__common);
module_object.add_function("gen_sns_ip_elems", (genericfunc_t)&gen__sns__ip__elems, (genericfunc_t)&start_gen__sns__ip__elems);
module_object.add_function("f_broadcast_ns_ctrl", (genericfunc_t)&f__broadcast__ns__ctrl, (genericfunc_t)&start_f__broadcast__ns__ctrl);
module_object.add_function("f_sns_outbound_size_config", (genericfunc_t)&f__sns__outbound__size__config, (genericfunc_t)&start_f__sns__outbound__size__config);
module_object.add_altstep("as_vcg_sns_pcu", (genericfunc_t)&as__vcg__sns__pcu_instance, (genericfunc_t )&activate_as__vcg__sns__pcu, (genericfunc_t )&as__vcg__sns__pcu);
module_object.add_altstep("as_vcg_sns_sgsn", (genericfunc_t)&as__vcg__sns__sgsn_instance, (genericfunc_t )&activate_as__vcg__sns__sgsn, (genericfunc_t )&as__vcg__sns__sgsn);
module_object.add_function("NSVCStart", (genericfunc_t)&NSVCStart, (genericfunc_t)&start_NSVCStart);
module_object.add_function("f_init", (genericfunc_t)&f__init, (genericfunc_t)&start_f__init);
module_object.add_function("f_change_state", (genericfunc_t)&f__change__state, (genericfunc_t)&start_f__change__state);
module_object.add_function("f_sendReset", (genericfunc_t)&f__sendReset, (genericfunc_t)&start_f__sendReset);
module_object.add_function("f_sendAlive", (genericfunc_t)&f__sendAlive, (genericfunc_t)&start_f__sendAlive);
module_object.add_function("f_sendUnblock", (genericfunc_t)&f__sendUnblock, (genericfunc_t)&start_f__sendUnblock);
module_object.add_function("f_sendBlock", (genericfunc_t)&f__sendBlock, (genericfunc_t)&start_f__sendBlock);
module_object.add_altstep("as_allstate", (genericfunc_t)&as__allstate_instance, (genericfunc_t )&activate_as__allstate, (genericfunc_t )&as__allstate);
module_object.add_altstep("as_disabled", (genericfunc_t)&as__disabled_instance, (genericfunc_t )&activate_as__disabled, (genericfunc_t )&as__disabled);
module_object.add_altstep("as_handle_reset", (genericfunc_t)&as__handle__reset_instance, (genericfunc_t )&activate_as__handle__reset, (genericfunc_t )&as__handle__reset);
module_object.add_altstep("as_nsvc_sns", (genericfunc_t)&as__nsvc__sns_instance, (genericfunc_t )&activate_as__nsvc__sns, (genericfunc_t )&as__nsvc__sns);
module_object.add_altstep("as_alive_blocked", (genericfunc_t)&as__alive__blocked_instance, (genericfunc_t )&activate_as__alive__blocked, (genericfunc_t )&as__alive__blocked);
module_object.add_altstep("as_alive_unblocked", (genericfunc_t)&as__alive__unblocked_instance, (genericfunc_t )&activate_as__alive__unblocked, (genericfunc_t )&as__alive__unblocked);
module_object.add_altstep("as_alive_unblocked_data", (genericfunc_t)&as__alive__unblocked__data_instance, (genericfunc_t )&activate_as__alive__unblocked__data, (genericfunc_t )&as__alive__unblocked__data);
module_object.add_altstep("as_alive_unblocked_sig", (genericfunc_t)&as__alive__unblocked__sig_instance, (genericfunc_t )&activate_as__alive__unblocked__sig, (genericfunc_t )&as__alive__unblocked__sig);
module_object.add_altstep("as_wait_reset", (genericfunc_t)&as__wait__reset_instance, (genericfunc_t )&activate_as__wait__reset, (genericfunc_t )&as__wait__reset);
module_object.add_function("f_ScanEvents", (genericfunc_t)&f__ScanEvents, (genericfunc_t)&start_f__ScanEvents);
}

void post_init_module()
{
TTCN_Location current_location("NS_Emulation.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "NS_Emulation");
Osmocom__Gb__Types::module_object.post_init_module();
NS__Provider__IPL4::module_object.post_init_module();
NS__Provider__FR::module_object.post_init_module();
IPL4asp__Types::module_object.post_init_module();
current_location.update_lineno(87);
/* NS_Emulation.ttcnpp, line 87 */
template_tr__NsStsInd_nsei_defval = ANY_VALUE;
current_location.update_lineno(88);
/* NS_Emulation.ttcnpp, line 88 */
template_tr__NsStsInd_nsvci_defval = ANY_VALUE;
current_location.update_lineno(89);
/* NS_Emulation.ttcnpp, line 89 */
template_tr__NsStsInd_old__state_defval = ANY_VALUE;
current_location.update_lineno(90);
/* NS_Emulation.ttcnpp, line 90 */
template_tr__NsStsInd_state_defval = ANY_VALUE;
current_location.update_lineno(91);
/* NS_Emulation.ttcnpp, line 91 */
template_tr__NsStsInd_first__or__last_defval = ANY_VALUE;
current_location.update_lineno(101);
/* NS_Emulation.ttcnpp, line 101 */
const_ts__NsStsInd_first__or__last_defval = FALSE;
current_location.update_lineno(406);
/* NS_Emulation.ttcnpp, line 406 */
const_NSStart_id_defval = TTCN_Runtime::get_testcasename();
current_location.update_lineno(426);
/* NS_Emulation.ttcnpp, line 426 */
template_f__count__nsvcs__in__state_state_defval = ANY_VALUE;
current_location.update_lineno(553);
/* NS_Emulation.ttcnpp, line 553 */
const_f__sns__outbound__size__config_idx_defval = 0;
current_location.update_lineno(711);
/* NS_Emulation.ttcnpp, line 711 */
const_NSVCStart_id_defval = TTCN_Runtime::get_testcasename();
current_location.update_lineno(711);
/* NS_Emulation.ttcnpp, line 711 */
const_NSVCStart_nsp__ip_defval = NULL_COMPREF;
}

boolean init_comp_type(const char *component_type, boolean init_base_comps)
{
(void)init_base_comps;
if (!strcmp(component_type, "NS_Provider_CT")) {
NS__Provider__CT_component_NSE.activate_port();
return TRUE;
} else if (!strcmp(component_type, "NS_CT")) {
NS__CT_component_NS__SP.activate_port();
NS__CT_component_NSVC.activate_port();
NS__CT_component_NS__CTRL.activate_port();
NS__CT_component_g__config.clean_up();
NS__CT_component_g__id.clean_up();
NS__CT_component_g__ip__endpoints = NULL_VALUE;
NS__CT_component_NSPIP__PROC.activate_port();
NS__CT_component_g__nsvcs = NULL_VALUE;
NS__CT_component_g__unblocked__nsvcs__sig = NULL_VALUE;
NS__CT_component_g__unblocked__nsvcs__data = NULL_VALUE;
return TRUE;
} else if (!strcmp(component_type, "NSVC_CT")) {
NSVC__CT_component_NSCP.activate_port();
NSVC__CT_component_vc__NSP__IP.clean_up();
NSVC__CT_component_vc__NSP__FR.clean_up();
NSVC__CT_component_NS__SP.activate_port();
NSVC__CT_component_g__nsvc__config.clean_up();
NSVC__CT_component_g__config.clean_up();
NSVC__CT_component_vc__state = NsvcState::NSVC__S__DEAD__BLOCKED;
return TRUE;
} else return FALSE;
}

boolean init_system_port(const char* component_type, const char* port_name)
{
if (!strcmp(component_type, "NS_Provider_CT")) {
if (!strcmp(port_name, "NSE")) {
NS__Provider__CT_component_NSE.safe_start();
return TRUE;
}
}
else if (!strcmp(component_type, "NS_CT")) {
if (!strcmp(port_name, "NSPIP_PROC")) {
NS__CT_component_NSPIP__PROC.safe_start();
return TRUE;
}
if (!strcmp(port_name, "NSVC")) {
NS__CT_component_NSVC.safe_start();
return TRUE;
}
if (!strcmp(port_name, "NS_CTRL")) {
NS__CT_component_NS__CTRL.safe_start();
return TRUE;
}
if (!strcmp(port_name, "NS_SP")) {
NS__CT_component_NS__SP.safe_start();
return TRUE;
}
}
else if (!strcmp(component_type, "NSVC_CT")) {
if (!strcmp(port_name, "NSCP")) {
NSVC__CT_component_NSCP.safe_start();
return TRUE;
}
if (!strcmp(port_name, "NS_SP")) {
NSVC__CT_component_NS__SP.safe_start();
return TRUE;
}
}
return FALSE;
}

boolean start_ptc_function(const char *function_name, Text_Buf& function_arguments)
{
if (!strcmp(function_name, "f_ipep_find")) {
Osmocom__Types::AddressFamily af;
INTEGER local__udp__port;
CHARSTRING local__ip;
IpEndpointTableEntry  ret;
af.decode_text(function_arguments);
local__udp__port.decode_text(function_arguments);
local__ip.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_ipep_find(");
af.log();
TTCN_Logger::log_event_str(", ");
local__udp__port.log();
TTCN_Logger::log_event_str(", ");
local__ip.log();
TTCN_Logger::log_event_str(", ");
ret.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__ipep__find(af, local__udp__port, local__ip, ret);
TTCN_Runtime::function_finished("f_ipep_find");
return TRUE;
} else if (!strcmp(function_name, "f_ipep_find_or_create")) {
NSVCConfiguration nsvc__cfg;
nsvc__cfg.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_ipep_find_or_create(");
nsvc__cfg.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__ipep__find__or__create(nsvc__cfg);
TTCN_Runtime::function_finished("f_ipep_find_or_create");
return TRUE;
} else if (!strcmp(function_name, "f_nsvc_add")) {
NSVCConfiguration nsvc__cfg;
nsvc__cfg.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_nsvc_add(");
nsvc__cfg.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__nsvc__add(nsvc__cfg);
TTCN_Runtime::function_finished("f_nsvc_add");
return TRUE;
} else if (!strcmp(function_name, "f_nsvc_find_idx")) {
INTEGER nsvci;
nsvci.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_nsvc_find_idx(");
nsvci.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__nsvc__find__idx(nsvci);
TTCN_Runtime::function_finished("f_nsvc_find_idx");
return TRUE;
} else if (!strcmp(function_name, "f_nsvc_find")) {
INTEGER nsvci;
nsvci.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_nsvc_find(");
nsvci.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__nsvc__find(nsvci);
TTCN_Runtime::function_finished("f_nsvc_find");
return TRUE;
} else if (!strcmp(function_name, "f_nsvc_update_state")) {
INTEGER nsvci;
NsvcState state;
nsvci.decode_text(function_arguments);
state.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_nsvc_update_state(");
nsvci.log();
TTCN_Logger::log_event_str(", ");
state.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__nsvc__update__state(nsvci, state);
TTCN_Runtime::function_finished("f_nsvc_update_state");
return TRUE;
} else if (!strcmp(function_name, "NSStart")) {
NSConfiguration init__config;
CHARSTRING id;
init__config.decode_text(function_arguments);
id.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function NSStart(");
init__config.log();
TTCN_Logger::log_event_str(", ");
id.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
NSStart(init__config, id);
TTCN_Runtime::function_finished("NSStart");
return TRUE;
} else if (!strcmp(function_name, "f_count_nsvcs_in_state")) {
NsvcState_template state;
state.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_count_nsvcs_in_state(");
state.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__count__nsvcs__in__state(state);
TTCN_Runtime::function_finished("f_count_nsvcs_in_state");
return TRUE;
} else if (!strcmp(function_name, "gen_sns_ip_elems")) {
NS__Types::IP4__Elements_template  v4__out;
NS__Types::IP6__Elements_template  v6__out;
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function gen_sns_ip_elems(");
v4__out.log();
TTCN_Logger::log_event_str(", ");
v6__out.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
gen__sns__ip__elems(v4__out, v6__out);
TTCN_Runtime::function_finished("gen_sns_ip_elems");
return TRUE;
} else if (!strcmp(function_name, "f_broadcast_ns_ctrl")) {
NsCtrlRequest_template req;
req.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_broadcast_ns_ctrl(");
req.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__broadcast__ns__ctrl(req);
TTCN_Runtime::function_finished("f_broadcast_ns_ctrl");
return TRUE;
} else if (!strcmp(function_name, "f_sns_outbound_size_config")) {
INTEGER idx;
idx.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_sns_outbound_size_config(");
idx.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__sns__outbound__size__config(idx);
TTCN_Runtime::function_finished("f_sns_outbound_size_config");
return TRUE;
} else if (!strcmp(function_name, "NSVCStart")) {
NSVCConfiguration init__config;
NSConfiguration init__g__config;
CHARSTRING id;
COMPONENT nsp__ip;
init__config.decode_text(function_arguments);
init__g__config.decode_text(function_arguments);
id.decode_text(function_arguments);
nsp__ip.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function NSVCStart(");
init__config.log();
TTCN_Logger::log_event_str(", ");
init__g__config.log();
TTCN_Logger::log_event_str(", ");
id.log();
TTCN_Logger::log_event_str(", ");
nsp__ip.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
NSVCStart(init__config, init__g__config, id, nsp__ip);
TTCN_Runtime::function_finished("NSVCStart");
return TRUE;
} else if (!strcmp(function_name, "f_init")) {
CHARSTRING id;
COMPONENT nsp__ip;
id.decode_text(function_arguments);
nsp__ip.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_init(");
id.log();
TTCN_Logger::log_event_str(", ");
nsp__ip.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__init(id, nsp__ip);
TTCN_Runtime::function_finished("f_init");
return TRUE;
} else if (!strcmp(function_name, "f_change_state")) {
NsvcState new__state;
new__state.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_change_state(");
new__state.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__change__state(new__state);
TTCN_Runtime::function_finished("f_change_state");
return TRUE;
} else if (!strcmp(function_name, "f_sendReset")) {
TTCN_Logger::log_str(TTCN_Logger::PARALLEL_PTC, "Starting function f_sendReset().");
TTCN_Runtime::function_started(function_arguments);
f__sendReset();
TTCN_Runtime::function_finished("f_sendReset");
return TRUE;
} else if (!strcmp(function_name, "f_sendAlive")) {
TTCN_Logger::log_str(TTCN_Logger::PARALLEL_PTC, "Starting function f_sendAlive().");
TTCN_Runtime::function_started(function_arguments);
f__sendAlive();
TTCN_Runtime::function_finished("f_sendAlive");
return TRUE;
} else if (!strcmp(function_name, "f_sendUnblock")) {
TTCN_Logger::log_str(TTCN_Logger::PARALLEL_PTC, "Starting function f_sendUnblock().");
TTCN_Runtime::function_started(function_arguments);
f__sendUnblock();
TTCN_Runtime::function_finished("f_sendUnblock");
return TRUE;
} else if (!strcmp(function_name, "f_sendBlock")) {
Osmocom__Gb__Types::NsCause cause;
cause.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_sendBlock(");
cause.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__sendBlock(cause);
TTCN_Runtime::function_finished("f_sendBlock");
return TRUE;
} else if (!strcmp(function_name, "f_ScanEvents")) {
TTCN_Logger::log_str(TTCN_Logger::PARALLEL_PTC, "Starting function f_ScanEvents().");
TTCN_Runtime::function_started(function_arguments);
f__ScanEvents();
TTCN_Runtime::function_finished("f_ScanEvents");
return TRUE;
} else return FALSE;
}


} /* end of namespace */
