-///////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2000-2014 Ericsson Telecom AB
-// All rights reserved. This program and the accompanying materials
-// are made available under the terms of the Eclipse Public License v1.0
-// which accompanies this distribution, and is available at
-// http://www.eclipse.org/legal/epl-v10.html
-///////////////////////////////////////////////////////////////////////////////
+/******************************************************************************
+ * Copyright (c) 2000-2016 Ericsson Telecom AB
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Balasko, Jeno
+ * Baranyi, Botond
+ * Beres, Szabolcs
+ * Delic, Adam
+ * Forstner, Matyas
+ * Kovacs, Ferenc
+ * Raduly, Csaba
+ * Szabados, Kristof
+ * Szabo, Bence Janos
+ * Szabo, Janos Zoltan – initial implementation
+ * Szalai, Gabor
+ *
+ ******************************************************************************/
#include <string.h>
#include "Error.hh"
static const ASN_Tag_t EMBEDDED_PDV_identification_tag_[] = { { ASN_TAG_CONT, 0u }};
static const ASN_BERdescriptor_t EMBEDDED_PDV_identification_ber_ = { 1u, EMBEDDED_PDV_identification_tag_ };
-static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_descr_ = { "EMBEDDED PDV.identification", &EMBEDDED_PDV_identification_ber_, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
+static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_descr_ = { "EMBEDDED PDV.identification", &EMBEDDED_PDV_identification_ber_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
static const ASN_Tag_t EMBEDDED_PDV_identification_syntaxes_abstract_tag_[] = { { ASN_TAG_CONT, 0u }};
static const ASN_BERdescriptor_t EMBEDDED_PDV_identification_syntaxes_abstract_ber_ = { 1u, EMBEDDED_PDV_identification_syntaxes_abstract_tag_ };
-static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_syntaxes_abstract_descr_ = { "EMBEDDED PDV.identification.syntaxes.abstract", &EMBEDDED_PDV_identification_syntaxes_abstract_ber_, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::OBJID };
+static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_syntaxes_abstract_descr_ = { "EMBEDDED PDV.identification.syntaxes.abstract", &EMBEDDED_PDV_identification_syntaxes_abstract_ber_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::OBJID };
static const ASN_Tag_t EMBEDDED_PDV_identification_syntaxes_transfer_tag_[] = { { ASN_TAG_CONT, 1u }};
static const ASN_BERdescriptor_t EMBEDDED_PDV_identification_syntaxes_transfer_ber_ = { 1u, EMBEDDED_PDV_identification_syntaxes_transfer_tag_ };
-static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_syntaxes_transfer_descr_ = { "EMBEDDED PDV.identification.syntaxes.transfer", &EMBEDDED_PDV_identification_syntaxes_transfer_ber_, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::OBJID };
+static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_syntaxes_transfer_descr_ = { "EMBEDDED PDV.identification.syntaxes.transfer", &EMBEDDED_PDV_identification_syntaxes_transfer_ber_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::OBJID };
static const ASN_Tag_t EMBEDDED_PDV_identification_syntaxes_tag_[] = { { ASN_TAG_CONT, 0u }};
static const ASN_BERdescriptor_t EMBEDDED_PDV_identification_syntaxes_ber_ = { 1u, EMBEDDED_PDV_identification_syntaxes_tag_ };
-static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_syntaxes_descr_ = { "EMBEDDED PDV.identification.syntaxes", &EMBEDDED_PDV_identification_syntaxes_ber_, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
+static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_syntaxes_descr_ = { "EMBEDDED PDV.identification.syntaxes", &EMBEDDED_PDV_identification_syntaxes_ber_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
static const ASN_Tag_t EMBEDDED_PDV_identification_syntax_tag_[] = { { ASN_TAG_CONT, 1u }};
static const ASN_BERdescriptor_t EMBEDDED_PDV_identification_syntax_ber_ = { 1u, EMBEDDED_PDV_identification_syntax_tag_ };
-static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_syntax_descr_ = { "EMBEDDED PDV.identification.syntax", &EMBEDDED_PDV_identification_syntax_ber_, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::OBJID };
+static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_syntax_descr_ = { "EMBEDDED PDV.identification.syntax", &EMBEDDED_PDV_identification_syntax_ber_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::OBJID };
static const ASN_Tag_t EMBEDDED_PDV_identification_presentation__context__id_tag_[] = { { ASN_TAG_CONT, 2u }};
static const ASN_BERdescriptor_t EMBEDDED_PDV_identification_presentation__context__id_ber_ = { 1u, EMBEDDED_PDV_identification_presentation__context__id_tag_ };
-static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_presentation__context__id_descr_ = { "EMBEDDED PDV.identification.presentation-context-id", &EMBEDDED_PDV_identification_presentation__context__id_ber_, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
+static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_presentation__context__id_descr_ = { "EMBEDDED PDV.identification.presentation-context-id", &EMBEDDED_PDV_identification_presentation__context__id_ber_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
static const ASN_Tag_t EMBEDDED_PDV_identification_context__negotiation_presentation__context__id_tag_[] = { { ASN_TAG_CONT, 0u }};
static const ASN_BERdescriptor_t EMBEDDED_PDV_identification_context__negotiation_presentation__context__id_ber_ = { 1u, EMBEDDED_PDV_identification_context__negotiation_presentation__context__id_tag_ };
-static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_context__negotiation_presentation__context__id_descr_ = { "EMBEDDED PDV.identification.context-negotiation.presentation-context-id", &EMBEDDED_PDV_identification_context__negotiation_presentation__context__id_ber_, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
+static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_context__negotiation_presentation__context__id_descr_ = { "EMBEDDED PDV.identification.context-negotiation.presentation-context-id", &EMBEDDED_PDV_identification_context__negotiation_presentation__context__id_ber_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
static const ASN_Tag_t EMBEDDED_PDV_identification_context__negotiation_transfer__syntax_tag_[] = { { ASN_TAG_CONT, 1u }};
static const ASN_BERdescriptor_t EMBEDDED_PDV_identification_context__negotiation_transfer__syntax_ber_ = { 1u, EMBEDDED_PDV_identification_context__negotiation_transfer__syntax_tag_ };
-static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_context__negotiation_transfer__syntax_descr_ = { "EMBEDDED PDV.identification.context-negotiation.transfer-syntax", &EMBEDDED_PDV_identification_context__negotiation_transfer__syntax_ber_, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::OBJID };
+static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_context__negotiation_transfer__syntax_descr_ = { "EMBEDDED PDV.identification.context-negotiation.transfer-syntax", &EMBEDDED_PDV_identification_context__negotiation_transfer__syntax_ber_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::OBJID };
static const ASN_Tag_t EMBEDDED_PDV_identification_context__negotiation_tag_[] = { { ASN_TAG_CONT, 3u }};
static const ASN_BERdescriptor_t EMBEDDED_PDV_identification_context__negotiation_ber_ = { 1u, EMBEDDED_PDV_identification_context__negotiation_tag_ };
-static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_context__negotiation_descr_ = { "EMBEDDED PDV.identification.context-negotiation", &EMBEDDED_PDV_identification_context__negotiation_ber_, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
+static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_context__negotiation_descr_ = { "EMBEDDED PDV.identification.context-negotiation", &EMBEDDED_PDV_identification_context__negotiation_ber_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
static const ASN_Tag_t EMBEDDED_PDV_identification_transfer__syntax_tag_[] = { { ASN_TAG_CONT, 4u }};
static const ASN_BERdescriptor_t EMBEDDED_PDV_identification_transfer__syntax_ber_ = { 1u, EMBEDDED_PDV_identification_transfer__syntax_tag_ };
-static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_transfer__syntax_descr_ = { "EMBEDDED PDV.identification.transfer-syntax", &EMBEDDED_PDV_identification_transfer__syntax_ber_, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::OBJID };
+static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_transfer__syntax_descr_ = { "EMBEDDED PDV.identification.transfer-syntax", &EMBEDDED_PDV_identification_transfer__syntax_ber_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::OBJID };
static const ASN_Tag_t EMBEDDED_PDV_identification_fixed_tag_[] = { { ASN_TAG_CONT, 5u }};
static const ASN_BERdescriptor_t EMBEDDED_PDV_identification_fixed_ber_ = { 1u, EMBEDDED_PDV_identification_fixed_tag_ };
-static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_fixed_descr_ = { "EMBEDDED PDV.identification.fixed", &EMBEDDED_PDV_identification_fixed_ber_, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
+static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_fixed_descr_ = { "EMBEDDED PDV.identification.fixed", &EMBEDDED_PDV_identification_fixed_ber_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
static const ASN_Tag_t EMBEDDED_PDV_data__value_tag_[] = { { ASN_TAG_CONT, 2u }};
static const ASN_BERdescriptor_t EMBEDDED_PDV_data__value_ber_ = { 1u, EMBEDDED_PDV_data__value_tag_ };
-static const TTCN_Typedescriptor_t EMBEDDED_PDV_data__value_descr_ = { "EMBEDDED PDV.data-value", &EMBEDDED_PDV_data__value_ber_, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
+static const TTCN_Typedescriptor_t EMBEDDED_PDV_data__value_descr_ = { "EMBEDDED PDV.data-value", &EMBEDDED_PDV_data__value_ber_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
static const ASN_Tag_t EMBEDDED_PDV_data__value__descriptor_tag_[] = { { ASN_TAG_CONT, 1u }};
static const ASN_BERdescriptor_t EMBEDDED_PDV_data__value__descriptor_ber_ = { 1u, EMBEDDED_PDV_data__value__descriptor_tag_ };
-static const TTCN_Typedescriptor_t EMBEDDED_PDV_data__value__descriptor_descr_ = { "EMBEDDED PDV.data-value-descriptor", &EMBEDDED_PDV_data__value__descriptor_ber_, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::GRAPHICSTRING };
+static const TTCN_Typedescriptor_t EMBEDDED_PDV_data__value__descriptor_descr_ = { "EMBEDDED PDV.data-value-descriptor", &EMBEDDED_PDV_data__value__descriptor_ber_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::GRAPHICSTRING };
/******************** EMBEDDED_PDV_identification ********************/
void EMBEDDED_PDV_identification::set_param(Module_Param& param)
{
param.basic_check(Module_Param::BC_VALUE, "union value");
- if (param.get_type()==Module_Param::MP_Value_List && param.get_size()==0) return;
- if (param.get_type()!=Module_Param::MP_Assignment_List) {
+ Module_Param_Ptr mp = ¶m;
+ if (param.get_type() == Module_Param::MP_Reference) {
+ mp = param.get_referenced_param();
+ }
+ if (mp->get_type()==Module_Param::MP_Value_List && mp->get_size()==0) return;
+ if (mp->get_type()!=Module_Param::MP_Assignment_List) {
param.error("union value with field name was expected");
}
- Module_Param* mp_last = param.get_elem(param.get_size()-1);
+ Module_Param* mp_last = mp->get_elem(mp->get_size()-1);
if (!strcmp(mp_last->get_id()->get_name(), "syntaxes")) {
syntaxes().set_param(*mp_last);
return;
mp_last->error("Field %s does not exist in type EMBEDDED PDV.identification.", mp_last->get_id()->get_name());
}
+Module_Param* EMBEDDED_PDV_identification::get_param(Module_Param_Name& param_name) const
+{
+ if (!is_bound()) {
+ return new Module_Param_Unbound();
+ }
+ Module_Param* mp_field = NULL;
+ switch(get_selection()) {
+ case ALT_syntaxes:
+ mp_field = field_syntaxes->get_param(param_name);
+ mp_field->set_id(new Module_Param_FieldName(mcopystr("syntaxes")));
+ break;
+ case ALT_syntax:
+ mp_field = field_syntax->get_param(param_name);
+ mp_field->set_id(new Module_Param_FieldName(mcopystr("syntax")));
+ break;
+ case ALT_presentation__context__id:
+ mp_field = field_presentation__context__id->get_param(param_name);
+ mp_field->set_id(new Module_Param_FieldName(mcopystr("presentation_context_id")));
+ break;
+ case ALT_context__negotiation:
+ mp_field = field_context__negotiation->get_param(param_name);
+ mp_field->set_id(new Module_Param_FieldName(mcopystr("context_negotiation")));
+ break;
+ case ALT_transfer__syntax:
+ mp_field = field_transfer__syntax->get_param(param_name);
+ mp_field->set_id(new Module_Param_FieldName(mcopystr("transfer_syntax")));
+ break;
+ case ALT_fixed:
+ mp_field = field_fixed->get_param(param_name);
+ mp_field->set_id(new Module_Param_FieldName(mcopystr("fixed")));
+ break;
+ default:
+ break;
+ }
+ Module_Param_Assignment_List* mp = new Module_Param_Assignment_List();
+ mp->add_elem(mp_field);
+ return mp;
+}
+
void EMBEDDED_PDV_identification_template::set_param(Module_Param& param)
{
param.basic_check(Module_Param::BC_TEMPLATE, "union template");
- switch (param.get_type()) {
+ Module_Param_Ptr mp = ¶m;
+ if (param.get_type() == Module_Param::MP_Reference) {
+ mp = param.get_referenced_param();
+ }
+ switch (mp->get_type()) {
case Module_Param::MP_Omit:
*this = OMIT_VALUE;
break;
*this = ANY_OR_OMIT;
break;
case Module_Param::MP_List_Template:
- case Module_Param::MP_ComplementList_Template:
- set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : COMPLEMENTED_LIST, param.get_size());
- for (size_t p_i=0; p_i<param.get_size(); p_i++) {
- list_item(p_i).set_param(*param.get_elem(p_i));
+ case Module_Param::MP_ComplementList_Template: {
+ EMBEDDED_PDV_identification_template temp;
+ temp.set_type(mp->get_type() == Module_Param::MP_List_Template ?
+ VALUE_LIST : COMPLEMENTED_LIST, mp->get_size());
+ for (size_t i=0; i<mp->get_size(); i++) {
+ temp.list_item(i).set_param(*mp->get_elem(i));
}
- break;
+ *this = temp;
+ break; }
case Module_Param::MP_Value_List:
- if (param.get_size()==0) break;
+ if (mp->get_size()==0) break;
param.type_error("union template", "EMBEDDED PDV.identification");
break;
case Module_Param::MP_Assignment_List: {
- Module_Param* mp_last = param.get_elem(param.get_size()-1);
+ Module_Param* mp_last = mp->get_elem(mp->get_size()-1);
if (!strcmp(mp_last->get_id()->get_name(), "syntaxes")) {
syntaxes().set_param(*mp_last);
break;
default:
param.type_error("union template", "EMBEDDED PDV.identification");
}
- is_ifpresent = param.get_ifpresent();
+ is_ifpresent = param.get_ifpresent() || mp->get_ifpresent();
+}
+
+Module_Param* EMBEDDED_PDV_identification_template::get_param(Module_Param_Name& param_name) const
+{
+ Module_Param* mp = NULL;
+ switch (template_selection) {
+ case UNINITIALIZED_TEMPLATE:
+ mp = new Module_Param_Unbound();
+ break;
+ case OMIT_VALUE:
+ mp = new Module_Param_Omit();
+ break;
+ case ANY_VALUE:
+ mp = new Module_Param_Any();
+ break;
+ case ANY_OR_OMIT:
+ mp = new Module_Param_AnyOrNone();
+ break;
+ case SPECIFIC_VALUE: {
+ Module_Param* mp_field = NULL;
+ switch(single_value.union_selection) {
+ case EMBEDDED_PDV_identification::ALT_syntaxes:
+ mp_field = single_value.field_syntaxes->get_param(param_name);
+ mp_field->set_id(new Module_Param_FieldName(mcopystr("syntaxes")));
+ break;
+ case EMBEDDED_PDV_identification::ALT_syntax:
+ mp_field = single_value.field_syntax->get_param(param_name);
+ mp_field->set_id(new Module_Param_FieldName(mcopystr("syntax")));
+ break;
+ case EMBEDDED_PDV_identification::ALT_presentation__context__id:
+ mp_field = single_value.field_presentation__context__id->get_param(param_name);
+ mp_field->set_id(new Module_Param_FieldName(mcopystr("presentation_context_id")));
+ break;
+ case EMBEDDED_PDV_identification::ALT_context__negotiation:
+ mp_field = single_value.field_context__negotiation->get_param(param_name);
+ mp_field->set_id(new Module_Param_FieldName(mcopystr("context_negotiation")));
+ break;
+ case EMBEDDED_PDV_identification::ALT_transfer__syntax:
+ mp_field = single_value.field_transfer__syntax->get_param(param_name);
+ mp_field->set_id(new Module_Param_FieldName(mcopystr("transfer_syntax")));
+ break;
+ case EMBEDDED_PDV_identification::ALT_fixed:
+ mp_field = single_value.field_fixed->get_param(param_name);
+ mp_field->set_id(new Module_Param_FieldName(mcopystr("fixed")));
+ break;
+ default:
+ break;
+ }
+ mp = new Module_Param_Assignment_List();
+ mp->add_elem(mp_field);
+ break; }
+ case VALUE_LIST:
+ case COMPLEMENTED_LIST: {
+ if (template_selection == VALUE_LIST) {
+ mp = new Module_Param_List_Template();
+ }
+ else {
+ mp = new Module_Param_ComplementList_Template();
+ }
+ for (size_t i = 0; i < value_list.n_values; ++i) {
+ mp->add_elem(value_list.list_value[i].get_param(param_name));
+ }
+ break; }
+ default:
+ break;
+ }
+ if (is_ifpresent) {
+ mp->set_ifpresent();
+ }
+ return mp;
}
void EMBEDDED_PDV_identification::encode_text(Text_Buf& text_buf) const
// FIXME maybe: XER_encode and decode is virtually identical to CHARACTER_STRING
int EMBEDDED_PDV_identification::XER_encode(const XERdescriptor_t& p_td,
- TTCN_Buffer& p_buf, unsigned int flavor, int indent) const
+ TTCN_Buffer& p_buf, unsigned int flavor, int indent, embed_values_enc_struct_t*) const
{
int indenting = !is_canonical(flavor);
int exer = is_exer(flavor);
++indent;
switch (union_selection) {
case ALT_syntaxes:
- field_syntaxes->XER_encode(EMBEDDED_PDV_identification_sxs_xer_, p_buf, flavor, indent);;
+ field_syntaxes->XER_encode(EMBEDDED_PDV_identification_sxs_xer_, p_buf, flavor, indent, 0);;
break;
case ALT_syntax:
- field_syntax->XER_encode(EMBEDDED_PDV_identification_sx_xer_, p_buf, flavor, indent);;
+ field_syntax->XER_encode(EMBEDDED_PDV_identification_sx_xer_, p_buf, flavor, indent, 0);;
break;
case ALT_presentation__context__id:
- field_presentation__context__id->XER_encode(EMBEDDED_PDV_identification_pci_xer_, p_buf, flavor, indent);;
+ field_presentation__context__id->XER_encode(EMBEDDED_PDV_identification_pci_xer_, p_buf, flavor, indent, 0);;
break;
case ALT_context__negotiation:
- field_context__negotiation->XER_encode(EMBEDDED_PDV_identification_cn_xer_, p_buf, flavor, indent);;
+ field_context__negotiation->XER_encode(EMBEDDED_PDV_identification_cn_xer_, p_buf, flavor, indent, 0);;
break;
case ALT_transfer__syntax:
- field_transfer__syntax->XER_encode(EMBEDDED_PDV_identification_ts_xer_, p_buf, flavor, indent);;
+ field_transfer__syntax->XER_encode(EMBEDDED_PDV_identification_ts_xer_, p_buf, flavor, indent, 0);;
break;
case ALT_fixed:
- field_fixed->XER_encode(EMBEDDED_PDV_identification_fix_xer_, p_buf, flavor, indent);;
+ field_fixed->XER_encode(EMBEDDED_PDV_identification_fix_xer_, p_buf, flavor, indent, 0);;
break;
default:
TTCN_EncDec_ErrorContext::error_internal("Unknown selection.");
}
int EMBEDDED_PDV_identification::XER_decode(const XERdescriptor_t& p_td,
- XmlReaderWrap& reader, unsigned int flavor)
+ XmlReaderWrap& reader, unsigned int flavor, unsigned int flavor2, embed_values_dec_struct_t*)
{
int exer = is_exer(flavor);
// we are supposed to be parked on our element
size_t namelen = strlen(name);
switch (namelen) {
case 8: // syntaxes
- syntaxes().XER_decode(EMBEDDED_PDV_identification_sxs_xer_, reader, flavor);
+ syntaxes().XER_decode(EMBEDDED_PDV_identification_sxs_xer_, reader, flavor, flavor2, 0);
break;
case 6: // syntax
- syntax().XER_decode(EMBEDDED_PDV_identification_sx_xer_, reader, flavor);
+ syntax().XER_decode(EMBEDDED_PDV_identification_sx_xer_, reader, flavor, flavor2, 0);
break;
case 23: // presentation-context-id
- presentation__context__id().XER_decode(EMBEDDED_PDV_identification_pci_xer_, reader, flavor);
+ presentation__context__id().XER_decode(EMBEDDED_PDV_identification_pci_xer_, reader, flavor, flavor2, 0);
break;
case 19: // context-negotiation
- context__negotiation().XER_decode(EMBEDDED_PDV_identification_cn_xer_, reader, flavor);
+ context__negotiation().XER_decode(EMBEDDED_PDV_identification_cn_xer_, reader, flavor, flavor2, 0);
break;
case 15: // transfer-syntax
- transfer__syntax().XER_decode(EMBEDDED_PDV_identification_ts_xer_, reader, flavor);
+ transfer__syntax().XER_decode(EMBEDDED_PDV_identification_ts_xer_, reader, flavor, flavor2, 0);
break;
case 5: // fixed
- fixed().XER_decode(EMBEDDED_PDV_identification_fix_xer_, reader, flavor);
+ fixed().XER_decode(EMBEDDED_PDV_identification_fix_xer_, reader, flavor, flavor2, 0);
break;
default:
return *this;
}
-boolean EMBEDDED_PDV_identification_template::match(const EMBEDDED_PDV_identification& other_value) const
+boolean EMBEDDED_PDV_identification_template::match(const EMBEDDED_PDV_identification& other_value,
+ boolean /* legacy */) const
{
switch (template_selection) {
case ANY_VALUE:
log_ifpresent();
}
-void EMBEDDED_PDV_identification_template::log_match(const EMBEDDED_PDV_identification& match_value) const
+void EMBEDDED_PDV_identification_template::log_match(const EMBEDDED_PDV_identification& match_value,
+ boolean /* legacy */) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
if(match(match_value)){
}
}
-boolean EMBEDDED_PDV_identification_template::is_present() const
+boolean EMBEDDED_PDV_identification_template::is_present(boolean legacy /* = FALSE */) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
- return !match_omit();
+ return !match_omit(legacy);
}
-boolean EMBEDDED_PDV_identification_template::match_omit() const
+boolean EMBEDDED_PDV_identification_template::match_omit(boolean legacy /* = FALSE */) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
- for (unsigned int i=0; i<value_list.n_values; i++)
- if (value_list.list_value[i].match_omit())
- return template_selection==VALUE_LIST;
- return template_selection==COMPLEMENTED_LIST;
+ if (legacy) {
+ for (unsigned int i=0; i<value_list.n_values; i++)
+ if (value_list.list_value[i].match_omit())
+ return template_selection==VALUE_LIST;
+ return template_selection==COMPLEMENTED_LIST;
+ } // else fall through
default:
return FALSE;
}
}
#ifndef TITAN_RUNTIME_2
-void EMBEDDED_PDV_identification_template::check_restriction(template_res t_res, const char* t_name) const
+void EMBEDDED_PDV_identification_template::check_restriction(template_res t_res, const char* t_name,
+ boolean legacy /* = FALSE */) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
template_selection==SPECIFIC_VALUE)) return;
break;
case TR_PRESENT:
- if (!match_omit()) return;
+ if (!match_omit(legacy)) return;
break;
default:
return;
void EMBEDDED_PDV_identification_syntaxes::set_param(Module_Param& param)
{
param.basic_check(Module_Param::BC_VALUE, "record value");
- switch (param.get_type()) {
+ Module_Param_Ptr mp = ¶m;
+ if (param.get_type() == Module_Param::MP_Reference) {
+ mp = param.get_referenced_param();
+ }
+ switch (mp->get_type()) {
case Module_Param::MP_Value_List:
- if (param.get_size()==0) return;
- if (2!=param.get_size()) {
- param.error("record value of type EMBEDDED PDV.identification.syntaxes has 2 fields but list value has %d fields", (int)param.get_size());
+ if (mp->get_size()==0) return;
+ if (2!=mp->get_size()) {
+ param.error("record value of type EMBEDDED PDV.identification.syntaxes has 2 fields but list value has %d fields", (int)mp->get_size());
}
- if (param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) abstract().set_param(*param.get_elem(0));
- if (param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) transfer().set_param(*param.get_elem(1));
+ if (mp->get_elem(0)->get_type()!=Module_Param::MP_NotUsed) abstract().set_param(*mp->get_elem(0));
+ if (mp->get_elem(1)->get_type()!=Module_Param::MP_NotUsed) transfer().set_param(*mp->get_elem(1));
break;
case Module_Param::MP_Assignment_List: {
- Vector<bool> value_used(param.get_size());
- value_used.resize(param.get_size(), false);
- for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
- Module_Param* const curr_param = param.get_elem(val_idx);
+ Vector<bool> value_used(mp->get_size());
+ value_used.resize(mp->get_size(), false);
+ for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) {
+ Module_Param* const curr_param = mp->get_elem(val_idx);
if (!strcmp(curr_param->get_id()->get_name(), "abstract")) {
abstract().set_param(*curr_param);
value_used[val_idx]=true;
}
}
- for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
- Module_Param* const curr_param = param.get_elem(val_idx);
+ for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) {
+ Module_Param* const curr_param = mp->get_elem(val_idx);
if (!strcmp(curr_param->get_id()->get_name(), "transfer")) {
transfer().set_param(*curr_param);
value_used[val_idx]=true;
}
}
- for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
- param.get_elem(val_idx)->error("Non existent field name in type EMBEDDED PDV.identification.syntaxes: %s", param.get_elem(val_idx)->get_id()->get_name());
+ for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) if (!value_used[val_idx]) {
+ mp->get_elem(val_idx)->error("Non existent field name in type EMBEDDED PDV.identification.syntaxes: %s", mp->get_elem(val_idx)->get_id()->get_name());
break;
}
} break;
}
}
-void EMBEDDED_PDV_identification_syntaxes_template::set_param(Module_Param& param)
+Module_Param* EMBEDDED_PDV_identification_syntaxes::get_param(Module_Param_Name& param_name) const
{
- 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:
- set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : COMPLEMENTED_LIST, param.get_size());
- for (size_t p_i=0; p_i<param.get_size(); p_i++) {
- list_item(p_i).set_param(*param.get_elem(p_i));
- }
- break;
- case Module_Param::MP_Value_List:
- if (param.get_size()==0) break;
- if (2!=param.get_size()) {
- param.error("record template of type EMBEDDED PDV.identification.syntaxes has 2 fields but list value has %d fields", (int)param.get_size());
- }
- if (param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) abstract().set_param(*param.get_elem(0));
- if (param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) transfer().set_param(*param.get_elem(1));
- break;
- case Module_Param::MP_Assignment_List: {
- Vector<bool> value_used(param.get_size());
- value_used.resize(param.get_size(), false);
- for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
- Module_Param* const curr_param = param.get_elem(val_idx);
- if (!strcmp(curr_param->get_id()->get_name(), "abstract")) {
- abstract().set_param(*curr_param);
- value_used[val_idx]=true;
- }
- }
- for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
- Module_Param* const curr_param = param.get_elem(val_idx);
- if (!strcmp(curr_param->get_id()->get_name(), "transfer")) {
- transfer().set_param(*curr_param);
- value_used[val_idx]=true;
- }
- }
- for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
- param.get_elem(val_idx)->error("Non existent field name in type EMBEDDED PDV.identification.syntaxes: %s", param.get_elem(val_idx)->get_id()->get_name());
- break;
- }
- } break;
- default:
- param.type_error("record template", "EMBEDDED PDV.identification.syntaxes");
+ if (!is_bound()) {
+ return new Module_Param_Unbound();
}
- is_ifpresent = param.get_ifpresent();
+ Module_Param* mp_field_abstract = field_abstract.get_param(param_name);
+ mp_field_abstract->set_id(new Module_Param_FieldName(mcopystr("abstract")));
+ Module_Param* mp_field_transfer = field_transfer.get_param(param_name);
+ mp_field_transfer->set_id(new Module_Param_FieldName(mcopystr("transfer")));
+ Module_Param_Assignment_List* mp = new Module_Param_Assignment_List();
+ mp->add_elem(mp_field_abstract);
+ mp->add_elem(mp_field_transfer);
+ return mp;
}
void EMBEDDED_PDV_identification_syntaxes::encode_text(Text_Buf& text_buf) const
}
int EMBEDDED_PDV_identification_syntaxes::XER_encode(const XERdescriptor_t& p_td,
- TTCN_Buffer& p_buf, unsigned int flavor, int indent) const
+ TTCN_Buffer& p_buf, unsigned int flavor, int indent, embed_values_enc_struct_t*) const
{
int indenting = !is_canonical(flavor);
int exer = is_exer(flavor);
p_buf.put_s((size_t)p_td.namelens[exer] - 1 + indenting, (const unsigned char*)p_td.names[exer]);
++indent;
- field_abstract.XER_encode(EMBEDDED_PDV_identification_sxs_abs_xer_, p_buf, flavor, indent);
- field_transfer.XER_encode(EMBEDDED_PDV_identification_sxs_xfr_xer_, p_buf, flavor, indent);
+ field_abstract.XER_encode(EMBEDDED_PDV_identification_sxs_abs_xer_, p_buf, flavor, indent, 0);
+ field_transfer.XER_encode(EMBEDDED_PDV_identification_sxs_xfr_xer_, p_buf, flavor, indent, 0);
if (indenting) do_indent(p_buf, --indent);
p_buf.put_c('<');
}
int EMBEDDED_PDV_identification_syntaxes::XER_decode(const XERdescriptor_t& /*p_td*/,
- XmlReaderWrap& reader, unsigned int flavor)
+ XmlReaderWrap& reader, unsigned int flavor, unsigned int flavor2, embed_values_dec_struct_t*)
{ // we stand on <syntaxes>, move ahead first
int type;
for (int success = reader.Read(); success == 1; success = reader.Read())
break;
}
// FIXME this assumes the right element
- field_abstract.XER_decode(EMBEDDED_PDV_identification_sxs_abs_xer_, reader, flavor);
- field_transfer.XER_decode(EMBEDDED_PDV_identification_sxs_xfr_xer_, reader, flavor);
+ field_abstract.XER_decode(EMBEDDED_PDV_identification_sxs_abs_xer_, reader, flavor, flavor2, 0);
+ field_transfer.XER_decode(EMBEDDED_PDV_identification_sxs_xfr_xer_, reader, flavor, flavor2, 0);
for (int success = 1; success == 1; success = reader.Read())
{
type = reader.NodeType();
OBJID_template field_transfer;
};
+void EMBEDDED_PDV_identification_syntaxes_template::set_param(Module_Param& param)
+{
+ param.basic_check(Module_Param::BC_TEMPLATE, "record template");
+ Module_Param_Ptr mp = ¶m;
+ if (param.get_type() == Module_Param::MP_Reference) {
+ mp = param.get_referenced_param();
+ }
+ switch (mp->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: {
+ EMBEDDED_PDV_identification_syntaxes_template temp;
+ temp.set_type(mp->get_type() == Module_Param::MP_List_Template ?
+ VALUE_LIST : COMPLEMENTED_LIST, mp->get_size());
+ for (size_t i=0; i<mp->get_size(); i++) {
+ temp.list_item(i).set_param(*mp->get_elem(i));
+ }
+ *this = temp;
+ break; }
+ case Module_Param::MP_Value_List:
+ if (mp->get_size()==0) break;
+ if (2!=mp->get_size()) {
+ param.error("record template of type EMBEDDED PDV.identification.syntaxes has 2 fields but list value has %d fields", (int)mp->get_size());
+ }
+ if (mp->get_elem(0)->get_type()!=Module_Param::MP_NotUsed) abstract().set_param(*mp->get_elem(0));
+ if (mp->get_elem(1)->get_type()!=Module_Param::MP_NotUsed) transfer().set_param(*mp->get_elem(1));
+ break;
+ case Module_Param::MP_Assignment_List: {
+ Vector<bool> value_used(mp->get_size());
+ value_used.resize(mp->get_size(), false);
+ for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) {
+ Module_Param* const curr_param = mp->get_elem(val_idx);
+ if (!strcmp(curr_param->get_id()->get_name(), "abstract")) {
+ abstract().set_param(*curr_param);
+ value_used[val_idx]=true;
+ }
+ }
+ for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) {
+ Module_Param* const curr_param = mp->get_elem(val_idx);
+ if (!strcmp(curr_param->get_id()->get_name(), "transfer")) {
+ transfer().set_param(*curr_param);
+ value_used[val_idx]=true;
+ }
+ }
+ for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) if (!value_used[val_idx]) {
+ mp->get_elem(val_idx)->error("Non existent field name in type EMBEDDED PDV.identification.syntaxes: %s", mp->get_elem(val_idx)->get_id()->get_name());
+ break;
+ }
+ } break;
+ default:
+ param.type_error("record template", "EMBEDDED PDV.identification.syntaxes");
+ }
+ is_ifpresent = param.get_ifpresent() || mp->get_ifpresent();
+}
+
+Module_Param* EMBEDDED_PDV_identification_syntaxes_template::get_param(Module_Param_Name& param_name) const
+{
+ Module_Param* mp = NULL;
+ switch (template_selection) {
+ case UNINITIALIZED_TEMPLATE:
+ mp = new Module_Param_Unbound();
+ break;
+ case OMIT_VALUE:
+ mp = new Module_Param_Omit();
+ break;
+ case ANY_VALUE:
+ mp = new Module_Param_Any();
+ break;
+ case ANY_OR_OMIT:
+ mp = new Module_Param_AnyOrNone();
+ break;
+ case SPECIFIC_VALUE: {
+ Module_Param* mp_field_abstract = single_value->field_abstract.get_param(param_name);
+ mp_field_abstract->set_id(new Module_Param_FieldName(mcopystr("abstract")));
+ Module_Param* mp_field_transfer = single_value->field_transfer.get_param(param_name);
+ mp_field_transfer->set_id(new Module_Param_FieldName(mcopystr("transfer")));
+ mp = new Module_Param_Assignment_List();
+ mp->add_elem(mp_field_abstract);
+ mp->add_elem(mp_field_transfer);
+ break; }
+ case VALUE_LIST:
+ case COMPLEMENTED_LIST: {
+ if (template_selection == VALUE_LIST) {
+ mp = new Module_Param_List_Template();
+ }
+ else {
+ mp = new Module_Param_ComplementList_Template();
+ }
+ for (size_t i = 0; i < value_list.n_values; ++i) {
+ mp->add_elem(value_list.list_value[i].get_param(param_name));
+ }
+ break; }
+ default:
+ break;
+ }
+ if (is_ifpresent) {
+ mp->set_ifpresent();
+ }
+ return mp;
+}
+
void EMBEDDED_PDV_identification_syntaxes_template::clean_up()
{
switch (template_selection) {
return *this;
}
-boolean EMBEDDED_PDV_identification_syntaxes_template::match(const EMBEDDED_PDV_identification_syntaxes& other_value) const
+boolean EMBEDDED_PDV_identification_syntaxes_template::match(const EMBEDDED_PDV_identification_syntaxes& other_value,
+ boolean /* legacy */) const
{
switch (template_selection) {
case ANY_VALUE:
log_ifpresent();
}
-void EMBEDDED_PDV_identification_syntaxes_template::log_match(const EMBEDDED_PDV_identification_syntaxes& match_value) const
+void EMBEDDED_PDV_identification_syntaxes_template::log_match(const EMBEDDED_PDV_identification_syntaxes& match_value,
+ boolean /* legacy */) const
{
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ abstract := ");
}
}
-boolean EMBEDDED_PDV_identification_syntaxes_template::is_present() const
+boolean EMBEDDED_PDV_identification_syntaxes_template::is_present(boolean legacy /* = FALSE */) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
- return !match_omit();
+ return !match_omit(legacy);
}
-boolean EMBEDDED_PDV_identification_syntaxes_template::match_omit() const
+boolean EMBEDDED_PDV_identification_syntaxes_template::match_omit(boolean legacy /* = FALSE */) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
- for (unsigned int i=0; i<value_list.n_values; i++)
- if (value_list.list_value[i].match_omit())
- return template_selection==VALUE_LIST;
- return template_selection==COMPLEMENTED_LIST;
+ if (legacy) {
+ for (unsigned int i=0; i<value_list.n_values; i++)
+ if (value_list.list_value[i].match_omit())
+ return template_selection==VALUE_LIST;
+ return template_selection==COMPLEMENTED_LIST;
+ } // else fall through
default:
return FALSE;
}
}
#ifndef TITAN_RUNTIME_2
-void EMBEDDED_PDV_identification_syntaxes_template::check_restriction(template_res t_res, const char* t_name) const
+void EMBEDDED_PDV_identification_syntaxes_template::check_restriction(template_res t_res, const char* t_name,
+ boolean legacy /* = FALSE */) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
template_selection==SPECIFIC_VALUE)) return;
break;
case TR_PRESENT:
- if (!match_omit()) return;
+ if (!match_omit(legacy)) return;
break;
default:
return;
void EMBEDDED_PDV_identification_context__negotiation::set_param(Module_Param& param)
{
param.basic_check(Module_Param::BC_VALUE, "record value");
- switch (param.get_type()) {
+ Module_Param_Ptr mp = ¶m;
+ if (param.get_type() == Module_Param::MP_Reference) {
+ mp = param.get_referenced_param();
+ }
+ switch (mp->get_type()) {
case Module_Param::MP_Value_List:
- if (param.get_size()==0) return;
- if (2!=param.get_size()) {
- param.error("record value of type EMBEDDED PDV.identification.context-negotiation has 2 fields but list value has %d fields", (int)param.get_size());
+ if (mp->get_size()==0) return;
+ if (2!=mp->get_size()) {
+ param.error("record value of type EMBEDDED PDV.identification.context-negotiation has 2 fields but list value has %d fields", (int)mp->get_size());
}
- if (param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) presentation__context__id().set_param(*param.get_elem(0));
- if (param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) transfer__syntax().set_param(*param.get_elem(1));
+ if (mp->get_elem(0)->get_type()!=Module_Param::MP_NotUsed) presentation__context__id().set_param(*mp->get_elem(0));
+ if (mp->get_elem(1)->get_type()!=Module_Param::MP_NotUsed) transfer__syntax().set_param(*mp->get_elem(1));
break;
case Module_Param::MP_Assignment_List: {
- Vector<bool> value_used(param.get_size());
- value_used.resize(param.get_size(), false);
- for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
- Module_Param* const curr_param = param.get_elem(val_idx);
+ Vector<bool> value_used(mp->get_size());
+ value_used.resize(mp->get_size(), false);
+ for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) {
+ Module_Param* const curr_param = mp->get_elem(val_idx);
if (!strcmp(curr_param->get_id()->get_name(), "presentation_context_id")) {
presentation__context__id().set_param(*curr_param);
value_used[val_idx]=true;
}
}
- for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
- Module_Param* const curr_param = param.get_elem(val_idx);
+ for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) {
+ Module_Param* const curr_param = mp->get_elem(val_idx);
if (!strcmp(curr_param->get_id()->get_name(), "transfer_syntax")) {
transfer__syntax().set_param(*curr_param);
value_used[val_idx]=true;
}
}
- for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
- param.get_elem(val_idx)->error("Non existent field name in type EMBEDDED PDV.identification.context-negotiation: %s", param.get_elem(val_idx)->get_id()->get_name());
+ for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) if (!value_used[val_idx]) {
+ mp->get_elem(val_idx)->error("Non existent field name in type EMBEDDED PDV.identification.context-negotiation: %s", mp->get_elem(val_idx)->get_id()->get_name());
break;
}
} break;
}
}
-void EMBEDDED_PDV_identification_context__negotiation_template::set_param(Module_Param& param)
+Module_Param* EMBEDDED_PDV_identification_context__negotiation::get_param(Module_Param_Name& param_name) const
{
- 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:
- set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : COMPLEMENTED_LIST, param.get_size());
- for (size_t p_i=0; p_i<param.get_size(); p_i++) {
- list_item(p_i).set_param(*param.get_elem(p_i));
- }
- break;
- case Module_Param::MP_Value_List:
- if (param.get_size()==0) break;
- if (2!=param.get_size()) {
- param.error("record template of type EMBEDDED PDV.identification.context-negotiation has 2 fields but list value has %d fields", (int)param.get_size());
- }
- if (param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) presentation__context__id().set_param(*param.get_elem(0));
- if (param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) transfer__syntax().set_param(*param.get_elem(1));
- break;
- case Module_Param::MP_Assignment_List: {
- Vector<bool> value_used(param.get_size());
- value_used.resize(param.get_size(), false);
- for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
- Module_Param* const curr_param = param.get_elem(val_idx);
- if (!strcmp(curr_param->get_id()->get_name(), "presentation_context_id")) {
- presentation__context__id().set_param(*curr_param);
- value_used[val_idx]=true;
- }
- }
- for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
- Module_Param* const curr_param = param.get_elem(val_idx);
- if (!strcmp(curr_param->get_id()->get_name(), "transfer_syntax")) {
- transfer__syntax().set_param(*curr_param);
- value_used[val_idx]=true;
- }
- }
- for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
- param.get_elem(val_idx)->error("Non existent field name in type EMBEDDED PDV.identification.context-negotiation: %s", param.get_elem(val_idx)->get_id()->get_name());
- break;
- }
- } break;
- default:
- param.type_error("record template", "EMBEDDED PDV.identification.context-negotiation");
+ if (!is_bound()) {
+ return new Module_Param_Unbound();
}
- is_ifpresent = param.get_ifpresent();
+ Module_Param* mp_field_presentation_context_id = field_presentation__context__id.get_param(param_name);
+ mp_field_presentation_context_id->set_id(new Module_Param_FieldName(mcopystr("presentation_context_id")));
+ Module_Param* mp_field_transfer_syntax = field_transfer__syntax.get_param(param_name);
+ mp_field_transfer_syntax->set_id(new Module_Param_FieldName(mcopystr("transfer_syntax")));
+ Module_Param_Assignment_List* mp = new Module_Param_Assignment_List();
+ mp->add_elem(mp_field_presentation_context_id);
+ mp->add_elem(mp_field_transfer_syntax);
+ return mp;
}
void EMBEDDED_PDV_identification_context__negotiation::encode_text(Text_Buf& text_buf) const
}
int EMBEDDED_PDV_identification_context__negotiation::XER_encode(const XERdescriptor_t& p_td,
- TTCN_Buffer& p_buf, unsigned int flavor, int indent) const
+ TTCN_Buffer& p_buf, unsigned int flavor, int indent, embed_values_enc_struct_t*) const
{
int indenting = !is_canonical(flavor);
int exer = is_exer(flavor);
p_buf.put_s((size_t)p_td.namelens[exer] - 1 + indenting, (const unsigned char*)p_td.names[exer]);
++indent;
- field_presentation__context__id.XER_encode(EMBEDDED_PDV_identification_cn_pci_xer_, p_buf, flavor, indent);
- field_transfer__syntax .XER_encode(EMBEDDED_PDV_identification_cn_tsx_xer_, p_buf, flavor, indent);
+ field_presentation__context__id.XER_encode(EMBEDDED_PDV_identification_cn_pci_xer_, p_buf, flavor, indent, 0);
+ field_transfer__syntax .XER_encode(EMBEDDED_PDV_identification_cn_tsx_xer_, p_buf, flavor, indent, 0);
if (indenting) do_indent(p_buf, --indent);
p_buf.put_c('<');
}
int EMBEDDED_PDV_identification_context__negotiation::XER_decode(
- const XERdescriptor_t& p_td, XmlReaderWrap& reader, unsigned int flavor)
+ const XERdescriptor_t& p_td, XmlReaderWrap& reader, unsigned int flavor, unsigned int flavor2, embed_values_dec_struct_t*)
{
int exer = is_exer(flavor);
int type = reader.NodeType(), depth = -1;
depth = reader.Depth();
success = reader.Read();
}
- field_presentation__context__id.XER_decode(EMBEDDED_PDV_identification_cn_pci_xer_, reader, flavor);
- field_transfer__syntax .XER_decode(EMBEDDED_PDV_identification_cn_tsx_xer_, reader, flavor);
+ field_presentation__context__id.XER_decode(EMBEDDED_PDV_identification_cn_pci_xer_, reader, flavor, flavor2, 0);
+ field_transfer__syntax .XER_decode(EMBEDDED_PDV_identification_cn_tsx_xer_, reader, flavor, flavor2, 0);
for (; success == 1; success = reader.Read()) {
type = reader.NodeType();
if (XML_READER_TYPE_END_ELEMENT == type) {
OBJID_template field_transfer__syntax;
};
+void EMBEDDED_PDV_identification_context__negotiation_template::set_param(Module_Param& param)
+{
+ param.basic_check(Module_Param::BC_TEMPLATE, "record template");
+ Module_Param_Ptr mp = ¶m;
+ if (param.get_type() == Module_Param::MP_Reference) {
+ mp = param.get_referenced_param();
+ }
+ switch (mp->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: {
+ EMBEDDED_PDV_identification_context__negotiation_template temp;
+ temp.set_type(mp->get_type() == Module_Param::MP_List_Template ?
+ VALUE_LIST : COMPLEMENTED_LIST, mp->get_size());
+ for (size_t i=0; i<mp->get_size(); i++) {
+ temp.list_item(i).set_param(*mp->get_elem(i));
+ }
+ *this = temp;
+ break; }
+ case Module_Param::MP_Value_List:
+ if (mp->get_size()==0) break;
+ if (2!=mp->get_size()) {
+ param.error("record template of type EMBEDDED PDV.identification.context-negotiation has 2 fields but list value has %d fields", (int)mp->get_size());
+ }
+ if (mp->get_elem(0)->get_type()!=Module_Param::MP_NotUsed) presentation__context__id().set_param(*mp->get_elem(0));
+ if (mp->get_elem(1)->get_type()!=Module_Param::MP_NotUsed) transfer__syntax().set_param(*mp->get_elem(1));
+ break;
+ case Module_Param::MP_Assignment_List: {
+ Vector<bool> value_used(mp->get_size());
+ value_used.resize(mp->get_size(), false);
+ for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) {
+ Module_Param* const curr_param = mp->get_elem(val_idx);
+ if (!strcmp(curr_param->get_id()->get_name(), "presentation_context_id")) {
+ presentation__context__id().set_param(*curr_param);
+ value_used[val_idx]=true;
+ }
+ }
+ for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) {
+ Module_Param* const curr_param = mp->get_elem(val_idx);
+ if (!strcmp(curr_param->get_id()->get_name(), "transfer_syntax")) {
+ transfer__syntax().set_param(*curr_param);
+ value_used[val_idx]=true;
+ }
+ }
+ for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) if (!value_used[val_idx]) {
+ mp->get_elem(val_idx)->error("Non existent field name in type EMBEDDED PDV.identification.context-negotiation: %s", mp->get_elem(val_idx)->get_id()->get_name());
+ break;
+ }
+ } break;
+ default:
+ param.type_error("record template", "EMBEDDED PDV.identification.context-negotiation");
+ }
+ is_ifpresent = param.get_ifpresent() || mp->get_ifpresent();
+}
+
+Module_Param* EMBEDDED_PDV_identification_context__negotiation_template::get_param(Module_Param_Name& param_name) const
+{
+ Module_Param* mp = NULL;
+ switch (template_selection) {
+ case UNINITIALIZED_TEMPLATE:
+ mp = new Module_Param_Unbound();
+ break;
+ case OMIT_VALUE:
+ mp = new Module_Param_Omit();
+ break;
+ case ANY_VALUE:
+ mp = new Module_Param_Any();
+ break;
+ case ANY_OR_OMIT:
+ mp = new Module_Param_AnyOrNone();
+ break;
+ case SPECIFIC_VALUE: {
+ Module_Param* mp_field_presentation_context_id = single_value->field_presentation__context__id.get_param(param_name);
+ mp_field_presentation_context_id->set_id(new Module_Param_FieldName(mcopystr("presentation_context_id")));
+ Module_Param* mp_field_transfer_syntax = single_value->field_transfer__syntax.get_param(param_name);
+ mp_field_transfer_syntax->set_id(new Module_Param_FieldName(mcopystr("transfer_syntax")));
+ mp = new Module_Param_Assignment_List();
+ mp->add_elem(mp_field_presentation_context_id);
+ mp->add_elem(mp_field_transfer_syntax);
+ break; }
+ case VALUE_LIST:
+ case COMPLEMENTED_LIST: {
+ if (template_selection == VALUE_LIST) {
+ mp = new Module_Param_List_Template();
+ }
+ else {
+ mp = new Module_Param_ComplementList_Template();
+ }
+ for (size_t i = 0; i < value_list.n_values; ++i) {
+ mp->add_elem(value_list.list_value[i].get_param(param_name));
+ }
+ break; }
+ default:
+ break;
+ }
+ if (is_ifpresent) {
+ mp->set_ifpresent();
+ }
+ return mp;
+}
+
void EMBEDDED_PDV_identification_context__negotiation_template::clean_up()
{
switch (template_selection) {
return *this;
}
-boolean EMBEDDED_PDV_identification_context__negotiation_template::match(const EMBEDDED_PDV_identification_context__negotiation& other_value) const
+boolean EMBEDDED_PDV_identification_context__negotiation_template::match(const EMBEDDED_PDV_identification_context__negotiation& other_value,
+ boolean /* legacy */) const
{
switch (template_selection) {
case ANY_VALUE:
log_ifpresent();
}
-void EMBEDDED_PDV_identification_context__negotiation_template::log_match(const EMBEDDED_PDV_identification_context__negotiation& match_value) const
+void EMBEDDED_PDV_identification_context__negotiation_template::log_match(const EMBEDDED_PDV_identification_context__negotiation& match_value,
+ boolean /* legacy */) const
{
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ presentation_context_id := ");
}
}
-boolean EMBEDDED_PDV_identification_context__negotiation_template::is_present() const
+boolean EMBEDDED_PDV_identification_context__negotiation_template::is_present(boolean legacy /* = FALSE */) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
- return !match_omit();
+ return !match_omit(legacy);
}
-boolean EMBEDDED_PDV_identification_context__negotiation_template::match_omit() const
+boolean EMBEDDED_PDV_identification_context__negotiation_template::match_omit(boolean legacy /* = FALSE */) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
- for (unsigned int i=0; i<value_list.n_values; i++)
- if (value_list.list_value[i].match_omit())
- return template_selection==VALUE_LIST;
- return template_selection==COMPLEMENTED_LIST;
+ if (legacy) {
+ for (unsigned int i=0; i<value_list.n_values; i++)
+ if (value_list.list_value[i].match_omit())
+ return template_selection==VALUE_LIST;
+ return template_selection==COMPLEMENTED_LIST;
+ } // else fall through
default:
return FALSE;
}
}
#ifndef TITAN_RUNTIME_2
-void EMBEDDED_PDV_identification_context__negotiation_template::check_restriction(template_res t_res, const char* t_name) const
+void EMBEDDED_PDV_identification_context__negotiation_template::check_restriction(template_res t_res, const char* t_name,
+ boolean legacy /* = FALSE */) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
template_selection==SPECIFIC_VALUE)) return;
break;
case TR_PRESENT:
- if (!match_omit()) return;
+ if (!match_omit(legacy)) return;
break;
default:
return;
void EMBEDDED_PDV::set_param(Module_Param& param)
{
param.basic_check(Module_Param::BC_VALUE, "record value");
- switch (param.get_type()) {
+ Module_Param_Ptr mp = ¶m;
+ if (param.get_type() == Module_Param::MP_Reference) {
+ mp = param.get_referenced_param();
+ }
+ switch (mp->get_type()) {
case Module_Param::MP_Value_List:
- if (param.get_size()==0) return;
- if (3!=param.get_size()) {
- param.error("record value of type EMBEDDED PDV has 3 fields but list value has %d fields", (int)param.get_size());
+ if (mp->get_size()==0) return;
+ if (3!=mp->get_size()) {
+ param.error("record value of type EMBEDDED PDV has 3 fields but list value has %d fields", (int)mp->get_size());
}
- if (param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) identification().set_param(*param.get_elem(0));
- if (param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) data__value__descriptor().set_param(*param.get_elem(1));
- if (param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) data__value().set_param(*param.get_elem(2));
+ if (mp->get_elem(0)->get_type()!=Module_Param::MP_NotUsed) identification().set_param(*mp->get_elem(0));
+ if (mp->get_elem(1)->get_type()!=Module_Param::MP_NotUsed) data__value__descriptor().set_param(*mp->get_elem(1));
+ if (mp->get_elem(2)->get_type()!=Module_Param::MP_NotUsed) data__value().set_param(*mp->get_elem(2));
break;
case Module_Param::MP_Assignment_List: {
- Vector<bool> value_used(param.get_size());
- value_used.resize(param.get_size(), false);
- for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
- Module_Param* const curr_param = param.get_elem(val_idx);
+ Vector<bool> value_used(mp->get_size());
+ value_used.resize(mp->get_size(), false);
+ for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) {
+ Module_Param* const curr_param = mp->get_elem(val_idx);
if (!strcmp(curr_param->get_id()->get_name(), "identification")) {
identification().set_param(*curr_param);
value_used[val_idx]=true;
}
}
- for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
- Module_Param* const curr_param = param.get_elem(val_idx);
+ for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) {
+ Module_Param* const curr_param = mp->get_elem(val_idx);
if (!strcmp(curr_param->get_id()->get_name(), "data_value_descriptor")) {
data__value__descriptor().set_param(*curr_param);
value_used[val_idx]=true;
}
}
- for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
- Module_Param* const curr_param = param.get_elem(val_idx);
+ for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) {
+ Module_Param* const curr_param = mp->get_elem(val_idx);
if (!strcmp(curr_param->get_id()->get_name(), "data_value")) {
data__value().set_param(*curr_param);
value_used[val_idx]=true;
}
}
- for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
- param.get_elem(val_idx)->error("Non existent field name in type EMBEDDED PDV: %s", param.get_elem(val_idx)->get_id()->get_name());
+ for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) if (!value_used[val_idx]) {
+ mp->get_elem(val_idx)->error("Non existent field name in type EMBEDDED PDV: %s", mp->get_elem(val_idx)->get_id()->get_name());
break;
}
} break;
}
}
-void EMBEDDED_PDV_template::set_param(Module_Param& param)
+Module_Param* EMBEDDED_PDV::get_param(Module_Param_Name& param_name) const
{
- 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:
- set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : COMPLEMENTED_LIST, param.get_size());
- for (size_t p_i=0; p_i<param.get_size(); p_i++) {
- list_item(p_i).set_param(*param.get_elem(p_i));
- }
- break;
- case Module_Param::MP_Value_List:
- if (param.get_size()==0) break;
- if (3!=param.get_size()) {
- param.error("record template of type EMBEDDED PDV has 3 fields but list value has %d fields", (int)param.get_size());
- }
- if (param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) identification().set_param(*param.get_elem(0));
- if (param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) data__value__descriptor().set_param(*param.get_elem(1));
- if (param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) data__value().set_param(*param.get_elem(2));
- break;
- case Module_Param::MP_Assignment_List: {
- Vector<bool> value_used(param.get_size());
- value_used.resize(param.get_size(), false);
- for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
- Module_Param* const curr_param = param.get_elem(val_idx);
- if (!strcmp(curr_param->get_id()->get_name(), "identification")) {
- identification().set_param(*curr_param);
- value_used[val_idx]=true;
- }
- }
- for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
- Module_Param* const curr_param = param.get_elem(val_idx);
- if (!strcmp(curr_param->get_id()->get_name(), "data_value_descriptor")) {
- data__value__descriptor().set_param(*curr_param);
- value_used[val_idx]=true;
- }
- }
- for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
- Module_Param* const curr_param = param.get_elem(val_idx);
- if (!strcmp(curr_param->get_id()->get_name(), "data_value")) {
- data__value().set_param(*curr_param);
- value_used[val_idx]=true;
- }
- }
- for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
- param.get_elem(val_idx)->error("Non existent field name in type EMBEDDED PDV: %s", param.get_elem(val_idx)->get_id()->get_name());
- break;
- }
- } break;
- default:
- param.type_error("record template", "EMBEDDED PDV");
+ if (!is_bound()) {
+ return new Module_Param_Unbound();
}
- is_ifpresent = param.get_ifpresent();
+ Module_Param* mp_field_identification = field_identification.get_param(param_name);
+ mp_field_identification->set_id(new Module_Param_FieldName(mcopystr("identification")));
+ Module_Param* mp_field_data_value_descriptor = field_data__value__descriptor.get_param(param_name);
+ mp_field_data_value_descriptor->set_id(new Module_Param_FieldName(mcopystr("data_value_descriptor")));
+ Module_Param* mp_field_data_value = field_data__value.get_param(param_name);
+ mp_field_data_value->set_id(new Module_Param_FieldName(mcopystr("data_value")));
+ Module_Param_Assignment_List* mp = new Module_Param_Assignment_List();
+ mp->add_elem(mp_field_identification);
+ mp->add_elem(mp_field_data_value_descriptor);
+ mp->add_elem(mp_field_data_value);
+ return mp;
}
void EMBEDDED_PDV::encode_text(Text_Buf& text_buf) const
case TTCN_EncDec::CT_XER: {
TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name);
unsigned XER_coding=va_arg(pvar, unsigned);
- XER_encode(*p_td.xer,p_buf, XER_coding, 0);
+ XER_encode(*p_td.xer,p_buf, XER_coding, 0, 0);
break;}
case TTCN_EncDec::CT_JSON: {
TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name);
if (type==XML_READER_TYPE_ELEMENT)
break;
}
- XER_decode(*p_td.xer, reader, XER_coding);
+ XER_decode(*p_td.xer, reader, XER_coding, XER_NONE, 0);
size_t bytes = reader.ByteConsumed();
p_buf.set_pos(bytes);
break;}
}
int EMBEDDED_PDV::XER_encode(const XERdescriptor_t& p_td,
- TTCN_Buffer& p_buf, unsigned int flavor, int indent) const {
+ TTCN_Buffer& p_buf, unsigned int flavor, int indent, embed_values_enc_struct_t*) const {
if(!is_bound()) {
TTCN_EncDec_ErrorContext::error
(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
p_buf.put_s((size_t)p_td.namelens[exer] - 1 + indenting, (const unsigned char*)p_td.names[exer]);
flavor &= XER_MASK;
++indent;
- field_identification .XER_encode(EMBEDDED_PDV_identification_xer_ , p_buf, flavor, indent);
+ field_identification .XER_encode(EMBEDDED_PDV_identification_xer_ , p_buf, flavor, indent, 0);
if (field_data__value__descriptor.is_value()) {
TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_INVAL_MSG,
"data-value-descriptor not allowed for EMBEDDED PDV");
}
- field_data__value__descriptor.XER_encode(EMBEDDED_PDV_data_value_descriptor_xer_, p_buf, flavor, indent);
- field_data__value .XER_encode(EMBEDDED_PDV_data_value_xer_ , p_buf, flavor, indent);
+ field_data__value__descriptor.XER_encode(EMBEDDED_PDV_data_value_descriptor_xer_, p_buf, flavor, indent, 0);
+ field_data__value .XER_encode(EMBEDDED_PDV_data_value_xer_ , p_buf, flavor, indent, 0);
if (indenting) do_indent(p_buf, --indent);
p_buf.put_c('<');
return (int)p_buf.get_len() - encoded_length;
}
-int EMBEDDED_PDV::XER_decode(const XERdescriptor_t& p_td, XmlReaderWrap& reader, unsigned int flavor)
+int EMBEDDED_PDV::XER_decode(const XERdescriptor_t& p_td, XmlReaderWrap& reader, unsigned int flavor, unsigned int flavor2, embed_values_dec_struct_t*)
{
int exer = is_exer(flavor);
int depth = 1, type, success;
break;
}
}
- field_identification .XER_decode(EMBEDDED_PDV_identification_xer_ , reader, flavor);
- field_data__value__descriptor.XER_decode(EMBEDDED_PDV_data_value_descriptor_xer_, reader, flavor);
+ field_identification .XER_decode(EMBEDDED_PDV_identification_xer_ , reader, flavor, flavor2, 0);
+ field_data__value__descriptor.XER_decode(EMBEDDED_PDV_data_value_descriptor_xer_, reader, flavor, flavor2, 0);
if (field_data__value__descriptor.is_value()) {
TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_INVAL_MSG,
"data-value-descriptor not allowed for EMBEDDED PDV");
}
- field_data__value .XER_decode(EMBEDDED_PDV_data_value_xer_ , reader, flavor);
+ field_data__value .XER_decode(EMBEDDED_PDV_data_value_xer_ , reader, flavor, flavor2, 0);
for (success = reader.Read(); success == 1; success = reader.Read()) {
type = reader.NodeType();
if (XML_READER_TYPE_END_ELEMENT == type) {
OCTETSTRING_template field_data__value;
};
+void EMBEDDED_PDV_template::set_param(Module_Param& param)
+{
+ param.basic_check(Module_Param::BC_TEMPLATE, "record template");
+ Module_Param_Ptr mp = ¶m;
+ if (param.get_type() == Module_Param::MP_Reference) {
+ mp = param.get_referenced_param();
+ }
+ switch (mp->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: {
+ EMBEDDED_PDV_template temp;
+ temp.set_type(mp->get_type() == Module_Param::MP_List_Template ?
+ VALUE_LIST : COMPLEMENTED_LIST, mp->get_size());
+ for (size_t i=0; i<mp->get_size(); i++) {
+ temp.list_item(i).set_param(*mp->get_elem(i));
+ }
+ *this = temp;
+ break; }
+ case Module_Param::MP_Value_List:
+ if (mp->get_size()==0) break;
+ if (3!=mp->get_size()) {
+ param.error("record template of type EMBEDDED PDV has 3 fields but list value has %d fields", (int)mp->get_size());
+ }
+ if (mp->get_elem(0)->get_type()!=Module_Param::MP_NotUsed) identification().set_param(*mp->get_elem(0));
+ if (mp->get_elem(1)->get_type()!=Module_Param::MP_NotUsed) data__value__descriptor().set_param(*mp->get_elem(1));
+ if (mp->get_elem(2)->get_type()!=Module_Param::MP_NotUsed) data__value().set_param(*mp->get_elem(2));
+ break;
+ case Module_Param::MP_Assignment_List: {
+ Vector<bool> value_used(mp->get_size());
+ value_used.resize(mp->get_size(), false);
+ for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) {
+ Module_Param* const curr_param = mp->get_elem(val_idx);
+ if (!strcmp(curr_param->get_id()->get_name(), "identification")) {
+ identification().set_param(*curr_param);
+ value_used[val_idx]=true;
+ }
+ }
+ for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) {
+ Module_Param* const curr_param = mp->get_elem(val_idx);
+ if (!strcmp(curr_param->get_id()->get_name(), "data_value_descriptor")) {
+ data__value__descriptor().set_param(*curr_param);
+ value_used[val_idx]=true;
+ }
+ }
+ for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) {
+ Module_Param* const curr_param = mp->get_elem(val_idx);
+ if (!strcmp(curr_param->get_id()->get_name(), "data_value")) {
+ data__value().set_param(*curr_param);
+ value_used[val_idx]=true;
+ }
+ }
+ for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) if (!value_used[val_idx]) {
+ mp->get_elem(val_idx)->error("Non existent field name in type EMBEDDED PDV: %s", mp->get_elem(val_idx)->get_id()->get_name());
+ break;
+ }
+ } break;
+ default:
+ param.type_error("record template", "EMBEDDED PDV");
+ }
+ is_ifpresent = param.get_ifpresent() || mp->get_ifpresent();
+}
+
+Module_Param* EMBEDDED_PDV_template::get_param(Module_Param_Name& param_name) const
+{
+ Module_Param* mp = NULL;
+ switch (template_selection) {
+ case UNINITIALIZED_TEMPLATE:
+ mp = new Module_Param_Unbound();
+ break;
+ case OMIT_VALUE:
+ mp = new Module_Param_Omit();
+ break;
+ case ANY_VALUE:
+ mp = new Module_Param_Any();
+ break;
+ case ANY_OR_OMIT:
+ mp = new Module_Param_AnyOrNone();
+ break;
+ case SPECIFIC_VALUE: {
+ Module_Param* mp_field_identification = single_value->field_identification.get_param(param_name);
+ mp_field_identification->set_id(new Module_Param_FieldName(mcopystr("identification")));
+ Module_Param* mp_field_data_value_descriptor = single_value->field_data__value__descriptor.get_param(param_name);
+ mp_field_data_value_descriptor->set_id(new Module_Param_FieldName(mcopystr("data_value_descriptor")));
+ Module_Param* mp_field_string_value = single_value->field_data__value.get_param(param_name);
+ mp_field_string_value->set_id(new Module_Param_FieldName(mcopystr("data_value")));
+ mp = new Module_Param_Assignment_List();
+ mp->add_elem(mp_field_identification);
+ mp->add_elem(mp_field_data_value_descriptor);
+ mp->add_elem(mp_field_string_value);
+ break; }
+ case VALUE_LIST:
+ case COMPLEMENTED_LIST: {
+ if (template_selection == VALUE_LIST) {
+ mp = new Module_Param_List_Template();
+ }
+ else {
+ mp = new Module_Param_ComplementList_Template();
+ }
+ for (size_t i = 0; i < value_list.n_values; ++i) {
+ mp->add_elem(value_list.list_value[i].get_param(param_name));
+ }
+ break; }
+ default:
+ break;
+ }
+ if (is_ifpresent) {
+ mp->set_ifpresent();
+ }
+ return mp;
+}
+
void EMBEDDED_PDV_template::clean_up()
{
switch (template_selection) {
return *this;
}
-boolean EMBEDDED_PDV_template::match(const EMBEDDED_PDV& other_value) const
+boolean EMBEDDED_PDV_template::match(const EMBEDDED_PDV& other_value,
+ boolean /* legacy */) const
{
switch (template_selection) {
case ANY_VALUE:
log_ifpresent();
}
-void EMBEDDED_PDV_template::log_match(const EMBEDDED_PDV& match_value) const
+void EMBEDDED_PDV_template::log_match(const EMBEDDED_PDV& match_value,
+ boolean /* legacy */) const
{
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ identification := ");
}
}
-boolean EMBEDDED_PDV_template::is_present() const
+boolean EMBEDDED_PDV_template::is_present(boolean legacy /* = FALSE */) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
- return !match_omit();
+ return !match_omit(legacy);
}
-boolean EMBEDDED_PDV_template::match_omit() const
+boolean EMBEDDED_PDV_template::match_omit(boolean legacy /* = FALSE */) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
- for (unsigned int i=0; i<value_list.n_values; i++)
- if (value_list.list_value[i].match_omit())
- return template_selection==VALUE_LIST;
- return template_selection==COMPLEMENTED_LIST;
+ if (legacy) {
+ // legacy behavior: 'omit' can appear in the value/complement list
+ for (unsigned int i=0; i<value_list.n_values; i++)
+ if (value_list.list_value[i].match_omit())
+ return template_selection==VALUE_LIST;
+ return template_selection==COMPLEMENTED_LIST;
+ }
+ // else fall through
default:
return FALSE;
}
}
#ifndef TITAN_RUNTIME_2
-void EMBEDDED_PDV_template::check_restriction(template_res t_res, const char* t_name) const
+void EMBEDDED_PDV_template::check_restriction(template_res t_res, const char* t_name,
+ boolean legacy /* = FALSE */) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
template_selection==SPECIFIC_VALUE)) return;
break;
case TR_PRESENT:
- if (!match_omit()) return;
+ if (!match_omit(legacy)) return;
break;
default:
return;