// 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 "IuUP_Emulation.hh" namespace IuUP__Emulation { /* Literal string constants */ const unsigned char bs_0_bits[] = { 0, 128 }; extern const BITSTRING bs_0(16, bs_0_bits); extern const OCTETSTRING os_0(0, NULL); const unsigned char module_checksum[] = { 0x69, 0x63, 0xff, 0x87, 0x2d, 0x8c, 0x2b, 0x30, 0xc4, 0x64, 0xd7, 0xf3, 0xc5, 0x51, 0x82, 0xcc }; /* Global variable definitions */ const XERdescriptor_t IuUP__RabFlowCombination_rfci_xer_ = { {"rfci>\n", "rfci>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_OERdescriptor_t IuUP__RabFlowCombination_rfci_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t IuUP__RabFlowCombination_rfci_descr_ = { "@IuUP_Emulation.IuUP_RabFlowCombination.rfci", &INTEGER_ber_, &IuUP__Types::IuUP__RFCI_raw_, &INTEGER_text_, &IuUP__RabFlowCombination_rfci_xer_, &INTEGER_json_, &IuUP__RabFlowCombination_rfci_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING IuUP__RabFlowCombination_rfci_default_coding("RAW"); UNIVERSAL_CHARSTRING IuUP__RabFlowCombination_sub__flow__bits_default_coding("RAW"); const XERdescriptor_t IuUP__RabFlowCombination_ipti_xer_ = { {"ipti>\n", "ipti>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_OERdescriptor_t IuUP__RabFlowCombination_ipti_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t IuUP__RabFlowCombination_ipti_descr_ = { "@IuUP_Emulation.IuUP_RabFlowCombination.ipti", &INTEGER_ber_, &Osmocom__Types::uint8__t_raw_, &INTEGER_text_, &IuUP__RabFlowCombination_ipti_xer_, &INTEGER_json_, &IuUP__RabFlowCombination_ipti_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING IuUP__RabFlowCombination_ipti_default_coding("RAW"); // No XER for IuUP__RabFlowCombination const TTCN_Typedescriptor_t IuUP__RabFlowCombination_descr_ = { "@IuUP_Emulation.IuUP_RabFlowCombination", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; // No XER for IuUP__RabFlowCombinationList const TTCN_Typedescriptor_t IuUP__RabFlowCombinationList_descr_ = { "@IuUP_Emulation.IuUP_RabFlowCombinationList", NULL, NULL, NULL, NULL, NULL, NULL, NULL, &IuUP__RabFlowCombination_descr_, TTCN_Typedescriptor_t::DONTCARE }; IuUP__RabFlowCombinationList const_c__IuUP__Config__RabFlowCombination__def; const IuUP__RabFlowCombinationList& c__IuUP__Config__RabFlowCombination__def = const_c__IuUP__Config__RabFlowCombination__def; const XERdescriptor_t IuUP__Config_active__init_xer_ = { {"active_init>\n", "active_init>\n"}, {13, 13}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int IuUP__Config_active__init_oer_ext_arr_[0] = {}; const int IuUP__Config_active__init_oer_p_[0] = {}; const TTCN_OERdescriptor_t IuUP__Config_active__init_oer_ = { -1, TRUE, -1, FALSE, 0, 0, IuUP__Config_active__init_oer_ext_arr_, 0, IuUP__Config_active__init_oer_p_}; const TTCN_Typedescriptor_t IuUP__Config_active__init_descr_ = { "@IuUP_Emulation.IuUP_Config.active_init", &BOOLEAN_ber_, &BOOLEAN_raw_, &BOOLEAN_text_, &IuUP__Config_active__init_xer_, &BOOLEAN_json_, &IuUP__Config_active__init_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t IuUP__Config_data__pdu__type__0_xer_ = { {"data_pdu_type_0>\n", "data_pdu_type_0>\n"}, {17, 17}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int IuUP__Config_data__pdu__type__0_oer_ext_arr_[0] = {}; const int IuUP__Config_data__pdu__type__0_oer_p_[0] = {}; const TTCN_OERdescriptor_t IuUP__Config_data__pdu__type__0_oer_ = { -1, TRUE, -1, FALSE, 0, 0, IuUP__Config_data__pdu__type__0_oer_ext_arr_, 0, IuUP__Config_data__pdu__type__0_oer_p_}; const TTCN_Typedescriptor_t IuUP__Config_data__pdu__type__0_descr_ = { "@IuUP_Emulation.IuUP_Config.data_pdu_type_0", &BOOLEAN_ber_, &BOOLEAN_raw_, &BOOLEAN_text_, &IuUP__Config_data__pdu__type__0_xer_, &BOOLEAN_json_, &IuUP__Config_data__pdu__type__0_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; // No XER for IuUP__Config const TTCN_Typedescriptor_t IuUP__Config_descr_ = { "@IuUP_Emulation.IuUP_Config", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; BOOLEAN const_t__IuUP__Config_active__init_defval; const BOOLEAN& t__IuUP__Config_active__init_defval = const_t__IuUP__Config_active__init_defval; BOOLEAN const_t__IuUP__Config_data__pdu__type__0_defval; const BOOLEAN& t__IuUP__Config_data__pdu__type__0_defval = const_t__IuUP__Config_data__pdu__type__0_defval; IuUP__RabFlowCombinationList_template template_t__IuUP__Config_rab__flow__combs_defval; const IuUP__RabFlowCombinationList_template& t__IuUP__Config_rab__flow__combs_defval = template_t__IuUP__Config_rab__flow__combs_defval; IuUP__Config const_c__IuUP__Config__def; const IuUP__Config& c__IuUP__Config__def = const_c__IuUP__Config__def; // No XER for IuUP__Em__State const TTCN_Typedescriptor_t IuUP__Em__State_descr_ = { "@IuUP_Emulation.IuUP_Em_State", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t IuUP__Entity_tx__next__frame__nr_xer_ = { {"tx_next_frame_nr>\n", "tx_next_frame_nr>\n"}, {18, 18}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_OERdescriptor_t IuUP__Entity_tx__next__frame__nr_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t IuUP__Entity_tx__next__frame__nr_descr_ = { "@IuUP_Emulation.IuUP_Entity.tx_next_frame_nr", &INTEGER_ber_, &IuUP__Types::IuUP__FrameNr_raw_, &INTEGER_text_, &IuUP__Entity_tx__next__frame__nr_xer_, &INTEGER_json_, &IuUP__Entity_tx__next__frame__nr_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING IuUP__Entity_tx__next__frame__nr_default_coding("RAW"); // No XER for IuUP__Entity const TTCN_Typedescriptor_t IuUP__Entity_descr_ = { "@IuUP_Emulation.IuUP_Entity", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t IuUP__Entity_rx__last__frame__nr_xer_ = { {"rx_last_frame_nr>\n", "rx_last_frame_nr>\n"}, {18, 18}, 0 |FORM_UNQUALIFIED |XER_OPTIONAL, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_OERdescriptor_t IuUP__Entity_rx__last__frame__nr_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t IuUP__Entity_rx__last__frame__nr_descr_ = { "@IuUP_Emulation.IuUP_Entity.rx_last_frame_nr", &INTEGER_ber_, &IuUP__Types::IuUP__FrameNr_raw_, &INTEGER_text_, &IuUP__Entity_rx__last__frame__nr_xer_, &INTEGER_json_, &IuUP__Entity_rx__last__frame__nr_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING IuUP__Entity_rx__last__frame__nr_default_coding("RAW"); UNIVERSAL_CHARSTRING IuUP__Entity_pending__tx__pdu_default_coding("RAW"); TTCN_Module module_object("IuUP_Emulation", __DATE__, __TIME__, module_checksum, pre_init_module, NULL, 0U, 4294967295U, 4294967295U, 4294967295U, NULL, 0LU, 0, post_init_module, NULL, NULL, NULL, NULL, NULL, NULL, NULL); const RuntimeVersionChecker ver_checker( current_runtime_version.requires_major_version_11, current_runtime_version.requires_minor_version_1, current_runtime_version.requires_patch_level_0, current_runtime_version.requires_runtime_1); /* Member functions of C++ classes */ IuUP__RabFlowCombination::IuUP__RabFlowCombination() { } IuUP__RabFlowCombination::IuUP__RabFlowCombination(const INTEGER& par_rfci, const IuUP__Types::RecOfU8& par_sub__flow__bits, const INTEGER& par_ipti) : field_rfci(par_rfci), field_sub__flow__bits(par_sub__flow__bits), field_ipti(par_ipti) { } IuUP__RabFlowCombination::IuUP__RabFlowCombination(const IuUP__RabFlowCombination& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @IuUP_Emulation.IuUP_RabFlowCombination."); if (other_value.rfci().is_bound()) field_rfci = other_value.rfci(); else field_rfci.clean_up(); if (other_value.sub__flow__bits().is_bound()) field_sub__flow__bits = other_value.sub__flow__bits(); else field_sub__flow__bits.clean_up(); if (other_value.ipti().is_bound()) field_ipti = other_value.ipti(); else field_ipti.clean_up(); } void IuUP__RabFlowCombination::clean_up() { field_rfci.clean_up(); field_sub__flow__bits.clean_up(); field_ipti.clean_up(); } const TTCN_Typedescriptor_t* IuUP__RabFlowCombination::get_descriptor() const { return &IuUP__RabFlowCombination_descr_; } IuUP__RabFlowCombination& IuUP__RabFlowCombination::operator=(const IuUP__RabFlowCombination& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @IuUP_Emulation.IuUP_RabFlowCombination."); if (other_value.rfci().is_bound()) field_rfci = other_value.rfci(); else field_rfci.clean_up(); if (other_value.sub__flow__bits().is_bound()) field_sub__flow__bits = other_value.sub__flow__bits(); else field_sub__flow__bits.clean_up(); if (other_value.ipti().is_bound()) field_ipti = other_value.ipti(); else field_ipti.clean_up(); } return *this; } boolean IuUP__RabFlowCombination::operator==(const IuUP__RabFlowCombination& other_value) const { return field_rfci==other_value.field_rfci && field_sub__flow__bits==other_value.field_sub__flow__bits && field_ipti==other_value.field_ipti; } boolean IuUP__RabFlowCombination::is_bound() const { return (field_rfci.is_bound()) || (field_sub__flow__bits.is_bound()) || (field_ipti.is_bound()); } boolean IuUP__RabFlowCombination::is_value() const { return field_rfci.is_value() && field_sub__flow__bits.is_value() && field_ipti.is_value(); } void IuUP__RabFlowCombination::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ rfci := "); field_rfci.log(); TTCN_Logger::log_event_str(", sub_flow_bits := "); field_sub__flow__bits.log(); TTCN_Logger::log_event_str(", ipti := "); field_ipti.log(); TTCN_Logger::log_event_str(" }"); } void IuUP__RabFlowCombination::set_implicit_omit() { if (rfci().is_bound()) rfci().set_implicit_omit(); if (sub__flow__bits().is_bound()) sub__flow__bits().set_implicit_omit(); if (ipti().is_bound()) ipti().set_implicit_omit(); } void IuUP__RabFlowCombination::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "record value"); switch (param.get_type()) { case Module_Param::MP_Value_List: if (30 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) rfci().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) sub__flow__bits().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) ipti().set_param(*param.get_elem(2)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "rfci")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rfci().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "sub_flow_bits")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { sub__flow__bits().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ipti")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ipti().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @IuUP_Emulation.IuUP_RabFlowCombination: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@IuUP_Emulation.IuUP_RabFlowCombination"); } } void IuUP__RabFlowCombination::encode_text(Text_Buf& text_buf) const { field_rfci.encode_text(text_buf); field_sub__flow__bits.encode_text(text_buf); field_ipti.encode_text(text_buf); } void IuUP__RabFlowCombination::decode_text(Text_Buf& text_buf) { field_rfci.decode_text(text_buf); field_sub__flow__bits.decode_text(text_buf); field_ipti.decode_text(text_buf); } struct IuUP__RabFlowCombination_template::single_value_struct { INTEGER_template field_rfci; IuUP__Types::RecOfU8_template field_sub__flow__bits; INTEGER_template field_ipti; }; void IuUP__RabFlowCombination_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_rfci = ANY_VALUE; single_value->field_sub__flow__bits = ANY_VALUE; single_value->field_ipti = ANY_VALUE; } } } void IuUP__RabFlowCombination_template::copy_value(const IuUP__RabFlowCombination& other_value) { single_value = new single_value_struct; if (other_value.rfci().is_bound()) { single_value->field_rfci = other_value.rfci(); } else { single_value->field_rfci.clean_up(); } if (other_value.sub__flow__bits().is_bound()) { single_value->field_sub__flow__bits = other_value.sub__flow__bits(); } else { single_value->field_sub__flow__bits.clean_up(); } if (other_value.ipti().is_bound()) { single_value->field_ipti = other_value.ipti(); } else { single_value->field_ipti.clean_up(); } set_selection(SPECIFIC_VALUE); } void IuUP__RabFlowCombination_template::copy_template(const IuUP__RabFlowCombination_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.rfci().get_selection()) { single_value->field_rfci = other_value.rfci(); } else { single_value->field_rfci.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.sub__flow__bits().get_selection()) { single_value->field_sub__flow__bits = other_value.sub__flow__bits(); } else { single_value->field_sub__flow__bits.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.ipti().get_selection()) { single_value->field_ipti = other_value.ipti(); } else { single_value->field_ipti.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 IuUP__RabFlowCombination_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 IuUP__RabFlowCombination_template(*other_value.implication_.precondition); implication_.implied_template = new IuUP__RabFlowCombination_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 @IuUP_Emulation.IuUP_RabFlowCombination."); break; } set_selection(other_value); } IuUP__RabFlowCombination_template::IuUP__RabFlowCombination_template() { } IuUP__RabFlowCombination_template::IuUP__RabFlowCombination_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } IuUP__RabFlowCombination_template::IuUP__RabFlowCombination_template(const IuUP__RabFlowCombination& other_value) { copy_value(other_value); } IuUP__RabFlowCombination_template::IuUP__RabFlowCombination_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const IuUP__RabFlowCombination&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @IuUP_Emulation.IuUP_RabFlowCombination from an unbound optional field."); } } IuUP__RabFlowCombination_template::IuUP__RabFlowCombination_template(IuUP__RabFlowCombination_template* p_precondition, IuUP__RabFlowCombination_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } IuUP__RabFlowCombination_template::IuUP__RabFlowCombination_template(Dynamic_Match_Interface* p_dyn_match) : Base_Template(DYNAMIC_MATCH) { dyn_match = new dynmatch_struct; dyn_match->ptr = p_dyn_match; dyn_match->ref_count = 1; } IuUP__RabFlowCombination_template::IuUP__RabFlowCombination_template(const IuUP__RabFlowCombination_template& other_value) : Base_Template() { copy_template(other_value); } IuUP__RabFlowCombination_template::~IuUP__RabFlowCombination_template() { clean_up(); } IuUP__RabFlowCombination_template& IuUP__RabFlowCombination_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } IuUP__RabFlowCombination_template& IuUP__RabFlowCombination_template::operator=(const IuUP__RabFlowCombination& other_value) { clean_up(); copy_value(other_value); return *this; } IuUP__RabFlowCombination_template& IuUP__RabFlowCombination_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const IuUP__RabFlowCombination&)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 @IuUP_Emulation.IuUP_RabFlowCombination."); } return *this; } IuUP__RabFlowCombination_template& IuUP__RabFlowCombination_template::operator=(const IuUP__RabFlowCombination_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean IuUP__RabFlowCombination_template::match(const IuUP__RabFlowCombination& 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.rfci().is_bound()) return FALSE; if(!single_value->field_rfci.match(other_value.rfci(), legacy))return FALSE; if(!other_value.sub__flow__bits().is_bound()) return FALSE; if(!single_value->field_sub__flow__bits.match(other_value.sub__flow__bits(), legacy))return FALSE; if(!other_value.ipti().is_bound()) return FALSE; if(!single_value->field_ipti.match(other_value.ipti(), 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 @IuUP_Emulation.IuUP_RabFlowCombination."); } return FALSE; } boolean IuUP__RabFlowCombination_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_rfci.is_bound() || single_value->field_sub__flow__bits.is_bound() || single_value->field_ipti.is_bound(); } boolean IuUP__RabFlowCombination_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_rfci.is_value() && single_value->field_sub__flow__bits.is_value() && single_value->field_ipti.is_value(); } void IuUP__RabFlowCombination_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; } IuUP__RabFlowCombination IuUP__RabFlowCombination_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 @IuUP_Emulation.IuUP_RabFlowCombination."); IuUP__RabFlowCombination ret_val; if (single_value->field_rfci.is_bound()) { ret_val.rfci() = single_value->field_rfci.valueof(); } if (single_value->field_sub__flow__bits.is_bound()) { ret_val.sub__flow__bits() = single_value->field_sub__flow__bits.valueof(); } if (single_value->field_ipti.is_bound()) { ret_val.ipti() = single_value->field_ipti.valueof(); } return ret_val; } void IuUP__RabFlowCombination_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 @IuUP_Emulation.IuUP_RabFlowCombination."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new IuUP__RabFlowCombination_template[list_length]; } IuUP__RabFlowCombination_template& IuUP__RabFlowCombination_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 @IuUP_Emulation.IuUP_RabFlowCombination."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @IuUP_Emulation.IuUP_RabFlowCombination."); return value_list.list_value[list_index]; } INTEGER_template& IuUP__RabFlowCombination_template::rfci() { set_specific(); return single_value->field_rfci; } const INTEGER_template& IuUP__RabFlowCombination_template::rfci() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field rfci of a non-specific template of type @IuUP_Emulation.IuUP_RabFlowCombination."); return single_value->field_rfci; } IuUP__Types::RecOfU8_template& IuUP__RabFlowCombination_template::sub__flow__bits() { set_specific(); return single_value->field_sub__flow__bits; } const IuUP__Types::RecOfU8_template& IuUP__RabFlowCombination_template::sub__flow__bits() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field sub_flow_bits of a non-specific template of type @IuUP_Emulation.IuUP_RabFlowCombination."); return single_value->field_sub__flow__bits; } INTEGER_template& IuUP__RabFlowCombination_template::ipti() { set_specific(); return single_value->field_ipti; } const INTEGER_template& IuUP__RabFlowCombination_template::ipti() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ipti of a non-specific template of type @IuUP_Emulation.IuUP_RabFlowCombination."); return single_value->field_ipti; } int IuUP__RabFlowCombination_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @IuUP_Emulation.IuUP_RabFlowCombination 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 @IuUP_Emulation.IuUP_RabFlowCombination 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 @IuUP_Emulation.IuUP_RabFlowCombination containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @IuUP_Emulation.IuUP_RabFlowCombination containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @IuUP_Emulation.IuUP_RabFlowCombination containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @IuUP_Emulation.IuUP_RabFlowCombination containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @IuUP_Emulation.IuUP_RabFlowCombination containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @IuUP_Emulation.IuUP_RabFlowCombination containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @IuUP_Emulation.IuUP_RabFlowCombination containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @IuUP_Emulation.IuUP_RabFlowCombination."); } return 0; } void IuUP__RabFlowCombination_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ rfci := "); single_value->field_rfci.log(); TTCN_Logger::log_event_str(", sub_flow_bits := "); single_value->field_sub__flow__bits.log(); TTCN_Logger::log_event_str(", ipti := "); single_value->field_ipti.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 IuUP__RabFlowCombination_template::log_match(const IuUP__RabFlowCombination& 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_rfci.match(match_value.rfci(), legacy)){ TTCN_Logger::log_logmatch_info(".rfci"); single_value->field_rfci.log_match(match_value.rfci(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_sub__flow__bits.match(match_value.sub__flow__bits(), legacy)){ TTCN_Logger::log_logmatch_info(".sub_flow_bits"); single_value->field_sub__flow__bits.log_match(match_value.sub__flow__bits(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_ipti.match(match_value.ipti(), legacy)){ TTCN_Logger::log_logmatch_info(".ipti"); single_value->field_ipti.log_match(match_value.ipti(), 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("{ rfci := "); single_value->field_rfci.log_match(match_value.rfci(), legacy); TTCN_Logger::log_event_str(", sub_flow_bits := "); single_value->field_sub__flow__bits.log_match(match_value.sub__flow__bits(), legacy); TTCN_Logger::log_event_str(", ipti := "); single_value->field_ipti.log_match(match_value.ipti(), 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 IuUP__RabFlowCombination_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (rfci().is_bound()) rfci().set_implicit_omit(); if (sub__flow__bits().is_bound()) sub__flow__bits().set_implicit_omit(); if (ipti().is_bound()) ipti().set_implicit_omit(); } void IuUP__RabFlowCombination_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_rfci.encode_text(text_buf); single_value->field_sub__flow__bits.encode_text(text_buf); single_value->field_ipti.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 @IuUP_Emulation.IuUP_RabFlowCombination."); } } void IuUP__RabFlowCombination_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_rfci.decode_text(text_buf); single_value->field_sub__flow__bits.decode_text(text_buf); single_value->field_ipti.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 IuUP__RabFlowCombination_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 @IuUP_Emulation.IuUP_RabFlowCombination."); } } void IuUP__RabFlowCombination_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: { IuUP__RabFlowCombination_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_i0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) rfci().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) sub__flow__bits().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) ipti().set_param(*param.get_elem(2)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "rfci")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rfci().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "sub_flow_bits")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { sub__flow__bits().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ipti")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ipti().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @IuUP_Emulation.IuUP_RabFlowCombination: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { IuUP__RabFlowCombination_template* precondition = new IuUP__RabFlowCombination_template; precondition->set_param(*param.get_elem(0)); IuUP__RabFlowCombination_template* implied_template = new IuUP__RabFlowCombination_template; implied_template->set_param(*param.get_elem(1)); *this = IuUP__RabFlowCombination_template(precondition, implied_template); } break; default: param.type_error("record template", "@IuUP_Emulation.IuUP_RabFlowCombination"); } is_ifpresent = param.get_ifpresent(); } void IuUP__RabFlowCombination_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_rfci.check_restriction(t_res, t_name ? t_name : "@IuUP_Emulation.IuUP_RabFlowCombination"); single_value->field_sub__flow__bits.check_restriction(t_res, t_name ? t_name : "@IuUP_Emulation.IuUP_RabFlowCombination"); single_value->field_ipti.check_restriction(t_res, t_name ? t_name : "@IuUP_Emulation.IuUP_RabFlowCombination"); 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 : "@IuUP_Emulation.IuUP_RabFlowCombination"); } boolean IuUP__RabFlowCombination_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean IuUP__RabFlowCombination_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_idxref_count = 1; val_ptr->n_elements = 0; val_ptr->value_elements = NULL; } IuUP__RabFlowCombinationList::IuUP__RabFlowCombinationList(const IuUP__RabFlowCombinationList& other_value) { if (!other_value.is_bound()) TTCN_error("Copying an unbound value of type @IuUP_Emulation.IuUP_RabFlowCombinationList."); val_ptr = other_value.val_ptr; val_ptr->ref_count++; } IuUP__RabFlowCombinationList::~IuUP__RabFlowCombinationList() { clean_up(); if (val_ptr != NULL) val_ptr = NULL; } void IuUP__RabFlowCombinationList::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."); } } IuUP__RabFlowCombinationList& IuUP__RabFlowCombinationList::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; } IuUP__RabFlowCombinationList& IuUP__RabFlowCombinationList::operator=(const IuUP__RabFlowCombinationList& other_value) { if (other_value.val_ptr == NULL) TTCN_error("Assigning an unbound value of type @IuUP_Emulation.IuUP_RabFlowCombinationList."); if (this != &other_value) { clean_up(); val_ptr = other_value.val_ptr; val_ptr->ref_count++; } return *this; } boolean IuUP__RabFlowCombinationList::operator==(null_type) const { if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @IuUP_Emulation.IuUP_RabFlowCombinationList."); return val_ptr->n_elements == 0 ; } boolean IuUP__RabFlowCombinationList::operator==(const IuUP__RabFlowCombinationList& other_value) const { if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @IuUP_Emulation.IuUP_RabFlowCombinationList."); if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @IuUP_Emulation.IuUP_RabFlowCombinationList."); 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; } IuUP__RabFlowCombination& IuUP__RabFlowCombinationList::operator[](int index_value) { if (index_value < 0) TTCN_error("Accessing an element of type @IuUP_Emulation.IuUP_RabFlowCombinationList 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 = (IuUP__RabFlowCombination**)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 IuUP__RabFlowCombination(*(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 IuUP__RabFlowCombination; } return *val_ptr->value_elements[index_value]; } IuUP__RabFlowCombination& IuUP__RabFlowCombinationList::operator[](const INTEGER& index_value) { index_value.must_bound("Using an unbound integer value for indexing a value of type @IuUP_Emulation.IuUP_RabFlowCombinationList."); return (*this)[(int)index_value]; } const IuUP__RabFlowCombination& IuUP__RabFlowCombinationList::operator[](int index_value) const { if (val_ptr == NULL) TTCN_error("Accessing an element in an unbound value of type @IuUP_Emulation.IuUP_RabFlowCombinationList."); if (index_value < 0) TTCN_error("Accessing an element of type @IuUP_Emulation.IuUP_RabFlowCombinationList using a negative index: %d.", index_value); if (index_value >= val_ptr->n_elements) TTCN_error("Index overflow in a value of type @IuUP_Emulation.IuUP_RabFlowCombinationList: 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 IuUP__RabFlowCombination& IuUP__RabFlowCombinationList::operator[](const INTEGER& index_value) const { index_value.must_bound("Using an unbound integer value for indexing a value of type @IuUP_Emulation.IuUP_RabFlowCombinationList."); return (*this)[(int)index_value]; } IuUP__RabFlowCombinationList IuUP__RabFlowCombinationList::operator<<=(int rotate_count) const { return *this >>= (-rotate_count); } IuUP__RabFlowCombinationList IuUP__RabFlowCombinationList::operator<<=(const INTEGER& rotate_count) const { rotate_count.must_bound("Unbound integer operand of rotate left operator."); return *this >>= (int)(-rotate_count); } IuUP__RabFlowCombinationList IuUP__RabFlowCombinationList::operator>>=(const INTEGER& rotate_count) const { rotate_count.must_bound("Unbound integer operand of rotate right operator."); return *this >>= (int)rotate_count; } IuUP__RabFlowCombinationList IuUP__RabFlowCombinationList::operator>>=(int rotate_count) const { if (val_ptr == NULL) TTCN_error("Performing rotation operation on an unbound value of type @IuUP_Emulation.IuUP_RabFlowCombinationList."); 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; IuUP__RabFlowCombinationList ret_val; ret_val.set_size(val_ptr->n_elements); for (int i=0; in_elements; i++) { if (val_ptr->value_elements[i] != NULL) { ret_val.val_ptr->value_elements[(i+rc)%val_ptr->n_elements] =new IuUP__RabFlowCombination(*val_ptr->value_elements[i]); } } return ret_val; } IuUP__RabFlowCombinationList IuUP__RabFlowCombinationList::operator+(const IuUP__RabFlowCombinationList& other_value) const { if (val_ptr == NULL || other_value.val_ptr == NULL) TTCN_error("Unbound operand of @IuUP_Emulation.IuUP_RabFlowCombinationList concatenation."); if (val_ptr->n_elements == 0) return other_value; if (other_value.val_ptr->n_elements == 0) return *this; IuUP__RabFlowCombinationList ret_val; ret_val.set_size(val_ptr->n_elements+other_value.val_ptr->n_elements); for (int i=0; in_elements; i++) { if (val_ptr->value_elements[i] != NULL) { ret_val.val_ptr->value_elements[i] = new IuUP__RabFlowCombination(*val_ptr->value_elements[i]); } } for (int i=0; in_elements; i++) { if (other_value.val_ptr->value_elements[i] != NULL) { ret_val.val_ptr->value_elements[i+val_ptr->n_elements] = new IuUP__RabFlowCombination(*other_value.val_ptr->value_elements[i]); } } return ret_val; } IuUP__RabFlowCombinationList IuUP__RabFlowCombinationList::substr(int index, int returncount) const { if (val_ptr == NULL) TTCN_error("The first argument of substr() is an unbound value of type @IuUP_Emulation.IuUP_RabFlowCombinationList."); check_substr_arguments(val_ptr->n_elements, index, returncount, "@IuUP_Emulation.IuUP_RabFlowCombinationList","element"); IuUP__RabFlowCombinationList ret_val; ret_val.set_size(returncount); for (int i=0; ivalue_elements[i+index] != NULL) { ret_val.val_ptr->value_elements[i] = new IuUP__RabFlowCombination(*val_ptr->value_elements[i+index]); } } return ret_val; } IuUP__RabFlowCombinationList IuUP__RabFlowCombinationList::replace(int index, int len, const IuUP__RabFlowCombinationList& repl) const { if (val_ptr == NULL) TTCN_error("The first argument of replace() is an unbound value of type @IuUP_Emulation.IuUP_RabFlowCombinationList."); if (repl.val_ptr == NULL) TTCN_error("The fourth argument of replace() is an unbound value of type @IuUP_Emulation.IuUP_RabFlowCombinationList."); check_replace_arguments(val_ptr->n_elements, index, len, "@IuUP_Emulation.IuUP_RabFlowCombinationList","element"); IuUP__RabFlowCombinationList 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 IuUP__RabFlowCombination(*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 IuUP__RabFlowCombination(*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 IuUP__RabFlowCombination(*val_ptr->value_elements[index+i+len]); } } return ret_val; } IuUP__RabFlowCombinationList IuUP__RabFlowCombinationList::replace(int index, int len, const IuUP__RabFlowCombinationList_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 IuUP__RabFlowCombinationList::set_size(int new_size) { if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a value of type @IuUP_Emulation.IuUP_RabFlowCombinationList."); 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 = (IuUP__RabFlowCombination**)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 IuUP__RabFlowCombination(*(val_ptr->value_elements[elem_count])); } } clean_up(); val_ptr = new_val_ptr; } if (new_size > val_ptr->n_elements) { val_ptr->value_elements = (IuUP__RabFlowCombination**)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 @IuUP_Emulation.IuUP_RabFlowCombinationList: %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 = (IuUP__RabFlowCombination**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size); val_ptr->n_elements = new_size; } } boolean IuUP__RabFlowCombinationList::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 IuUP__RabFlowCombinationList::size_of() const { if (val_ptr == NULL) TTCN_error("Performing sizeof operation on an unbound value of type @IuUP_Emulation.IuUP_RabFlowCombinationList."); return val_ptr->n_elements; } int IuUP__RabFlowCombinationList::lengthof() const { if (val_ptr == NULL) TTCN_error("Performing lengthof operation on an unbound value of type @IuUP_Emulation.IuUP_RabFlowCombinationList."); 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 IuUP__RabFlowCombinationList::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 IuUP__RabFlowCombinationList::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 IuUP__RabFlowCombinationList::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; iget_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; iget_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", "@IuUP_Emulation.IuUP_RabFlowCombinationList"); } 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; iget_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", "@IuUP_Emulation.IuUP_RabFlowCombinationList"); } break; default: TTCN_error("Internal error: Unknown operation type."); } } void IuUP__RabFlowCombinationList::encode_text(Text_Buf& text_buf) const { if (val_ptr == NULL) TTCN_error("Text encoder: Encoding an unbound value of type @IuUP_Emulation.IuUP_RabFlowCombinationList."); 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 IuUP__RabFlowCombinationList::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 @IuUP_Emulation.IuUP_RabFlowCombinationList."); val_ptr->value_elements = (IuUP__RabFlowCombination**)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 IuUP__RabFlowCombination; val_ptr->value_elements[elem_count]->decode_text(text_buf); } } void IuUP__RabFlowCombinationList_template::copy_value(const IuUP__RabFlowCombinationList& other_value) { if (!other_value.is_bound()) TTCN_error("Initialization of a template of type @IuUP_Emulation.IuUP_RabFlowCombinationList with an unbound value."); single_value.n_elements = other_value.size_of(); single_value.value_elements = (IuUP__RabFlowCombination_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 IuUP__RabFlowCombination_template(other_value[elem_count]); } else { single_value.value_elements[elem_count] = new IuUP__RabFlowCombination_template; } } set_selection(SPECIFIC_VALUE); } void IuUP__RabFlowCombinationList_template::copy_template(const IuUP__RabFlowCombinationList_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 = (IuUP__RabFlowCombination_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 IuUP__RabFlowCombination_template(*other_value.single_value.value_elements[elem_count]); } else { single_value.value_elements[elem_count] = new IuUP__RabFlowCombination_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 IuUP__RabFlowCombinationList_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 IuUP__RabFlowCombinationList_template(*other_value.implication_.precondition); implication_.implied_template = new IuUP__RabFlowCombinationList_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 @IuUP_Emulation.IuUP_RabFlowCombinationList."); break; } set_selection(other_value); } boolean IuUP__RabFlowCombinationList_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 IuUP__RabFlowCombinationList_template*)template_ptr)->single_value.value_elements[template_index]->match((*(const IuUP__RabFlowCombinationList*)value_ptr)[value_index], legacy); else return ((const IuUP__RabFlowCombinationList_template*)template_ptr)->single_value.value_elements[template_index]->is_any_or_omit(); } IuUP__RabFlowCombinationList_template::IuUP__RabFlowCombinationList_template() { } IuUP__RabFlowCombinationList_template::IuUP__RabFlowCombinationList_template(template_sel other_value) : Base_Record_Of_Template(other_value) { check_single_selection(other_value); } IuUP__RabFlowCombinationList_template::IuUP__RabFlowCombinationList_template(null_type) : Base_Record_Of_Template(SPECIFIC_VALUE) { single_value.n_elements = 0; single_value.value_elements = NULL; } IuUP__RabFlowCombinationList_template::IuUP__RabFlowCombinationList_template(const IuUP__RabFlowCombinationList& other_value) { copy_value(other_value); } IuUP__RabFlowCombinationList_template::IuUP__RabFlowCombinationList_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const IuUP__RabFlowCombinationList&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @IuUP_Emulation.IuUP_RabFlowCombinationList from an unbound optional field."); } } IuUP__RabFlowCombinationList_template::IuUP__RabFlowCombinationList_template(IuUP__RabFlowCombinationList_template* p_precondition, IuUP__RabFlowCombinationList_template* p_implied_template) : Base_Record_Of_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } IuUP__RabFlowCombinationList_template::IuUP__RabFlowCombinationList_template(Dynamic_Match_Interface* p_dyn_match) : Base_Record_Of_Template(DYNAMIC_MATCH) { dyn_match = new dynmatch_struct; dyn_match->ptr = p_dyn_match; dyn_match->ref_count = 1; } IuUP__RabFlowCombinationList_template::IuUP__RabFlowCombinationList_template(const IuUP__RabFlowCombinationList_template& other_value) : Base_Record_Of_Template() { copy_template(other_value); } IuUP__RabFlowCombinationList_template::~IuUP__RabFlowCombinationList_template() { clean_up(); } void IuUP__RabFlowCombinationList_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; } IuUP__RabFlowCombinationList_template& IuUP__RabFlowCombinationList_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } IuUP__RabFlowCombinationList_template& IuUP__RabFlowCombinationList_template::operator=(null_type) { clean_up(); set_selection(SPECIFIC_VALUE); single_value.n_elements = 0; single_value.value_elements = NULL; return *this; } IuUP__RabFlowCombinationList_template& IuUP__RabFlowCombinationList_template::operator=(const IuUP__RabFlowCombinationList& other_value) { clean_up(); copy_value(other_value); return *this; } IuUP__RabFlowCombinationList_template& IuUP__RabFlowCombinationList_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const IuUP__RabFlowCombinationList&)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 @IuUP_Emulation.IuUP_RabFlowCombinationList."); } return *this; } IuUP__RabFlowCombinationList_template& IuUP__RabFlowCombinationList_template::operator=(const IuUP__RabFlowCombinationList_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } IuUP__RabFlowCombination_template& IuUP__RabFlowCombinationList_template::operator[](int index_value) { if (index_value < 0) TTCN_error("Accessing an element of a template for type @IuUP_Emulation.IuUP_RabFlowCombinationList 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 @IuUP_Emulation.IuUP_RabFlowCombinationList."); break; } return *single_value.value_elements[index_value]; } IuUP__RabFlowCombination_template& IuUP__RabFlowCombinationList_template::operator[](const INTEGER& index_value) { index_value.must_bound("Using an unbound integer value for indexing a template of type @IuUP_Emulation.IuUP_RabFlowCombinationList."); return (*this)[(int)index_value]; } const IuUP__RabFlowCombination_template& IuUP__RabFlowCombinationList_template::operator[](int index_value) const { if (index_value < 0) TTCN_error("Accessing an element of a template for type @IuUP_Emulation.IuUP_RabFlowCombinationList using a negative index: %d.", index_value); if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing an element of a non-specific template for type @IuUP_Emulation.IuUP_RabFlowCombinationList."); if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @IuUP_Emulation.IuUP_RabFlowCombinationList: 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 IuUP__RabFlowCombination_template& IuUP__RabFlowCombinationList_template::operator[](const INTEGER& index_value) const { index_value.must_bound("Using an unbound integer value for indexing a template of type @IuUP_Emulation.IuUP_RabFlowCombinationList."); return (*this)[(int)index_value]; } void IuUP__RabFlowCombinationList_template::set_size(int new_size) { if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a template of type @IuUP_Emulation.IuUP_RabFlowCombinationList."); 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 = (IuUP__RabFlowCombination_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 IuUP__RabFlowCombination_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 IuUP__RabFlowCombination_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 = (IuUP__RabFlowCombination_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size); single_value.n_elements = new_size; } } int IuUP__RabFlowCombinationList_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 IuUP__RabFlowCombinationList_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 @IuUP_Emulation.IuUP_RabFlowCombinationList 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; iget_selection()) { case OMIT_VALUE: TTCN_error("Performing %sof() operation on a template of type @IuUP_Emulation.IuUP_RabFlowCombinationList 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 @IuUP_Emulation.IuUP_RabFlowCombinationList 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 @IuUP_Emulation.IuUP_RabFlowCombinationList 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 @IuUP_Emulation.IuUP_RabFlowCombinationList 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 @IuUP_Emulation.IuUP_RabFlowCombinationList containing complemented list.", op_name); default: TTCN_error("Performing %sof() operation on an uninitialized/unsupported template of type @IuUP_Emulation.IuUP_RabFlowCombinationList.", op_name); } return check_section_is_single(min_size, has_any_or_none, op_name, "a", "template of type @IuUP_Emulation.IuUP_RabFlowCombinationList"); } boolean IuUP__RabFlowCombinationList_template::match(const IuUP__RabFlowCombinationList& 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 @IuUP_Emulation.IuUP_RabFlowCombinationList."); } return FALSE; } boolean IuUP__RabFlowCombinationList_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; } IuUP__RabFlowCombinationList IuUP__RabFlowCombinationList_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 @IuUP_Emulation.IuUP_RabFlowCombinationList."); IuUP__RabFlowCombinationList 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; } IuUP__RabFlowCombinationList IuUP__RabFlowCombinationList_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); } IuUP__RabFlowCombinationList IuUP__RabFlowCombinationList_template::replace(int index, int len, const IuUP__RabFlowCombinationList_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()); } IuUP__RabFlowCombinationList IuUP__RabFlowCombinationList_template::replace(int index, int len, const IuUP__RabFlowCombinationList& 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 IuUP__RabFlowCombinationList_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 IuUP__RabFlowCombinationList_template[list_length]; break; default: TTCN_error("Internal error: Setting an invalid type for a template of type @IuUP_Emulation.IuUP_RabFlowCombinationList."); } set_selection(template_type); } IuUP__RabFlowCombinationList_template& IuUP__RabFlowCombinationList_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 @IuUP_Emulation.IuUP_RabFlowCombinationList."); if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of type @IuUP_Emulation.IuUP_RabFlowCombinationList."); return value_list.list_value[list_index]; } void IuUP__RabFlowCombinationList_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 IuUP__RabFlowCombinationList_template::log_match(const IuUP__RabFlowCombinationList& 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 IuUP__RabFlowCombinationList_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 @IuUP_Emulation.IuUP_RabFlowCombinationList."); } } void IuUP__RabFlowCombinationList_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 @IuUP_Emulation.IuUP_RabFlowCombinationList."); single_value.value_elements = (IuUP__RabFlowCombination_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 IuUP__RabFlowCombination_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 IuUP__RabFlowCombinationList_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 @IuUP_Emulation.IuUP_RabFlowCombinationList."); } } boolean IuUP__RabFlowCombinationList_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean IuUP__RabFlowCombinationList_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; iset_implicit_omit(); } } void IuUP__RabFlowCombinationList_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: { IuUP__RabFlowCombinationList_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_iget_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_iget_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_iget_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: { IuUP__RabFlowCombinationList_template* precondition = new IuUP__RabFlowCombinationList_template; precondition->set_param(*param.get_elem(0)); IuUP__RabFlowCombinationList_template* implied_template = new IuUP__RabFlowCombinationList_template; implied_template->set_param(*param.get_elem(1)); *this = IuUP__RabFlowCombinationList_template(precondition, implied_template); } break; default: param.type_error("record of template", "@IuUP_Emulation.IuUP_RabFlowCombinationList"); } is_ifpresent = param.get_ifpresent(); set_length_range(param); } void IuUP__RabFlowCombinationList_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; icheck_restriction(t_res, t_name ? t_name : "@IuUP_Emulation.IuUP_RabFlowCombinationList"); 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 : "@IuUP_Emulation.IuUP_RabFlowCombinationList"); } boolean IuUP__RabFlowCombinationList_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); } } IuUP__Config::IuUP__Config() { } IuUP__Config::IuUP__Config(const BOOLEAN& par_active__init, const BOOLEAN& par_data__pdu__type__0, const IuUP__RabFlowCombinationList& par_rab__flow__combs) : field_active__init(par_active__init), field_data__pdu__type__0(par_data__pdu__type__0), field_rab__flow__combs(par_rab__flow__combs) { } IuUP__Config::IuUP__Config(const IuUP__Config& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @IuUP_Emulation.IuUP_Config."); if (other_value.active__init().is_bound()) field_active__init = other_value.active__init(); else field_active__init.clean_up(); if (other_value.data__pdu__type__0().is_bound()) field_data__pdu__type__0 = other_value.data__pdu__type__0(); else field_data__pdu__type__0.clean_up(); if (other_value.rab__flow__combs().is_bound()) field_rab__flow__combs = other_value.rab__flow__combs(); else field_rab__flow__combs.clean_up(); } void IuUP__Config::clean_up() { field_active__init.clean_up(); field_data__pdu__type__0.clean_up(); field_rab__flow__combs.clean_up(); } const TTCN_Typedescriptor_t* IuUP__Config::get_descriptor() const { return &IuUP__Config_descr_; } IuUP__Config& IuUP__Config::operator=(const IuUP__Config& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @IuUP_Emulation.IuUP_Config."); if (other_value.active__init().is_bound()) field_active__init = other_value.active__init(); else field_active__init.clean_up(); if (other_value.data__pdu__type__0().is_bound()) field_data__pdu__type__0 = other_value.data__pdu__type__0(); else field_data__pdu__type__0.clean_up(); if (other_value.rab__flow__combs().is_bound()) field_rab__flow__combs = other_value.rab__flow__combs(); else field_rab__flow__combs.clean_up(); } return *this; } boolean IuUP__Config::operator==(const IuUP__Config& other_value) const { return field_active__init==other_value.field_active__init && field_data__pdu__type__0==other_value.field_data__pdu__type__0 && field_rab__flow__combs==other_value.field_rab__flow__combs; } boolean IuUP__Config::is_bound() const { return (field_active__init.is_bound()) || (field_data__pdu__type__0.is_bound()) || (field_rab__flow__combs.is_bound()); } boolean IuUP__Config::is_value() const { return field_active__init.is_value() && field_data__pdu__type__0.is_value() && field_rab__flow__combs.is_value(); } void IuUP__Config::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ active_init := "); field_active__init.log(); TTCN_Logger::log_event_str(", data_pdu_type_0 := "); field_data__pdu__type__0.log(); TTCN_Logger::log_event_str(", rab_flow_combs := "); field_rab__flow__combs.log(); TTCN_Logger::log_event_str(" }"); } void IuUP__Config::set_implicit_omit() { if (active__init().is_bound()) active__init().set_implicit_omit(); if (data__pdu__type__0().is_bound()) data__pdu__type__0().set_implicit_omit(); if (rab__flow__combs().is_bound()) rab__flow__combs().set_implicit_omit(); } void IuUP__Config::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "record value"); switch (param.get_type()) { case Module_Param::MP_Value_List: if (30 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) active__init().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) data__pdu__type__0().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) rab__flow__combs().set_param(*param.get_elem(2)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "active_init")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { active__init().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "data_pdu_type_0")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { data__pdu__type__0().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rab_flow_combs")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rab__flow__combs().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @IuUP_Emulation.IuUP_Config: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@IuUP_Emulation.IuUP_Config"); } } void IuUP__Config::encode_text(Text_Buf& text_buf) const { field_active__init.encode_text(text_buf); field_data__pdu__type__0.encode_text(text_buf); field_rab__flow__combs.encode_text(text_buf); } void IuUP__Config::decode_text(Text_Buf& text_buf) { field_active__init.decode_text(text_buf); field_data__pdu__type__0.decode_text(text_buf); field_rab__flow__combs.decode_text(text_buf); } struct IuUP__Config_template::single_value_struct { BOOLEAN_template field_active__init; BOOLEAN_template field_data__pdu__type__0; IuUP__RabFlowCombinationList_template field_rab__flow__combs; }; void IuUP__Config_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_active__init = ANY_VALUE; single_value->field_data__pdu__type__0 = ANY_VALUE; single_value->field_rab__flow__combs = ANY_VALUE; } } } void IuUP__Config_template::copy_value(const IuUP__Config& other_value) { single_value = new single_value_struct; if (other_value.active__init().is_bound()) { single_value->field_active__init = other_value.active__init(); } else { single_value->field_active__init.clean_up(); } if (other_value.data__pdu__type__0().is_bound()) { single_value->field_data__pdu__type__0 = other_value.data__pdu__type__0(); } else { single_value->field_data__pdu__type__0.clean_up(); } if (other_value.rab__flow__combs().is_bound()) { single_value->field_rab__flow__combs = other_value.rab__flow__combs(); } else { single_value->field_rab__flow__combs.clean_up(); } set_selection(SPECIFIC_VALUE); } void IuUP__Config_template::copy_template(const IuUP__Config_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.active__init().get_selection()) { single_value->field_active__init = other_value.active__init(); } else { single_value->field_active__init.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.data__pdu__type__0().get_selection()) { single_value->field_data__pdu__type__0 = other_value.data__pdu__type__0(); } else { single_value->field_data__pdu__type__0.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.rab__flow__combs().get_selection()) { single_value->field_rab__flow__combs = other_value.rab__flow__combs(); } else { single_value->field_rab__flow__combs.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 IuUP__Config_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 IuUP__Config_template(*other_value.implication_.precondition); implication_.implied_template = new IuUP__Config_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 @IuUP_Emulation.IuUP_Config."); break; } set_selection(other_value); } IuUP__Config_template::IuUP__Config_template() { } IuUP__Config_template::IuUP__Config_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } IuUP__Config_template::IuUP__Config_template(const IuUP__Config& other_value) { copy_value(other_value); } IuUP__Config_template::IuUP__Config_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const IuUP__Config&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @IuUP_Emulation.IuUP_Config from an unbound optional field."); } } IuUP__Config_template::IuUP__Config_template(IuUP__Config_template* p_precondition, IuUP__Config_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } IuUP__Config_template::IuUP__Config_template(Dynamic_Match_Interface* p_dyn_match) : Base_Template(DYNAMIC_MATCH) { dyn_match = new dynmatch_struct; dyn_match->ptr = p_dyn_match; dyn_match->ref_count = 1; } IuUP__Config_template::IuUP__Config_template(const IuUP__Config_template& other_value) : Base_Template() { copy_template(other_value); } IuUP__Config_template::~IuUP__Config_template() { clean_up(); } IuUP__Config_template& IuUP__Config_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } IuUP__Config_template& IuUP__Config_template::operator=(const IuUP__Config& other_value) { clean_up(); copy_value(other_value); return *this; } IuUP__Config_template& IuUP__Config_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const IuUP__Config&)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 @IuUP_Emulation.IuUP_Config."); } return *this; } IuUP__Config_template& IuUP__Config_template::operator=(const IuUP__Config_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean IuUP__Config_template::match(const IuUP__Config& 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.active__init().is_bound()) return FALSE; if(!single_value->field_active__init.match(other_value.active__init(), legacy))return FALSE; if(!other_value.data__pdu__type__0().is_bound()) return FALSE; if(!single_value->field_data__pdu__type__0.match(other_value.data__pdu__type__0(), legacy))return FALSE; if(!other_value.rab__flow__combs().is_bound()) return FALSE; if(!single_value->field_rab__flow__combs.match(other_value.rab__flow__combs(), 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 @IuUP_Emulation.IuUP_Config."); } return FALSE; } boolean IuUP__Config_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_active__init.is_bound() || single_value->field_data__pdu__type__0.is_bound() || single_value->field_rab__flow__combs.is_bound(); } boolean IuUP__Config_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_active__init.is_value() && single_value->field_data__pdu__type__0.is_value() && single_value->field_rab__flow__combs.is_value(); } void IuUP__Config_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; } IuUP__Config IuUP__Config_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 @IuUP_Emulation.IuUP_Config."); IuUP__Config ret_val; if (single_value->field_active__init.is_bound()) { ret_val.active__init() = single_value->field_active__init.valueof(); } if (single_value->field_data__pdu__type__0.is_bound()) { ret_val.data__pdu__type__0() = single_value->field_data__pdu__type__0.valueof(); } if (single_value->field_rab__flow__combs.is_bound()) { ret_val.rab__flow__combs() = single_value->field_rab__flow__combs.valueof(); } return ret_val; } void IuUP__Config_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 @IuUP_Emulation.IuUP_Config."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new IuUP__Config_template[list_length]; } IuUP__Config_template& IuUP__Config_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 @IuUP_Emulation.IuUP_Config."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @IuUP_Emulation.IuUP_Config."); return value_list.list_value[list_index]; } BOOLEAN_template& IuUP__Config_template::active__init() { set_specific(); return single_value->field_active__init; } const BOOLEAN_template& IuUP__Config_template::active__init() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field active_init of a non-specific template of type @IuUP_Emulation.IuUP_Config."); return single_value->field_active__init; } BOOLEAN_template& IuUP__Config_template::data__pdu__type__0() { set_specific(); return single_value->field_data__pdu__type__0; } const BOOLEAN_template& IuUP__Config_template::data__pdu__type__0() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field data_pdu_type_0 of a non-specific template of type @IuUP_Emulation.IuUP_Config."); return single_value->field_data__pdu__type__0; } IuUP__RabFlowCombinationList_template& IuUP__Config_template::rab__flow__combs() { set_specific(); return single_value->field_rab__flow__combs; } const IuUP__RabFlowCombinationList_template& IuUP__Config_template::rab__flow__combs() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field rab_flow_combs of a non-specific template of type @IuUP_Emulation.IuUP_Config."); return single_value->field_rab__flow__combs; } int IuUP__Config_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @IuUP_Emulation.IuUP_Config 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 @IuUP_Emulation.IuUP_Config 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 @IuUP_Emulation.IuUP_Config containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @IuUP_Emulation.IuUP_Config containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @IuUP_Emulation.IuUP_Config containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @IuUP_Emulation.IuUP_Config containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @IuUP_Emulation.IuUP_Config containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @IuUP_Emulation.IuUP_Config containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @IuUP_Emulation.IuUP_Config containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @IuUP_Emulation.IuUP_Config."); } return 0; } void IuUP__Config_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ active_init := "); single_value->field_active__init.log(); TTCN_Logger::log_event_str(", data_pdu_type_0 := "); single_value->field_data__pdu__type__0.log(); TTCN_Logger::log_event_str(", rab_flow_combs := "); single_value->field_rab__flow__combs.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 IuUP__Config_template::log_match(const IuUP__Config& 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_active__init.match(match_value.active__init(), legacy)){ TTCN_Logger::log_logmatch_info(".active_init"); single_value->field_active__init.log_match(match_value.active__init(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_data__pdu__type__0.match(match_value.data__pdu__type__0(), legacy)){ TTCN_Logger::log_logmatch_info(".data_pdu_type_0"); single_value->field_data__pdu__type__0.log_match(match_value.data__pdu__type__0(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_rab__flow__combs.match(match_value.rab__flow__combs(), legacy)){ TTCN_Logger::log_logmatch_info(".rab_flow_combs"); single_value->field_rab__flow__combs.log_match(match_value.rab__flow__combs(), 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("{ active_init := "); single_value->field_active__init.log_match(match_value.active__init(), legacy); TTCN_Logger::log_event_str(", data_pdu_type_0 := "); single_value->field_data__pdu__type__0.log_match(match_value.data__pdu__type__0(), legacy); TTCN_Logger::log_event_str(", rab_flow_combs := "); single_value->field_rab__flow__combs.log_match(match_value.rab__flow__combs(), 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 IuUP__Config_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (active__init().is_bound()) active__init().set_implicit_omit(); if (data__pdu__type__0().is_bound()) data__pdu__type__0().set_implicit_omit(); if (rab__flow__combs().is_bound()) rab__flow__combs().set_implicit_omit(); } void IuUP__Config_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_active__init.encode_text(text_buf); single_value->field_data__pdu__type__0.encode_text(text_buf); single_value->field_rab__flow__combs.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 @IuUP_Emulation.IuUP_Config."); } } void IuUP__Config_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_active__init.decode_text(text_buf); single_value->field_data__pdu__type__0.decode_text(text_buf); single_value->field_rab__flow__combs.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 IuUP__Config_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 @IuUP_Emulation.IuUP_Config."); } } void IuUP__Config_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: { IuUP__Config_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_i0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) active__init().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) data__pdu__type__0().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) rab__flow__combs().set_param(*param.get_elem(2)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "active_init")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { active__init().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "data_pdu_type_0")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { data__pdu__type__0().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rab_flow_combs")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rab__flow__combs().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @IuUP_Emulation.IuUP_Config: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { IuUP__Config_template* precondition = new IuUP__Config_template; precondition->set_param(*param.get_elem(0)); IuUP__Config_template* implied_template = new IuUP__Config_template; implied_template->set_param(*param.get_elem(1)); *this = IuUP__Config_template(precondition, implied_template); } break; default: param.type_error("record template", "@IuUP_Emulation.IuUP_Config"); } is_ifpresent = param.get_ifpresent(); } void IuUP__Config_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_active__init.check_restriction(t_res, t_name ? t_name : "@IuUP_Emulation.IuUP_Config"); single_value->field_data__pdu__type__0.check_restriction(t_res, t_name ? t_name : "@IuUP_Emulation.IuUP_Config"); single_value->field_rab__flow__combs.check_restriction(t_res, t_name ? t_name : "@IuUP_Emulation.IuUP_Config"); 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 : "@IuUP_Emulation.IuUP_Config"); } boolean IuUP__Config_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean IuUP__Config_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(int other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @IuUP_Emulation.IuUP_Em_State."); if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @IuUP_Emulation.IuUP_Em_State comparison is an unknown numeric value %d", other_value); return enum_value > other_value; } boolean IuUP__Em__State::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 @IuUP_Emulation.IuUP_Em_State."); return enum_value > other_value; } boolean IuUP__Em__State::operator>(const IuUP__Em__State& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @IuUP_Emulation.IuUP_Em_State."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @IuUP_Emulation.IuUP_Em_State."); return enum_value > other_value.enum_value; } const char *IuUP__Em__State::enum_to_str(enum_type enum_par) { switch (enum_par) { case ST__INIT: return "ST_INIT"; case ST__DATA__TRANSFER__READY: return "ST_DATA_TRANSFER_READY"; default: return ""; } } IuUP__Em__State::enum_type IuUP__Em__State::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, "ST_INIT")) return ST__INIT; if (!strcmp(str_par, "ST_DATA_TRANSFER_READY")) return ST__DATA__TRANSFER__READY; } return UNKNOWN_VALUE; } boolean IuUP__Em__State::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int IuUP__Em__State::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 @IuUP_Emulation.IuUP_Em_State.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int IuUP__Em__State::enum2int(const IuUP__Em__State& 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 @IuUP_Emulation.IuUP_Em_State.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void IuUP__Em__State::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @IuUP_Emulation.IuUP_Em_State.", int_val); enum_value = (enum_type)int_val; } IuUP__Em__State::operator IuUP__Em__State::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @IuUP_Emulation.IuUP_Em_State."); return enum_value; } void IuUP__Em__State::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 IuUP__Em__State::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", "@IuUP_Emulation.IuUP_Em_State"); 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 @IuUP_Emulation.IuUP_Em_State."); } } void IuUP__Em__State::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @IuUP_Emulation.IuUP_Em_State."); text_buf.push_int(enum_value); } void IuUP__Em__State::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 @IuUP_Emulation.IuUP_Em_State.", enum_value); } void IuUP__Em__State_template::copy_template(const IuUP__Em__State_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 IuUP__Em__State_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 IuUP__Em__State_template(*other_value.implication_.precondition); implication_.implied_template = new IuUP__Em__State_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 @IuUP_Emulation.IuUP_Em_State."); } } IuUP__Em__State_template::IuUP__Em__State_template() { } IuUP__Em__State_template::IuUP__Em__State_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } IuUP__Em__State_template::IuUP__Em__State_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!IuUP__Em__State::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @IuUP_Emulation.IuUP_Em_State with unknown numeric value %d.", other_value); single_value = (IuUP__Em__State::enum_type)other_value; } IuUP__Em__State_template::IuUP__Em__State_template(IuUP__Em__State::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } IuUP__Em__State_template::IuUP__Em__State_template(const IuUP__Em__State& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == IuUP__Em__State::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @IuUP_Emulation.IuUP_Em_State."); single_value = other_value.enum_value; } IuUP__Em__State_template::IuUP__Em__State_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (IuUP__Em__State::enum_type)(const IuUP__Em__State&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @IuUP_Emulation.IuUP_Em_State from an unbound optional field."); } } IuUP__Em__State_template::IuUP__Em__State_template(IuUP__Em__State_template* p_precondition, IuUP__Em__State_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } IuUP__Em__State_template::IuUP__Em__State_template(Dynamic_Match_Interface* p_dyn_match) : Base_Template(DYNAMIC_MATCH) { dyn_match = new dynmatch_struct; dyn_match->ptr = p_dyn_match; dyn_match->ref_count = 1; } IuUP__Em__State_template::IuUP__Em__State_template(const IuUP__Em__State_template& other_value) : Base_Template() { copy_template(other_value); } IuUP__Em__State_template::~IuUP__Em__State_template() { clean_up(); } boolean IuUP__Em__State_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean IuUP__Em__State_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != IuUP__Em__State::UNBOUND_VALUE; } void IuUP__Em__State_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; } IuUP__Em__State_template& IuUP__Em__State_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } IuUP__Em__State_template& IuUP__Em__State_template::operator=(int other_value) { if (!IuUP__Em__State::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @IuUP_Emulation.IuUP_Em_State.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (IuUP__Em__State::enum_type)other_value; return *this; } IuUP__Em__State_template& IuUP__Em__State_template::operator=(IuUP__Em__State::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } IuUP__Em__State_template& IuUP__Em__State_template::operator=(const IuUP__Em__State& other_value) { if (other_value.enum_value == IuUP__Em__State::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @IuUP_Emulation.IuUP_Em_State to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } IuUP__Em__State_template& IuUP__Em__State_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (IuUP__Em__State::enum_type)(const IuUP__Em__State&)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 @IuUP_Emulation.IuUP_Em_State."); } return *this; } IuUP__Em__State_template& IuUP__Em__State_template::operator=(const IuUP__Em__State_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean IuUP__Em__State_template::match(IuUP__Em__State::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 @IuUP_Emulation.IuUP_Em_State."); } return FALSE; } boolean IuUP__Em__State_template::match(const IuUP__Em__State& other_value, boolean) const { if (other_value.enum_value == IuUP__Em__State::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @IuUP_Emulation.IuUP_Em_State with an unbound value."); return match(other_value.enum_value); } IuUP__Em__State::enum_type IuUP__Em__State_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 @IuUP_Emulation.IuUP_Em_State."); return single_value; } void IuUP__Em__State_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 IuUP__Em__State_template[list_length]; break; default: TTCN_error("Setting an invalid type for a template of enumerated type @IuUP_Emulation.IuUP_Em_State."); } } IuUP__Em__State_template& IuUP__Em__State_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 @IuUP_Emulation.IuUP_Em_State."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @IuUP_Emulation.IuUP_Em_State."); return value_list.list_value[list_index]; } void IuUP__Em__State_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(IuUP__Em__State::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 IuUP__Em__State_template::log_match(const IuUP__Em__State& 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 IuUP__Em__State_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 @IuUP_Emulation.IuUP_Em_State."); } } void IuUP__Em__State_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (IuUP__Em__State::enum_type)text_buf.pull_int().get_val(); if (!IuUP__Em__State::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @IuUP_Emulation.IuUP_Em_State.", 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 IuUP__Em__State_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 @IuUP_Emulation.IuUP_Em_State."); } } boolean IuUP__Em__State_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean IuUP__Em__State_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; iget_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: { IuUP__Em__State_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_iget_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: { IuUP__Em__State::enum_type enum_val = IuUP__Em__State::str_to_enum(m_p->get_enumerated(), m_p->get_enumerated_value()); if (!IuUP__Em__State::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @IuUP_Emulation.IuUP_Em_State."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { IuUP__Em__State_template* precondition = new IuUP__Em__State_template; precondition->set_param(*m_p->get_elem(0)); IuUP__Em__State_template* implied_template = new IuUP__Em__State_template; implied_template->set_param(*m_p->get_elem(1)); *this = IuUP__Em__State_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@IuUP_Emulation.IuUP_Em_State"); } is_ifpresent = param.get_ifpresent(); } void IuUP__Em__State_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 : "@IuUP_Emulation.IuUP_Em_State"); } IuUP__Entity::IuUP__Entity() { } IuUP__Entity::IuUP__Entity(const IuUP__Config& par_cfg, const IuUP__Em__State& par_state, const INTEGER& par_tx__next__frame__nr, const OPTIONAL< INTEGER >& par_rx__last__frame__nr, const OPTIONAL< IuUP__Types::IuUP__PDU >& par_pending__tx__pdu) : field_cfg(par_cfg), field_state(par_state), field_tx__next__frame__nr(par_tx__next__frame__nr), field_rx__last__frame__nr(par_rx__last__frame__nr), field_pending__tx__pdu(par_pending__tx__pdu) { } IuUP__Entity::IuUP__Entity(const IuUP__Entity& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @IuUP_Emulation.IuUP_Entity."); if (other_value.cfg().is_bound()) field_cfg = other_value.cfg(); else field_cfg.clean_up(); if (other_value.state().is_bound()) field_state = other_value.state(); else field_state.clean_up(); if (other_value.tx__next__frame__nr().is_bound()) field_tx__next__frame__nr = other_value.tx__next__frame__nr(); else field_tx__next__frame__nr.clean_up(); if (other_value.rx__last__frame__nr().is_bound()) field_rx__last__frame__nr = other_value.rx__last__frame__nr(); else field_rx__last__frame__nr.clean_up(); if (other_value.pending__tx__pdu().is_bound()) field_pending__tx__pdu = other_value.pending__tx__pdu(); else field_pending__tx__pdu.clean_up(); } void IuUP__Entity::clean_up() { field_cfg.clean_up(); field_state.clean_up(); field_tx__next__frame__nr.clean_up(); field_rx__last__frame__nr.clean_up(); field_pending__tx__pdu.clean_up(); } const TTCN_Typedescriptor_t* IuUP__Entity::get_descriptor() const { return &IuUP__Entity_descr_; } IuUP__Entity& IuUP__Entity::operator=(const IuUP__Entity& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @IuUP_Emulation.IuUP_Entity."); if (other_value.cfg().is_bound()) field_cfg = other_value.cfg(); else field_cfg.clean_up(); if (other_value.state().is_bound()) field_state = other_value.state(); else field_state.clean_up(); if (other_value.tx__next__frame__nr().is_bound()) field_tx__next__frame__nr = other_value.tx__next__frame__nr(); else field_tx__next__frame__nr.clean_up(); if (other_value.rx__last__frame__nr().is_bound()) field_rx__last__frame__nr = other_value.rx__last__frame__nr(); else field_rx__last__frame__nr.clean_up(); if (other_value.pending__tx__pdu().is_bound()) field_pending__tx__pdu = other_value.pending__tx__pdu(); else field_pending__tx__pdu.clean_up(); } return *this; } boolean IuUP__Entity::operator==(const IuUP__Entity& other_value) const { return field_cfg==other_value.field_cfg && field_state==other_value.field_state && field_tx__next__frame__nr==other_value.field_tx__next__frame__nr && field_rx__last__frame__nr==other_value.field_rx__last__frame__nr && field_pending__tx__pdu==other_value.field_pending__tx__pdu; } boolean IuUP__Entity::is_bound() const { return (field_cfg.is_bound()) || (field_state.is_bound()) || (field_tx__next__frame__nr.is_bound()) || (OPTIONAL_OMIT == field_rx__last__frame__nr.get_selection() || field_rx__last__frame__nr.is_bound()) || (OPTIONAL_OMIT == field_pending__tx__pdu.get_selection() || field_pending__tx__pdu.is_bound()); } boolean IuUP__Entity::is_value() const { return field_cfg.is_value() && field_state.is_value() && field_tx__next__frame__nr.is_value() && (OPTIONAL_OMIT == field_rx__last__frame__nr.get_selection() || field_rx__last__frame__nr.is_value()) && (OPTIONAL_OMIT == field_pending__tx__pdu.get_selection() || field_pending__tx__pdu.is_value()); } int IuUP__Entity::size_of() const { int ret_val = 3; if (field_rx__last__frame__nr.ispresent()) ret_val++; if (field_pending__tx__pdu.ispresent()) ret_val++; return ret_val; } void IuUP__Entity::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(", state := "); field_state.log(); TTCN_Logger::log_event_str(", tx_next_frame_nr := "); field_tx__next__frame__nr.log(); TTCN_Logger::log_event_str(", rx_last_frame_nr := "); field_rx__last__frame__nr.log(); TTCN_Logger::log_event_str(", pending_tx_pdu := "); field_pending__tx__pdu.log(); TTCN_Logger::log_event_str(" }"); } void IuUP__Entity::set_implicit_omit() { if (cfg().is_bound()) cfg().set_implicit_omit(); if (state().is_bound()) state().set_implicit_omit(); if (tx__next__frame__nr().is_bound()) tx__next__frame__nr().set_implicit_omit(); if (!rx__last__frame__nr().is_bound()) rx__last__frame__nr() = OMIT_VALUE; else rx__last__frame__nr().set_implicit_omit(); if (!pending__tx__pdu().is_bound()) pending__tx__pdu() = OMIT_VALUE; else pending__tx__pdu().set_implicit_omit(); } void IuUP__Entity::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 (50 && 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) state().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) tx__next__frame__nr().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) rx__last__frame__nr().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) pending__tx__pdu().set_param(*param.get_elem(4)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_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_idxget_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_idxget_id()->get_name(), "tx_next_frame_nr")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { tx__next__frame__nr().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rx_last_frame_nr")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rx__last__frame__nr().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "pending_tx_pdu")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { pending__tx__pdu().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @IuUP_Emulation.IuUP_Entity: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@IuUP_Emulation.IuUP_Entity"); } } void IuUP__Entity::encode_text(Text_Buf& text_buf) const { field_cfg.encode_text(text_buf); field_state.encode_text(text_buf); field_tx__next__frame__nr.encode_text(text_buf); field_rx__last__frame__nr.encode_text(text_buf); field_pending__tx__pdu.encode_text(text_buf); } void IuUP__Entity::decode_text(Text_Buf& text_buf) { field_cfg.decode_text(text_buf); field_state.decode_text(text_buf); field_tx__next__frame__nr.decode_text(text_buf); field_rx__last__frame__nr.decode_text(text_buf); field_pending__tx__pdu.decode_text(text_buf); } struct IuUP__Entity_template::single_value_struct { IuUP__Config_template field_cfg; IuUP__Em__State_template field_state; INTEGER_template field_tx__next__frame__nr; INTEGER_template field_rx__last__frame__nr; IuUP__Types::IuUP__PDU_template field_pending__tx__pdu; }; void IuUP__Entity_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_state = ANY_VALUE; single_value->field_tx__next__frame__nr = ANY_VALUE; single_value->field_rx__last__frame__nr = ANY_OR_OMIT; single_value->field_pending__tx__pdu = ANY_OR_OMIT; } } } void IuUP__Entity_template::copy_value(const IuUP__Entity& 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.state().is_bound()) { single_value->field_state = other_value.state(); } else { single_value->field_state.clean_up(); } if (other_value.tx__next__frame__nr().is_bound()) { single_value->field_tx__next__frame__nr = other_value.tx__next__frame__nr(); } else { single_value->field_tx__next__frame__nr.clean_up(); } if (other_value.rx__last__frame__nr().is_bound()) { if (other_value.rx__last__frame__nr().ispresent()) single_value->field_rx__last__frame__nr = other_value.rx__last__frame__nr()(); else single_value->field_rx__last__frame__nr = OMIT_VALUE; } else { single_value->field_rx__last__frame__nr.clean_up(); } if (other_value.pending__tx__pdu().is_bound()) { if (other_value.pending__tx__pdu().ispresent()) single_value->field_pending__tx__pdu = other_value.pending__tx__pdu()(); else single_value->field_pending__tx__pdu = OMIT_VALUE; } else { single_value->field_pending__tx__pdu.clean_up(); } set_selection(SPECIFIC_VALUE); } void IuUP__Entity_template::copy_template(const IuUP__Entity_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.state().get_selection()) { single_value->field_state = other_value.state(); } else { single_value->field_state.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.tx__next__frame__nr().get_selection()) { single_value->field_tx__next__frame__nr = other_value.tx__next__frame__nr(); } else { single_value->field_tx__next__frame__nr.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.rx__last__frame__nr().get_selection()) { single_value->field_rx__last__frame__nr = other_value.rx__last__frame__nr(); } else { single_value->field_rx__last__frame__nr.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.pending__tx__pdu().get_selection()) { single_value->field_pending__tx__pdu = other_value.pending__tx__pdu(); } else { single_value->field_pending__tx__pdu.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 IuUP__Entity_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 IuUP__Entity_template(*other_value.implication_.precondition); implication_.implied_template = new IuUP__Entity_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 @IuUP_Emulation.IuUP_Entity."); break; } set_selection(other_value); } IuUP__Entity_template::IuUP__Entity_template() { } IuUP__Entity_template::IuUP__Entity_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } IuUP__Entity_template::IuUP__Entity_template(const IuUP__Entity& other_value) { copy_value(other_value); } IuUP__Entity_template::IuUP__Entity_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const IuUP__Entity&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @IuUP_Emulation.IuUP_Entity from an unbound optional field."); } } IuUP__Entity_template::IuUP__Entity_template(IuUP__Entity_template* p_precondition, IuUP__Entity_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } IuUP__Entity_template::IuUP__Entity_template(Dynamic_Match_Interface* p_dyn_match) : Base_Template(DYNAMIC_MATCH) { dyn_match = new dynmatch_struct; dyn_match->ptr = p_dyn_match; dyn_match->ref_count = 1; } IuUP__Entity_template::IuUP__Entity_template(const IuUP__Entity_template& other_value) : Base_Template() { copy_template(other_value); } IuUP__Entity_template::~IuUP__Entity_template() { clean_up(); } IuUP__Entity_template& IuUP__Entity_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } IuUP__Entity_template& IuUP__Entity_template::operator=(const IuUP__Entity& other_value) { clean_up(); copy_value(other_value); return *this; } IuUP__Entity_template& IuUP__Entity_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const IuUP__Entity&)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 @IuUP_Emulation.IuUP_Entity."); } return *this; } IuUP__Entity_template& IuUP__Entity_template::operator=(const IuUP__Entity_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean IuUP__Entity_template::match(const IuUP__Entity& 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.state().is_bound()) return FALSE; if(!single_value->field_state.match(other_value.state(), legacy))return FALSE; if(!other_value.tx__next__frame__nr().is_bound()) return FALSE; if(!single_value->field_tx__next__frame__nr.match(other_value.tx__next__frame__nr(), legacy))return FALSE; if(!other_value.rx__last__frame__nr().is_bound()) return FALSE; if((other_value.rx__last__frame__nr().ispresent() ? !single_value->field_rx__last__frame__nr.match((const INTEGER&)other_value.rx__last__frame__nr(), legacy) : !single_value->field_rx__last__frame__nr.match_omit(legacy)))return FALSE; if(!other_value.pending__tx__pdu().is_bound()) return FALSE; if((other_value.pending__tx__pdu().ispresent() ? !single_value->field_pending__tx__pdu.match((const IuUP__Types::IuUP__PDU&)other_value.pending__tx__pdu(), legacy) : !single_value->field_pending__tx__pdu.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 @IuUP_Emulation.IuUP_Entity."); } return FALSE; } boolean IuUP__Entity_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_state.is_bound() || single_value->field_tx__next__frame__nr.is_bound() || (single_value->field_rx__last__frame__nr.is_omit() || single_value->field_rx__last__frame__nr.is_bound()) || (single_value->field_pending__tx__pdu.is_omit() || single_value->field_pending__tx__pdu.is_bound()); } boolean IuUP__Entity_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_cfg.is_value() && single_value->field_state.is_value() && single_value->field_tx__next__frame__nr.is_value() && (single_value->field_rx__last__frame__nr.is_omit() || single_value->field_rx__last__frame__nr.is_value()) && (single_value->field_pending__tx__pdu.is_omit() || single_value->field_pending__tx__pdu.is_value()); } void IuUP__Entity_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; } IuUP__Entity IuUP__Entity_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 @IuUP_Emulation.IuUP_Entity."); IuUP__Entity ret_val; if (single_value->field_cfg.is_bound()) { ret_val.cfg() = single_value->field_cfg.valueof(); } if (single_value->field_state.is_bound()) { ret_val.state() = single_value->field_state.valueof(); } if (single_value->field_tx__next__frame__nr.is_bound()) { ret_val.tx__next__frame__nr() = single_value->field_tx__next__frame__nr.valueof(); } if (single_value->field_rx__last__frame__nr.is_omit()) ret_val.rx__last__frame__nr() = OMIT_VALUE; else if (single_value->field_rx__last__frame__nr.is_bound()) { ret_val.rx__last__frame__nr() = single_value->field_rx__last__frame__nr.valueof(); } if (single_value->field_pending__tx__pdu.is_omit()) ret_val.pending__tx__pdu() = OMIT_VALUE; else if (single_value->field_pending__tx__pdu.is_bound()) { ret_val.pending__tx__pdu() = single_value->field_pending__tx__pdu.valueof(); } return ret_val; } void IuUP__Entity_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 @IuUP_Emulation.IuUP_Entity."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new IuUP__Entity_template[list_length]; } IuUP__Entity_template& IuUP__Entity_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 @IuUP_Emulation.IuUP_Entity."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @IuUP_Emulation.IuUP_Entity."); return value_list.list_value[list_index]; } IuUP__Config_template& IuUP__Entity_template::cfg() { set_specific(); return single_value->field_cfg; } const IuUP__Config_template& IuUP__Entity_template::cfg() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field cfg of a non-specific template of type @IuUP_Emulation.IuUP_Entity."); return single_value->field_cfg; } IuUP__Em__State_template& IuUP__Entity_template::state() { set_specific(); return single_value->field_state; } const IuUP__Em__State_template& IuUP__Entity_template::state() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field state of a non-specific template of type @IuUP_Emulation.IuUP_Entity."); return single_value->field_state; } INTEGER_template& IuUP__Entity_template::tx__next__frame__nr() { set_specific(); return single_value->field_tx__next__frame__nr; } const INTEGER_template& IuUP__Entity_template::tx__next__frame__nr() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field tx_next_frame_nr of a non-specific template of type @IuUP_Emulation.IuUP_Entity."); return single_value->field_tx__next__frame__nr; } INTEGER_template& IuUP__Entity_template::rx__last__frame__nr() { set_specific(); return single_value->field_rx__last__frame__nr; } const INTEGER_template& IuUP__Entity_template::rx__last__frame__nr() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field rx_last_frame_nr of a non-specific template of type @IuUP_Emulation.IuUP_Entity."); return single_value->field_rx__last__frame__nr; } IuUP__Types::IuUP__PDU_template& IuUP__Entity_template::pending__tx__pdu() { set_specific(); return single_value->field_pending__tx__pdu; } const IuUP__Types::IuUP__PDU_template& IuUP__Entity_template::pending__tx__pdu() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pending_tx_pdu of a non-specific template of type @IuUP_Emulation.IuUP_Entity."); return single_value->field_pending__tx__pdu; } int IuUP__Entity_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @IuUP_Emulation.IuUP_Entity which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 3; if (single_value->field_rx__last__frame__nr.is_present()) ret_val++; if (single_value->field_pending__tx__pdu.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 @IuUP_Emulation.IuUP_Entity 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 @IuUP_Emulation.IuUP_Entity containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @IuUP_Emulation.IuUP_Entity containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @IuUP_Emulation.IuUP_Entity containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @IuUP_Emulation.IuUP_Entity containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @IuUP_Emulation.IuUP_Entity containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @IuUP_Emulation.IuUP_Entity containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @IuUP_Emulation.IuUP_Entity containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @IuUP_Emulation.IuUP_Entity."); } return 0; } void IuUP__Entity_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(", state := "); single_value->field_state.log(); TTCN_Logger::log_event_str(", tx_next_frame_nr := "); single_value->field_tx__next__frame__nr.log(); TTCN_Logger::log_event_str(", rx_last_frame_nr := "); single_value->field_rx__last__frame__nr.log(); TTCN_Logger::log_event_str(", pending_tx_pdu := "); single_value->field_pending__tx__pdu.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 IuUP__Entity_template::log_match(const IuUP__Entity& 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_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); } if(!single_value->field_tx__next__frame__nr.match(match_value.tx__next__frame__nr(), legacy)){ TTCN_Logger::log_logmatch_info(".tx_next_frame_nr"); single_value->field_tx__next__frame__nr.log_match(match_value.tx__next__frame__nr(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.rx__last__frame__nr().ispresent()){ if(!single_value->field_rx__last__frame__nr.match(match_value.rx__last__frame__nr(), legacy)){ TTCN_Logger::log_logmatch_info(".rx_last_frame_nr"); single_value->field_rx__last__frame__nr.log_match(match_value.rx__last__frame__nr(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_rx__last__frame__nr.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".rx_last_frame_nr := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_rx__last__frame__nr.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if (match_value.pending__tx__pdu().ispresent()){ if(!single_value->field_pending__tx__pdu.match(match_value.pending__tx__pdu(), legacy)){ TTCN_Logger::log_logmatch_info(".pending_tx_pdu"); single_value->field_pending__tx__pdu.log_match(match_value.pending__tx__pdu(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_pending__tx__pdu.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".pending_tx_pdu := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_pending__tx__pdu.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("{ cfg := "); single_value->field_cfg.log_match(match_value.cfg(), legacy); TTCN_Logger::log_event_str(", state := "); single_value->field_state.log_match(match_value.state(), legacy); TTCN_Logger::log_event_str(", tx_next_frame_nr := "); single_value->field_tx__next__frame__nr.log_match(match_value.tx__next__frame__nr(), legacy); TTCN_Logger::log_event_str(", rx_last_frame_nr := "); if (match_value.rx__last__frame__nr().ispresent()) { single_value->field_rx__last__frame__nr.log_match(match_value.rx__last__frame__nr(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_rx__last__frame__nr.log(); if (single_value->field_rx__last__frame__nr.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", pending_tx_pdu := "); if (match_value.pending__tx__pdu().ispresent()) { single_value->field_pending__tx__pdu.log_match(match_value.pending__tx__pdu(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_pending__tx__pdu.log(); if (single_value->field_pending__tx__pdu.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 IuUP__Entity_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (cfg().is_bound()) cfg().set_implicit_omit(); if (state().is_bound()) state().set_implicit_omit(); if (tx__next__frame__nr().is_bound()) tx__next__frame__nr().set_implicit_omit(); if (!rx__last__frame__nr().is_bound()) rx__last__frame__nr() = OMIT_VALUE; else rx__last__frame__nr().set_implicit_omit(); if (!pending__tx__pdu().is_bound()) pending__tx__pdu() = OMIT_VALUE; else pending__tx__pdu().set_implicit_omit(); } void IuUP__Entity_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_state.encode_text(text_buf); single_value->field_tx__next__frame__nr.encode_text(text_buf); single_value->field_rx__last__frame__nr.encode_text(text_buf); single_value->field_pending__tx__pdu.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 @IuUP_Emulation.IuUP_Entity."); } } void IuUP__Entity_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_state.decode_text(text_buf); single_value->field_tx__next__frame__nr.decode_text(text_buf); single_value->field_rx__last__frame__nr.decode_text(text_buf); single_value->field_pending__tx__pdu.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 IuUP__Entity_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 @IuUP_Emulation.IuUP_Entity."); } } void IuUP__Entity_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: { IuUP__Entity_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_i0 && 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) state().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) tx__next__frame__nr().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) rx__last__frame__nr().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) pending__tx__pdu().set_param(*param.get_elem(4)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_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_idxget_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_idxget_id()->get_name(), "tx_next_frame_nr")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { tx__next__frame__nr().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rx_last_frame_nr")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rx__last__frame__nr().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "pending_tx_pdu")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { pending__tx__pdu().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @IuUP_Emulation.IuUP_Entity: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { IuUP__Entity_template* precondition = new IuUP__Entity_template; precondition->set_param(*param.get_elem(0)); IuUP__Entity_template* implied_template = new IuUP__Entity_template; implied_template->set_param(*param.get_elem(1)); *this = IuUP__Entity_template(precondition, implied_template); } break; default: param.type_error("record template", "@IuUP_Emulation.IuUP_Entity"); } is_ifpresent = param.get_ifpresent(); } void IuUP__Entity_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 : "@IuUP_Emulation.IuUP_Entity"); single_value->field_state.check_restriction(t_res, t_name ? t_name : "@IuUP_Emulation.IuUP_Entity"); single_value->field_tx__next__frame__nr.check_restriction(t_res, t_name ? t_name : "@IuUP_Emulation.IuUP_Entity"); single_value->field_rx__last__frame__nr.check_restriction(t_res, t_name ? t_name : "@IuUP_Emulation.IuUP_Entity"); single_value->field_pending__tx__pdu.check_restriction(t_res, t_name ? t_name : "@IuUP_Emulation.IuUP_Entity"); 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 : "@IuUP_Emulation.IuUP_Entity"); } boolean IuUP__Entity_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean IuUP__Entity_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_idxn_elements == 0; } IuUP__RabFlowCombination_template t__IuUP__RFC(const INTEGER& rfci, const IuUP__Types::RecOfU8& subflow__bits, const INTEGER& ipti) { TTCN_Location current_location("IuUP_Emulation.ttcn", 31, TTCN_Location::LOCATION_TEMPLATE, "t_IuUP_RFC"); IuUP__RabFlowCombination_template ret_val; ret_val.rfci() = rfci; ret_val.sub__flow__bits() = subflow__bits; ret_val.ipti() = ipti; return ret_val; } IuUP__RabFlowCombination_template t__IuUP__RFC__AMR__12__2(const INTEGER& rfci) { TTCN_Location current_location("IuUP_Emulation.ttcn", 37, TTCN_Location::LOCATION_TEMPLATE, "t_IuUP_RFC_AMR_12_2"); IuUP__RabFlowCombination_template ret_val; { IuUP__Types::RecOfU8 tmp_0; tmp_0.set_size(3); tmp_0[0] = 81; tmp_0[1] = 103; tmp_0[2] = 60; ret_val = t__IuUP__RFC(rfci, tmp_0, 1); } return ret_val; } IuUP__RabFlowCombination_template t__IuUP__RFC__AMR__SID(const INTEGER& rfci) { TTCN_Location current_location("IuUP_Emulation.ttcn", 38, TTCN_Location::LOCATION_TEMPLATE, "t_IuUP_RFC_AMR_SID"); IuUP__RabFlowCombination_template ret_val; { IuUP__Types::RecOfU8 tmp_1; tmp_1.set_size(3); tmp_1[0] = 39; tmp_1[1] = 0; tmp_1[2] = 0; ret_val = t__IuUP__RFC(rfci, tmp_1, 7); } return ret_val; } IuUP__RabFlowCombination_template t__IuUP__RFC__AMR__NO__DATA(const INTEGER& rfci) { TTCN_Location current_location("IuUP_Emulation.ttcn", 39, TTCN_Location::LOCATION_TEMPLATE, "t_IuUP_RFC_AMR_NO_DATA"); IuUP__RabFlowCombination_template ret_val; { IuUP__Types::RecOfU8 tmp_2; tmp_2.set_size(3); tmp_2[0] = 0; tmp_2[1] = 0; tmp_2[2] = 0; ret_val = t__IuUP__RFC(rfci, tmp_2, 1); } return ret_val; } IuUP__Config_template t__IuUP__Config(const BOOLEAN& active__init, const BOOLEAN& , const IuUP__RabFlowCombinationList_template& rab__flow__combs) { TTCN_Location current_location("IuUP_Emulation.ttcn", 65, TTCN_Location::LOCATION_TEMPLATE, "t_IuUP_Config"); IuUP__Config_template ret_val; ret_val.active__init() = active__init; ret_val.data__pdu__type__0() = TRUE; ret_val.rab__flow__combs() = rab__flow__combs; return ret_val; } IuUP__Entity_template t__IuUP__Entity(const IuUP__Config_template& cfg) { TTCN_Location current_location("IuUP_Emulation.ttcn", 93, TTCN_Location::LOCATION_TEMPLATE, "t_IuUP_Entity"); IuUP__Entity_template ret_val; ret_val.cfg() = cfg; ret_val.state() = IuUP__Em__State::ST__INIT; ret_val.tx__next__frame__nr() = 0; ret_val.rx__last__frame__nr() = OMIT_VALUE; ret_val.pending__tx__pdu() = OMIT_VALUE; return ret_val; } OCTETSTRING f__IuUP__Em__rx__decaps(IuUP__Entity& st, const OCTETSTRING& inp) { TTCN_Location current_location("IuUP_Emulation.ttcn", 102, TTCN_Location::LOCATION_FUNCTION, "f_IuUP_Em_rx_decaps"); current_location.update_lineno(103); /* IuUP_Emulation.ttcn, line 103 */ IuUP__Types::IuUP__PDU pdu(IuUP__Types::dec__IuUP__PDU(inp)); current_location.update_lineno(104); /* IuUP_Emulation.ttcn, line 104 */ if (pdu.ischosen(IuUP__Types::IuUP__PDU::ALT_type__0)) { current_location.update_lineno(105); /* IuUP_Emulation.ttcn, line 105 */ if (const_cast< const IuUP__Entity&>(st).cfg().data__pdu__type__0()) { current_location.update_lineno(107); /* IuUP_Emulation.ttcn, line 107 */ st.rx__last__frame__nr() = const_cast< const IuUP__Types::IuUP__PDU&>(pdu).type__0().frame__nr(); current_location.update_lineno(108); /* IuUP_Emulation.ttcn, line 108 */ return const_cast< const IuUP__Types::IuUP__PDU&>(pdu).type__0().payload(); } else { current_location.update_lineno(110); /* IuUP_Emulation.ttcn, line 110 */ TTCN_Runtime::setverdict(FAIL,(TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("PDU Type 0 received but 1 configured"),TTCN_Logger::end_event_log2str())); current_location.update_lineno(111); /* IuUP_Emulation.ttcn, line 111 */ TTCN_Runtime::stop_component(MTC_COMPREF); } } else { current_location.update_lineno(113); /* IuUP_Emulation.ttcn, line 113 */ if (pdu.ischosen(IuUP__Types::IuUP__PDU::ALT_type__1)) { current_location.update_lineno(114); /* IuUP_Emulation.ttcn, line 114 */ if ((const_cast< const IuUP__Entity&>(st).cfg().data__pdu__type__0() == FALSE)) { current_location.update_lineno(116); /* IuUP_Emulation.ttcn, line 116 */ st.rx__last__frame__nr() = const_cast< const IuUP__Types::IuUP__PDU&>(pdu).type__1().frame__nr(); current_location.update_lineno(117); /* IuUP_Emulation.ttcn, line 117 */ return const_cast< const IuUP__Types::IuUP__PDU&>(pdu).type__1().payload(); } else { current_location.update_lineno(119); /* IuUP_Emulation.ttcn, line 119 */ TTCN_Runtime::setverdict(FAIL,(TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("PDU Type 1 received but 0 configured"),TTCN_Logger::end_event_log2str())); current_location.update_lineno(120); /* IuUP_Emulation.ttcn, line 120 */ TTCN_Runtime::stop_component(MTC_COMPREF); } } else { current_location.update_lineno(122); /* IuUP_Emulation.ttcn, line 122 */ if (pdu.ischosen(IuUP__Types::IuUP__PDU::ALT_type__14)) { current_location.update_lineno(123); /* IuUP_Emulation.ttcn, line 123 */ if (IuUP__Types::tr__IuUP__INIT(IuUP__Types::tr__IuUP__INIT_init_defval, IuUP__Types::tr__IuUP__INIT_payload_defval, IuUP__Types::tr__IuUP__INIT_frame__nr_defval, IuUP__Types::tr__IuUP__INIT_version_defval).match(pdu)) { current_location.update_lineno(124); /* IuUP_Emulation.ttcn, line 124 */ if ((const_cast< const IuUP__Entity&>(st).cfg().active__init() == TRUE)) { current_location.update_lineno(125); /* IuUP_Emulation.ttcn, line 125 */ TTCN_Runtime::setverdict(FAIL,(TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("INIT received in ACTIVE role"),TTCN_Logger::end_event_log2str())); current_location.update_lineno(126); /* IuUP_Emulation.ttcn, line 126 */ TTCN_Runtime::stop_component(MTC_COMPREF); } else { current_location.update_lineno(129); /* IuUP_Emulation.ttcn, line 129 */ st.pending__tx__pdu() = IuUP__Types::ts__IuUP__INIT__ACK(const_cast< const IuUP__Types::IuUP__PDU&>(pdu).type__14().frame__nr(), const_cast< const IuUP__Types::IuUP__PDU&>(pdu).type__14().u().proc().hdr().iuup__version()).valueof(); } } else { current_location.update_lineno(132); /* IuUP_Emulation.ttcn, line 132 */ if (IuUP__Types::tr__IuUP__INIT__ACK(IuUP__Types::tr__IuUP__INIT__ACK_frame__nr_defval, IuUP__Types::tr__IuUP__INIT__ACK_version_defval).match(pdu)) { current_location.update_lineno(133); /* IuUP_Emulation.ttcn, line 133 */ if ((const_cast< const IuUP__Entity&>(st).cfg().active__init() == TRUE)) { current_location.update_lineno(134); /* IuUP_Emulation.ttcn, line 134 */ TTCN_Logger::log_str(TTCN_USER, "IuUP INIT_ACK Received"); current_location.update_lineno(135); /* IuUP_Emulation.ttcn, line 135 */ st.pending__tx__pdu() = OMIT_VALUE; current_location.update_lineno(136); /* IuUP_Emulation.ttcn, line 136 */ st.state() = IuUP__Em__State::ST__DATA__TRANSFER__READY; } else { current_location.update_lineno(138); /* IuUP_Emulation.ttcn, line 138 */ TTCN_Runtime::setverdict(FAIL,(TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("INIT_ACK received in PASSIVE role"),TTCN_Logger::end_event_log2str())); current_location.update_lineno(139); /* IuUP_Emulation.ttcn, line 139 */ TTCN_Runtime::stop_component(MTC_COMPREF); } } } current_location.update_lineno(142); /* IuUP_Emulation.ttcn, line 142 */ return os_0; } else { current_location.update_lineno(144); /* IuUP_Emulation.ttcn, line 144 */ TTCN_Runtime::setverdict(FAIL,(TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Impossible IuUP PDU decoded from "),inp.log(),TTCN_Logger::end_event_log2str())); current_location.update_lineno(145); /* IuUP_Emulation.ttcn, line 145 */ TTCN_Runtime::stop_component(MTC_COMPREF); } } } current_location.update_lineno(147); /* IuUP_Emulation.ttcn, line 147 */ TTCN_Runtime::stop_execution(); } IuUP__Types::IuUP__PDU f__ts__IuUP__INIT(IuUP__Entity& st) { TTCN_Location current_location("IuUP_Emulation.ttcn", 150, TTCN_Location::LOCATION_FUNCTION, "f_ts_IuUP_INIT"); current_location.update_lineno(152); /* IuUP_Emulation.ttcn, line 152 */ IuUP__Types::IuUP__PDU pdu; current_location.update_lineno(153); /* IuUP_Emulation.ttcn, line 153 */ INTEGER data__pdu__type; current_location.update_lineno(154); /* IuUP_Emulation.ttcn, line 154 */ IuUP__Types::IuUP__InitRfci_template rfci(OMIT_VALUE); current_location.update_lineno(155); /* IuUP_Emulation.ttcn, line 155 */ IuUP__Types::IuUP__IPTI__List IPTIs(NULL_VALUE); current_location.update_lineno(156); /* IuUP_Emulation.ttcn, line 156 */ INTEGER num__rfci(const_cast< const IuUP__Entity&>(st).cfg().rab__flow__combs().lengthof()); current_location.update_lineno(158); /* IuUP_Emulation.ttcn, line 158 */ if ((const_cast< const IuUP__Entity&>(st).cfg().data__pdu__type__0() == TRUE)) { current_location.update_lineno(159); /* IuUP_Emulation.ttcn, line 159 */ data__pdu__type = 0; } else { current_location.update_lineno(161); /* IuUP_Emulation.ttcn, line 161 */ data__pdu__type = 1; } { current_location.update_lineno(165); /* IuUP_Emulation.ttcn, line 165 */ INTEGER remain(num__rfci); current_location.update_lineno(165); /* IuUP_Emulation.ttcn, line 165 */ for ( ; ; ) { current_location.update_lineno(165); /* IuUP_Emulation.ttcn, line 165 */ if (!(remain > 0)) break; current_location.update_lineno(166); /* IuUP_Emulation.ttcn, line 166 */ IuUP__RabFlowCombination comb(const_cast< const IuUP__Entity&>(st).cfg().rab__flow__combs()[(remain - 1)]); current_location.update_lineno(167); /* IuUP_Emulation.ttcn, line 167 */ BOOLEAN lri(FALSE); current_location.update_lineno(168); /* IuUP_Emulation.ttcn, line 168 */ if ((remain == num__rfci)) { current_location.update_lineno(169); /* IuUP_Emulation.ttcn, line 169 */ lri = TRUE; } current_location.update_lineno(171); /* IuUP_Emulation.ttcn, line 171 */ rfci = IuUP__Types::ts__IuUP__InitRfci(BOOLEAN_template(lri), BOOLEAN_template(FALSE), INTEGER_template(const_cast< const IuUP__RabFlowCombination&>(comb).rfci()), IuUP__Types::RecOfU8_template(const_cast< const IuUP__RabFlowCombination&>(comb).sub__flow__bits()), IuUP__Types::RecOfU16_template(OMIT_VALUE), rfci); current_location.update_lineno(165); /* IuUP_Emulation.ttcn, line 165 */ { INTEGER tmp_18; --remain; } } } { current_location.update_lineno(175); /* IuUP_Emulation.ttcn, line 175 */ INTEGER i(0); current_location.update_lineno(175); /* IuUP_Emulation.ttcn, line 175 */ for ( ; ; ) { current_location.update_lineno(175); /* IuUP_Emulation.ttcn, line 175 */ if (!(i < num__rfci)) break; current_location.update_lineno(176); /* IuUP_Emulation.ttcn, line 176 */ { IuUP__Types::IuUP__IPTI__List tmp_19; { IuUP__Types::IuUP__IPTI__List tmp_20; tmp_20.set_size(1); tmp_20[0] = const_cast< const IuUP__Entity&>(st).cfg().rab__flow__combs()[i].ipti(); tmp_19 = (IPTIs + tmp_20); } IPTIs = tmp_19; } current_location.update_lineno(175); /* IuUP_Emulation.ttcn, line 175 */ { INTEGER tmp_21; ++i; } } } current_location.update_lineno(179); /* IuUP_Emulation.ttcn, line 179 */ IuUP__Types::IuUP__PDU14__ProcSending__INIT_template tpl; { IuUP__Types::IuUP__InitRfci_template tmp_22; tmp_22 = rfci; tmp_22.check_restriction(TR_VALUE); tpl = IuUP__Types::ts__IuUP__PDU14__ProcSending__INIT(BOOLEAN_template(TRUE), INTEGER_template(num__rfci), BOOLEAN_template(FALSE), tmp_22, IuUP__Types::IuUP__IPTI__List_template(IPTIs), BITSTRING_template(bs_0), INTEGER_template(data__pdu__type)); } current_location.update_lineno(188); /* IuUP_Emulation.ttcn, line 188 */ pdu = IuUP__Types::ts__IuUP__INIT(tpl, IuUP__Types::ts__IuUP__INIT_frame__nr_defval, IuUP__Types::ts__IuUP__INIT_version_defval).valueof(); current_location.update_lineno(189); /* IuUP_Emulation.ttcn, line 189 */ return pdu; } OCTETSTRING f__IuUP__Em__tx__encap(IuUP__Entity& st, const OCTETSTRING& payload) { TTCN_Location current_location("IuUP_Emulation.ttcn", 192, TTCN_Location::LOCATION_FUNCTION, "f_IuUP_Em_tx_encap"); current_location.update_lineno(193); /* IuUP_Emulation.ttcn, line 193 */ IuUP__Types::IuUP__PDU pdu; { const IuUP__Em__State &tmp_25 = const_cast< const IuUP__Entity&>(st).state(); current_location.update_lineno(195); /* IuUP_Emulation.ttcn, line 195 */ if(tmp_25 == IuUP__Em__State::ST__INIT) goto tmp_24_0; current_location.update_lineno(214); /* IuUP_Emulation.ttcn, line 214 */ if(tmp_25 == IuUP__Em__State::ST__DATA__TRANSFER__READY) goto tmp_24_1; goto tmp_24_end; tmp_24_0: { current_location.update_lineno(196); /* IuUP_Emulation.ttcn, line 196 */ if (const_cast< const IuUP__Entity&>(st).cfg().active__init()) { current_location.update_lineno(197); /* IuUP_Emulation.ttcn, line 197 */ { boolean tmp_29; { boolean tmp_26 = st.is_bound(); if(tmp_26) { const OPTIONAL< IuUP__Types::IuUP__PDU >& tmp_27 = st.pending__tx__pdu(); switch (tmp_27.get_selection()) { case OPTIONAL_UNBOUND: tmp_26 = FALSE; break; case OPTIONAL_OMIT: tmp_26 = FALSE; break; default: { const IuUP__Types::IuUP__PDU& tmp_28 = (const IuUP__Types::IuUP__PDU&) tmp_27; tmp_26 = tmp_28.is_value(); break;} } } tmp_29 = (!(tmp_26)); } if (tmp_29) { current_location.update_lineno(199); /* IuUP_Emulation.ttcn, line 199 */ pdu = f__ts__IuUP__INIT(st); current_location.update_lineno(200); /* IuUP_Emulation.ttcn, line 200 */ st.pending__tx__pdu() = pdu; } } } else { current_location.update_lineno(205); /* IuUP_Emulation.ttcn, line 205 */ { boolean tmp_35; { boolean tmp_32 = st.is_bound(); if(tmp_32) { const OPTIONAL< IuUP__Types::IuUP__PDU >& tmp_33 = st.pending__tx__pdu(); switch (tmp_33.get_selection()) { case OPTIONAL_UNBOUND: tmp_32 = FALSE; break; case OPTIONAL_OMIT: tmp_32 = FALSE; break; default: { const IuUP__Types::IuUP__PDU& tmp_34 = (const IuUP__Types::IuUP__PDU&) tmp_33; tmp_32 = tmp_34.is_value(); break;} } } tmp_35 = tmp_32; } if (tmp_35) { current_location.update_lineno(208); /* IuUP_Emulation.ttcn, line 208 */ pdu = const_cast< const IuUP__Entity&>(st).pending__tx__pdu(); current_location.update_lineno(209); /* IuUP_Emulation.ttcn, line 209 */ st.pending__tx__pdu() = OMIT_VALUE; current_location.update_lineno(210); /* IuUP_Emulation.ttcn, line 210 */ st.state() = IuUP__Em__State::ST__DATA__TRANSFER__READY; } } } goto tmp_24_end; } tmp_24_1: { current_location.update_lineno(215); /* IuUP_Emulation.ttcn, line 215 */ if (const_cast< const IuUP__Entity&>(st).cfg().data__pdu__type__0()) { current_location.update_lineno(216); /* IuUP_Emulation.ttcn, line 216 */ pdu = IuUP__Types::ts__IuUP__Type0(const_cast< const IuUP__Entity&>(st).tx__next__frame__nr(), 0, payload, IuUP__Types::ts__IuUP__Type0_fqc_defval).valueof(); } else { current_location.update_lineno(218); /* IuUP_Emulation.ttcn, line 218 */ pdu = IuUP__Types::ts__IuUP__Type1(const_cast< const IuUP__Entity&>(st).tx__next__frame__nr(), 0, payload, IuUP__Types::ts__IuUP__Type1_fqc_defval).valueof(); } current_location.update_lineno(220); /* IuUP_Emulation.ttcn, line 220 */ { INTEGER tmp_41; tmp_41 = mod((const_cast< const IuUP__Entity&>(st).tx__next__frame__nr() + 1), 16); st.tx__next__frame__nr() = tmp_41; } goto tmp_24_end; } tmp_24_end: /* empty */; } current_location.update_lineno(223); /* IuUP_Emulation.ttcn, line 223 */ if (pdu.is_value()) { current_location.update_lineno(224); /* IuUP_Emulation.ttcn, line 224 */ return IuUP__Types::f__enc__IuUP__PDU(pdu); } else { current_location.update_lineno(226); /* IuUP_Emulation.ttcn, line 226 */ return os_0; } } /* Bodies of static functions */ void pre_init_module() { TTCN_Location current_location("IuUP_Emulation.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "IuUP_Emulation"); IuUP__Types::module_object.pre_init_module(); current_location.update_lineno(42); /* IuUP_Emulation.ttcn, line 42 */ const_c__IuUP__Config__RabFlowCombination__def.set_size(3); { IuUP__RabFlowCombination& tmp_3 = const_c__IuUP__Config__RabFlowCombination__def[0]; tmp_3.rfci() = 0; { IuUP__Types::RecOfU8& tmp_4 = tmp_3.sub__flow__bits(); tmp_4.set_size(3); tmp_4[0] = 81; tmp_4[1] = 103; tmp_4[2] = 60; } tmp_3.ipti() = 1; } { IuUP__RabFlowCombination& tmp_5 = const_c__IuUP__Config__RabFlowCombination__def[1]; tmp_5.rfci() = 1; { IuUP__Types::RecOfU8& tmp_6 = tmp_5.sub__flow__bits(); tmp_6.set_size(3); tmp_6[0] = 39; tmp_6[1] = 0; tmp_6[2] = 0; } tmp_5.ipti() = 7; } { IuUP__RabFlowCombination& tmp_7 = const_c__IuUP__Config__RabFlowCombination__def[2]; tmp_7.rfci() = 2; { IuUP__Types::RecOfU8& tmp_8 = tmp_7.sub__flow__bits(); tmp_8.set_size(3); tmp_8[0] = 0; tmp_8[1] = 0; tmp_8[2] = 0; } tmp_7.ipti() = 1; } current_location.update_lineno(74); /* IuUP_Emulation.ttcn, line 74 */ const_c__IuUP__Config__def.active__init() = TRUE; const_c__IuUP__Config__def.data__pdu__type__0() = TRUE; const_c__IuUP__Config__def.rab__flow__combs() = c__IuUP__Config__RabFlowCombination__def; module_object.add_function("f_IuUP_Em_rx_decaps", (genericfunc_t)&f__IuUP__Em__rx__decaps, NULL); module_object.add_function("f_ts_IuUP_INIT", (genericfunc_t)&f__ts__IuUP__INIT, NULL); module_object.add_function("f_IuUP_Em_tx_encap", (genericfunc_t)&f__IuUP__Em__tx__encap, NULL); } void post_init_module() { TTCN_Location current_location("IuUP_Emulation.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "IuUP_Emulation"); IuUP__Types::module_object.post_init_module(); current_location.update_lineno(65); /* IuUP_Emulation.ttcn, line 65 */ const_t__IuUP__Config_active__init_defval = TRUE; current_location.update_lineno(66); /* IuUP_Emulation.ttcn, line 66 */ const_t__IuUP__Config_data__pdu__type__0_defval = TRUE; current_location.update_lineno(68); /* IuUP_Emulation.ttcn, line 68 */ template_t__IuUP__Config_rab__flow__combs_defval = c__IuUP__Config__RabFlowCombination__def; } } /* end of namespace */