// This C++ source file was generated by the TTCN-3 compiler
// of the TTCN-3 Test Executor version 9.0.0
// The generation of user and time information were disabled by the -D flag.

// Copyright (c) 2000-2023 Ericsson Telecom AB

// Do not edit this file unless you know what you are doing.

/* Including header files */

#include "Osmocom_CTRL_Functions.hh"

namespace Osmocom__CTRL__Functions {

/* Literal string constants */

extern const CHARSTRING cs_15(0, NULL),
cs_12(' '),
cs_18(19, " Missing changes in"),
cs_16(22, " Unexpected changes in"),
cs_14(14, " but expected "),
cs_7(14, " didn't match "),
cs_13(4, " is "),
cs_6(7, " value "),
cs_5(2, "-1"),
cs_3('.'),
cs_17(';'),
cs_10(14, "Internal error"),
cs_1(27, "Osmocom_CTRL_Functions.ttcn"),
cs_11(23, "Rate counter mismatch: "),
cs_19(41, "Rate counters did not change as expected:"),
cs_4(3, "abs"),
cs_8(3, "msc"),
cs_9(11, "not present"),
cs_0(4, "omit"),
cs_2(9, "rate_ctr.");
const unsigned char module_checksum[] = { 0xa3, 0xbf, 0xbf, 0x45, 0xaf, 0x82, 0x5b, 0x8f, 0xee, 0xff, 0xf2, 0x6e, 0xba, 0x85, 0xd7, 0x3b };

/* Global variable definitions */

// No XER for charstring__list
const TTCN_Typedescriptor_t charstring__list_descr_ = { "@Osmocom_CTRL_Functions.charstring_list", NULL, NULL, NULL, NULL, NULL, NULL, NULL, &CHARSTRING_descr_, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       charstring__list_0_xer_ = { {"CHARSTRING>\n", "CHARSTRING>\n"}, {12, 12}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t charstring__list_0_descr_ = { "@Osmocom_CTRL_Functions.charstring_list.<oftype>", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &charstring__list_0_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
CHARSTRING_template template_f__ctrl__get_on__err_defval;
const CHARSTRING_template& f__ctrl__get_on__err_defval = template_f__ctrl__get_on__err_defval;
CHARSTRING_template template_f__ctrl__exp__trap_val_defval;
const CHARSTRING_template& f__ctrl__exp__trap_val_defval = template_f__ctrl__exp__trap_val_defval;
FLOAT const_f__ctrl__exp__trap_timeout__val_defval;
const FLOAT& f__ctrl__exp__trap_timeout__val_defval = const_f__ctrl__exp__trap_timeout__val_defval;
CHARSTRING_template template_f__ctrl__exp__set_val_defval;
const CHARSTRING_template& f__ctrl__exp__set_val_defval = template_f__ctrl__exp__set_val_defval;
CHARSTRING_template template_f__ctrl__exp__set_rsp_defval;
const CHARSTRING_template& f__ctrl__exp__set_rsp_defval = template_f__ctrl__exp__set_rsp_defval;
FLOAT const_f__ctrl__exp__set_timeout__val_defval;
const FLOAT& f__ctrl__exp__set_timeout__val_defval = const_f__ctrl__exp__set_timeout__val_defval;
CHARSTRING_template template_f__ctrl__exp__get_rsp_defval;
const CHARSTRING_template& f__ctrl__exp__get_rsp_defval = template_f__ctrl__exp__get_rsp_defval;
FLOAT const_f__ctrl__exp__get_timeout__val_defval;
const FLOAT& f__ctrl__exp__get_timeout__val_defval = const_f__ctrl__exp__get_timeout__val_defval;
CHARSTRING const_ts__ctrl__ratectr_kind_defval;
const CHARSTRING& ts__ctrl__ratectr_kind_defval = const_ts__ctrl__ratectr_kind_defval;
const XERdescriptor_t       CounterNameVal_name_xer_ = { {"name>\n", "name>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t CounterNameVal_name_descr_ = { "@Osmocom_CTRL_Functions.CounterNameVal.name", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &CounterNameVal_name_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       CounterNameVal_val_xer_ = { {"val>\n", "val>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t CounterNameVal_val_descr_ = { "@Osmocom_CTRL_Functions.CounterNameVal.val", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &CounterNameVal_val_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
// No XER for CounterNameVal
const TTCN_Typedescriptor_t CounterNameVal_descr_ = { "@Osmocom_CTRL_Functions.CounterNameVal", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
// No XER for CounterNameVals
const TTCN_Typedescriptor_t CounterNameVals_descr_ = { "@Osmocom_CTRL_Functions.CounterNameVals", NULL, NULL, NULL, NULL, NULL, NULL, NULL, &CounterNameVal_descr_, TTCN_Typedescriptor_t::DONTCARE };
// No XER for CounterNameValsList
const TTCN_Typedescriptor_t CounterNameValsList_descr_ = { "@Osmocom_CTRL_Functions.CounterNameValsList", NULL, NULL, NULL, NULL, NULL, NULL, NULL, &CounterNameVals_descr_, TTCN_Typedescriptor_t::DONTCARE };
CHARSTRING const_f__counter__name__vals__get__n_instance__name_defval;
const CHARSTRING& f__counter__name__vals__get__n_instance__name_defval = const_f__counter__name__vals__get__n_instance__name_defval;
INTEGER const_f__counter__name__vals__get__n_start__idx_defval;
const INTEGER& f__counter__name__vals__get__n_start__idx_defval = const_f__counter__name__vals__get__n_start__idx_defval;
INTEGER const_f__counter__name__vals__add_val_defval;
const INTEGER& f__counter__name__vals__add_val_defval = const_f__counter__name__vals__add_val_defval;
INTEGER const_f__counter__name__vals__set_val_defval;
const INTEGER& f__counter__name__vals__set_val_defval = const_f__counter__name__vals__set_val_defval;
INTEGER const_f__counter__name__vals__list__add_val_defval;
const INTEGER& f__counter__name__vals__list__add_val_defval = const_f__counter__name__vals__list__add_val_defval;
INTEGER const_f__counter__name__vals__list__set_val_defval;
const INTEGER& f__counter__name__vals__list__set_val_defval = const_f__counter__name__vals__list__set_val_defval;
TTCN_Module module_object("Osmocom_CTRL_Functions", __DATE__, __TIME__, module_checksum, pre_init_module, NULL, 0U, 4294967295U, 4294967295U, 4294967295U, NULL, 0LU, 0, post_init_module, NULL, NULL, NULL, NULL, NULL, NULL, NULL);

const RuntimeVersionChecker ver_checker(  current_runtime_version.requires_major_version_9,
  current_runtime_version.requires_minor_version_0,
  current_runtime_version.requires_patch_level_0,  current_runtime_version.requires_runtime_1);

/* Member functions of C++ classes */

CounterNameVal::CounterNameVal()
{
}

CounterNameVal::CounterNameVal(const CHARSTRING& par_name,
    const INTEGER& par_val)
  :   field_name(par_name),
  field_val(par_val)
{
}

CounterNameVal::CounterNameVal(const CounterNameVal& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @Osmocom_CTRL_Functions.CounterNameVal.");
if (other_value.name().is_bound()) field_name = other_value.name();
else field_name.clean_up();
if (other_value.val().is_bound()) field_val = other_value.val();
else field_val.clean_up();
}

void CounterNameVal::clean_up()
{
field_name.clean_up();
field_val.clean_up();
}

const TTCN_Typedescriptor_t* CounterNameVal::get_descriptor() const { return &CounterNameVal_descr_; }
CounterNameVal& CounterNameVal::operator=(const CounterNameVal& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @Osmocom_CTRL_Functions.CounterNameVal.");
  if (other_value.name().is_bound()) field_name = other_value.name();
  else field_name.clean_up();
  if (other_value.val().is_bound()) field_val = other_value.val();
  else field_val.clean_up();
}
return *this;
}

boolean CounterNameVal::operator==(const CounterNameVal& other_value) const
{
return field_name==other_value.field_name
  && field_val==other_value.field_val;
}

boolean CounterNameVal::is_bound() const
{
return (field_name.is_bound())
  || (field_val.is_bound());
}
boolean CounterNameVal::is_value() const
{
return field_name.is_value()
  && field_val.is_value();
}
void CounterNameVal::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ name := ");
field_name.log();
TTCN_Logger::log_event_str(", val := ");
field_val.log();
TTCN_Logger::log_event_str(" }");
}

void CounterNameVal::set_implicit_omit()
{
if (name().is_bound()) name().set_implicit_omit();
if (val().is_bound()) val().set_implicit_omit();
}

void CounterNameVal::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record value of type @Osmocom_CTRL_Functions.CounterNameVal has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) name().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) val().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(), "name")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          name().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(), "val")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          val().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @Osmocom_CTRL_Functions.CounterNameVal: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@Osmocom_CTRL_Functions.CounterNameVal");
  }
}

void CounterNameVal::encode_text(Text_Buf& text_buf) const
{
field_name.encode_text(text_buf);
field_val.encode_text(text_buf);
}

void CounterNameVal::decode_text(Text_Buf& text_buf)
{
field_name.decode_text(text_buf);
field_val.decode_text(text_buf);
}

struct CounterNameVal_template::single_value_struct {
CHARSTRING_template field_name;
INTEGER_template field_val;
};

void CounterNameVal_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_name = ANY_VALUE;
single_value->field_val = ANY_VALUE;
}
}
}

void CounterNameVal_template::copy_value(const CounterNameVal& other_value)
{
single_value = new single_value_struct;
if (other_value.name().is_bound()) {
  single_value->field_name = other_value.name();
} else {
  single_value->field_name.clean_up();
}
if (other_value.val().is_bound()) {
  single_value->field_val = other_value.val();
} else {
  single_value->field_val.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void CounterNameVal_template::copy_template(const CounterNameVal_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.name().get_selection()) {
single_value->field_name = other_value.name();
} else {
single_value->field_name.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.val().get_selection()) {
single_value->field_val = other_value.val();
} else {
single_value->field_val.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 CounterNameVal_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 CounterNameVal_template(*other_value.implication_.precondition);
implication_.implied_template = new CounterNameVal_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 @Osmocom_CTRL_Functions.CounterNameVal.");
break;
}
set_selection(other_value);
}

CounterNameVal_template::CounterNameVal_template()
{
}

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

CounterNameVal_template::CounterNameVal_template(const CounterNameVal& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean CounterNameVal_template::match(const CounterNameVal& 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.name().is_bound()) return FALSE;
if(!single_value->field_name.match(other_value.name(), legacy))return FALSE;
if(!other_value.val().is_bound()) return FALSE;
if(!single_value->field_val.match(other_value.val(), 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 @Osmocom_CTRL_Functions.CounterNameVal.");
}
return FALSE;
}

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

boolean CounterNameVal_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_name.is_value()
 && single_value->field_val.is_value();
}

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

CounterNameVal CounterNameVal_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 @Osmocom_CTRL_Functions.CounterNameVal.");
CounterNameVal ret_val;
if (single_value->field_name.is_bound()) {
ret_val.name() = single_value->field_name.valueof();
}
if (single_value->field_val.is_bound()) {
ret_val.val() = single_value->field_val.valueof();
}
return ret_val;
}

void CounterNameVal_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 @Osmocom_CTRL_Functions.CounterNameVal.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new CounterNameVal_template[list_length];
}

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

CHARSTRING_template& CounterNameVal_template::name()
{
set_specific();
return single_value->field_name;
}

const CHARSTRING_template& CounterNameVal_template::name() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field name of a non-specific template of type @Osmocom_CTRL_Functions.CounterNameVal.");
return single_value->field_name;
}

INTEGER_template& CounterNameVal_template::val()
{
set_specific();
return single_value->field_val;
}

const INTEGER_template& CounterNameVal_template::val() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field val of a non-specific template of type @Osmocom_CTRL_Functions.CounterNameVal.");
return single_value->field_val;
}

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

void CounterNameVal_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ name := ");
single_value->field_name.log();
TTCN_Logger::log_event_str(", val := ");
single_value->field_val.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 CounterNameVal_template::log_match(const CounterNameVal& 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_name.match(match_value.name(), legacy)){
TTCN_Logger::log_logmatch_info(".name");
single_value->field_name.log_match(match_value.name(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_val.match(match_value.val(), legacy)){
TTCN_Logger::log_logmatch_info(".val");
single_value->field_val.log_match(match_value.val(), 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("{ name := ");
single_value->field_name.log_match(match_value.name(), legacy);
TTCN_Logger::log_event_str(", val := ");
single_value->field_val.log_match(match_value.val(), 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 CounterNameVal_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_name.encode_text(text_buf);
single_value->field_val.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 @Osmocom_CTRL_Functions.CounterNameVal.");
}
}

void CounterNameVal_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_name.decode_text(text_buf);
single_value->field_val.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 CounterNameVal_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 @Osmocom_CTRL_Functions.CounterNameVal.");
}
}

void CounterNameVal_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: {
    CounterNameVal_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record template of type @Osmocom_CTRL_Functions.CounterNameVal has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) name().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) val().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(), "name")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          name().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(), "val")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          val().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @Osmocom_CTRL_Functions.CounterNameVal: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    CounterNameVal_template* precondition = new CounterNameVal_template;
    precondition->set_param(*param.get_elem(0));
    CounterNameVal_template* implied_template = new CounterNameVal_template;
    implied_template->set_param(*param.get_elem(1));
    *this = CounterNameVal_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@Osmocom_CTRL_Functions.CounterNameVal");
  }
  is_ifpresent = param.get_ifpresent();
}

void CounterNameVal_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_name.check_restriction(t_res, t_name ? t_name : "@Osmocom_CTRL_Functions.CounterNameVal");
single_value->field_val.check_restriction(t_res, t_name ? t_name : "@Osmocom_CTRL_Functions.CounterNameVal");
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 : "@Osmocom_CTRL_Functions.CounterNameVal");
}

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

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


const CounterNameVal CounterNameVals::UNBOUND_ELEM;
CounterNameVals::CounterNameVals()
{
val_ptr = NULL;
}

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

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

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

void CounterNameVals::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.");
}
}

CounterNameVals& CounterNameVals::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;
}

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

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

boolean CounterNameVals::operator==(const CounterNameVals& other_value) const
{
if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @Osmocom_CTRL_Functions.CounterNameVals.");
if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @Osmocom_CTRL_Functions.CounterNameVals.");
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;
}

CounterNameVal& CounterNameVals::operator[](int index_value)
{
if (index_value < 0) TTCN_error("Accessing an element of type @Osmocom_CTRL_Functions.CounterNameVals 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 = (CounterNameVal**)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 CounterNameVal(*(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 CounterNameVal;
}
return *val_ptr->value_elements[index_value];
}

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

const CounterNameVal& CounterNameVals::operator[](int index_value) const
{
if (val_ptr == NULL)
TTCN_error("Accessing an element in an unbound value of type @Osmocom_CTRL_Functions.CounterNameVals.");
if (index_value < 0) TTCN_error("Accessing an element of type @Osmocom_CTRL_Functions.CounterNameVals using a negative index: %d.", index_value);
if (index_value >= val_ptr->n_elements) TTCN_error("Index overflow in a value of type @Osmocom_CTRL_Functions.CounterNameVals: 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 CounterNameVal& CounterNameVals::operator[](const INTEGER& index_value) const
{
index_value.must_bound("Using an unbound integer value for indexing a value of type @Osmocom_CTRL_Functions.CounterNameVals.");
return (*this)[(int)index_value];
}

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

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

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

CounterNameVals CounterNameVals::operator>>=(int rotate_count) const
{
if (val_ptr == NULL) TTCN_error("Performing rotation operation on an unbound value of type @Osmocom_CTRL_Functions.CounterNameVals.");
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;
CounterNameVals ret_val;
ret_val.set_size(val_ptr->n_elements);
for (int i=0; i<val_ptr->n_elements; i++) {
if (val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[(i+rc)%val_ptr->n_elements] =new CounterNameVal(*val_ptr->value_elements[i]);
}
}
return ret_val;
}

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

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

CounterNameVals CounterNameVals::replace(int index, int len, const CounterNameVals& repl) const
{
if (val_ptr == NULL) TTCN_error("The first argument of replace() is an unbound value of type @Osmocom_CTRL_Functions.CounterNameVals.");
if (repl.val_ptr == NULL) TTCN_error("The fourth argument of replace() is an unbound value of type @Osmocom_CTRL_Functions.CounterNameVals.");
check_replace_arguments(val_ptr->n_elements, index, len, "@Osmocom_CTRL_Functions.CounterNameVals","element");
CounterNameVals 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 CounterNameVal(*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 CounterNameVal(*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 CounterNameVal(*val_ptr->value_elements[index+i+len]);
}
}
return ret_val;
}

CounterNameVals CounterNameVals::replace(int index, int len, const CounterNameVals_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 CounterNameVals::set_size(int new_size)
{
if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a value of type @Osmocom_CTRL_Functions.CounterNameVals.");
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 = (CounterNameVal**)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 CounterNameVal(*(val_ptr->value_elements[elem_count]));
}
}
clean_up();
val_ptr = new_val_ptr;
}
if (new_size > val_ptr->n_elements) {
val_ptr->value_elements = (CounterNameVal**)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 @Osmocom_CTRL_Functions.CounterNameVals: %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 = (CounterNameVal**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size);
val_ptr->n_elements = new_size;
}
}

boolean CounterNameVals::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 CounterNameVals::size_of() const
{
if (val_ptr == NULL) TTCN_error("Performing sizeof operation on an unbound value of type @Osmocom_CTRL_Functions.CounterNameVals.");
return val_ptr->n_elements;
}

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

void CounterNameVals::encode_text(Text_Buf& text_buf) const
{
if (val_ptr == NULL) TTCN_error("Text encoder: Encoding an unbound value of type @Osmocom_CTRL_Functions.CounterNameVals.");
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 CounterNameVals::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 @Osmocom_CTRL_Functions.CounterNameVals.");
val_ptr->value_elements = (CounterNameVal**)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 CounterNameVal;
val_ptr->value_elements[elem_count]->decode_text(text_buf);
}
}

void CounterNameVals_template::copy_value(const CounterNameVals& other_value)
{
if (!other_value.is_bound()) TTCN_error("Initialization of a template of type @Osmocom_CTRL_Functions.CounterNameVals with an unbound value.");
single_value.n_elements = other_value.size_of();
single_value.value_elements = (CounterNameVal_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 CounterNameVal_template(other_value[elem_count]);
} else {
single_value.value_elements[elem_count] = new CounterNameVal_template;
}
}
set_selection(SPECIFIC_VALUE);
}

void CounterNameVals_template::copy_template(const CounterNameVals_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 = (CounterNameVal_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 CounterNameVal_template(*other_value.single_value.value_elements[elem_count]);
} else {
single_value.value_elements[elem_count] = new CounterNameVal_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 CounterNameVals_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 CounterNameVals_template(*other_value.implication_.precondition);
implication_.implied_template = new CounterNameVals_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 @Osmocom_CTRL_Functions.CounterNameVals.");
break;
}
set_selection(other_value);
}

boolean CounterNameVals_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 CounterNameVals_template*)template_ptr)->single_value.value_elements[template_index]->match((*(const CounterNameVals*)value_ptr)[value_index], legacy);
else return ((const CounterNameVals_template*)template_ptr)->single_value.value_elements[template_index]->is_any_or_omit();
}

CounterNameVals_template::CounterNameVals_template()
{
}

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

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

CounterNameVals_template::CounterNameVals_template(const CounterNameVals& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

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

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

CounterNameVal_template& CounterNameVals_template::operator[](int index_value)
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @Osmocom_CTRL_Functions.CounterNameVals 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 @Osmocom_CTRL_Functions.CounterNameVals.");
    break;
}
return *single_value.value_elements[index_value];
}

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

const CounterNameVal_template& CounterNameVals_template::operator[](int index_value) const
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @Osmocom_CTRL_Functions.CounterNameVals using a negative index: %d.", index_value);
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing an element of a non-specific template for type @Osmocom_CTRL_Functions.CounterNameVals.");
if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @Osmocom_CTRL_Functions.CounterNameVals: 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 CounterNameVal_template& CounterNameVals_template::operator[](const INTEGER& index_value) const
{
index_value.must_bound("Using an unbound integer value for indexing a template of type @Osmocom_CTRL_Functions.CounterNameVals.");
return (*this)[(int)index_value];
}

void CounterNameVals_template::set_size(int new_size)
{
if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a template of type @Osmocom_CTRL_Functions.CounterNameVals.");
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 = (CounterNameVal_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 CounterNameVal_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 CounterNameVal_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 = (CounterNameVal_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size);
single_value.n_elements = new_size;
}
}

int CounterNameVals_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 CounterNameVals_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 @Osmocom_CTRL_Functions.CounterNameVals which has an ifpresent attribute.", op_name);
switch (template_selection)
{
case SPECIFIC_VALUE: {
  min_size = 0;
  has_any_or_none = FALSE;
  int elem_count = single_value.n_elements;
  if (!is_size) { while (elem_count>0 && !single_value.value_elements[elem_count-1]->is_bound()) elem_count--; }
  for (int i=0; i<elem_count; i++) {
    switch (single_value.value_elements[i]->get_selection()) {
    case OMIT_VALUE:
      TTCN_error("Performing %sof() operation on a template of type @Osmocom_CTRL_Functions.CounterNameVals 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 @Osmocom_CTRL_Functions.CounterNameVals 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 @Osmocom_CTRL_Functions.CounterNameVals 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 @Osmocom_CTRL_Functions.CounterNameVals 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 @Osmocom_CTRL_Functions.CounterNameVals containing complemented list.", op_name);
default:
  TTCN_error("Performing %sof() operation on an uninitialized/unsupported template of type @Osmocom_CTRL_Functions.CounterNameVals.", op_name);
}
return check_section_is_single(min_size, has_any_or_none, op_name, "a", "template of type @Osmocom_CTRL_Functions.CounterNameVals");
}

boolean CounterNameVals_template::match(const CounterNameVals& 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 @Osmocom_CTRL_Functions.CounterNameVals.");
}
return FALSE;
}

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

CounterNameVals CounterNameVals_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 @Osmocom_CTRL_Functions.CounterNameVals.");
CounterNameVals 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;
}

CounterNameVals CounterNameVals_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);
}

CounterNameVals CounterNameVals_template::replace(int index, int len, const CounterNameVals_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());
}

CounterNameVals CounterNameVals_template::replace(int index, int len, const CounterNameVals& 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 CounterNameVals_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 CounterNameVals_template[list_length];
break;
default:
TTCN_error("Internal error: Setting an invalid type for a template of type @Osmocom_CTRL_Functions.CounterNameVals.");
}
set_selection(template_type);
}

CounterNameVals_template& CounterNameVals_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 @Osmocom_CTRL_Functions.CounterNameVals.");
if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of type @Osmocom_CTRL_Functions.CounterNameVals.");
return value_list.list_value[list_index];
}

void CounterNameVals_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 CounterNameVals_template::log_match(const CounterNameVals& 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 CounterNameVals_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 @Osmocom_CTRL_Functions.CounterNameVals.");
}
}

void CounterNameVals_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 @Osmocom_CTRL_Functions.CounterNameVals.");
single_value.value_elements = (CounterNameVal_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 CounterNameVal_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 CounterNameVals_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 @Osmocom_CTRL_Functions.CounterNameVals.");
}
}

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

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

void CounterNameVals_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: {
    CounterNameVals_template temp;
    temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = temp;
    break; }
  case Module_Param::MP_Indexed_List:
    if (template_selection!=SPECIFIC_VALUE) set_size(0);
    for (size_t p_i=0; p_i<param.get_size(); ++p_i) {
      (*this)[(int)(param.get_elem(p_i)->get_id()->get_index())].set_param(*param.get_elem(p_i));
    }
    break;
  case Module_Param::MP_Value_List: {
    set_size(param.get_size());
    int curr_idx = 0;
    for (size_t p_i=0; p_i<param.get_size(); ++p_i) {
      switch (param.get_elem(p_i)->get_type()) {
      case Module_Param::MP_NotUsed:
        curr_idx++;
        break;
      case Module_Param::MP_Permutation_Template: {
        int perm_start_idx = curr_idx;
        Module_Param* param_i = param.get_elem(p_i);
        for (size_t perm_i=0; perm_i<param_i->get_size(); perm_i++) {
          (*this)[curr_idx].set_param(*(param_i->get_elem(perm_i)));
          curr_idx++;
        }
        int perm_end_idx = curr_idx - 1;
        add_permutation(perm_start_idx, perm_end_idx);
      } break;
      default:
        (*this)[curr_idx].set_param(*param.get_elem(p_i));
        curr_idx++;
      }
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    CounterNameVals_template* precondition = new CounterNameVals_template;
    precondition->set_param(*param.get_elem(0));
    CounterNameVals_template* implied_template = new CounterNameVals_template;
    implied_template->set_param(*param.get_elem(1));
    *this = CounterNameVals_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record of template", "@Osmocom_CTRL_Functions.CounterNameVals");
  }
  is_ifpresent = param.get_ifpresent();
  set_length_range(param);
}

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

boolean CounterNameVals_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);
}
}

const CounterNameVals CounterNameValsList::UNBOUND_ELEM;
CounterNameValsList::CounterNameValsList()
{
val_ptr = NULL;
}

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

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

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

void CounterNameValsList::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.");
}
}

CounterNameValsList& CounterNameValsList::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;
}

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

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

boolean CounterNameValsList::operator==(const CounterNameValsList& other_value) const
{
if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @Osmocom_CTRL_Functions.CounterNameValsList.");
if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @Osmocom_CTRL_Functions.CounterNameValsList.");
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;
}

CounterNameVals& CounterNameValsList::operator[](int index_value)
{
if (index_value < 0) TTCN_error("Accessing an element of type @Osmocom_CTRL_Functions.CounterNameValsList 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 = (CounterNameVals**)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 CounterNameVals(*(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 CounterNameVals;
}
return *val_ptr->value_elements[index_value];
}

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

const CounterNameVals& CounterNameValsList::operator[](int index_value) const
{
if (val_ptr == NULL)
TTCN_error("Accessing an element in an unbound value of type @Osmocom_CTRL_Functions.CounterNameValsList.");
if (index_value < 0) TTCN_error("Accessing an element of type @Osmocom_CTRL_Functions.CounterNameValsList using a negative index: %d.", index_value);
if (index_value >= val_ptr->n_elements) TTCN_error("Index overflow in a value of type @Osmocom_CTRL_Functions.CounterNameValsList: 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 CounterNameVals& CounterNameValsList::operator[](const INTEGER& index_value) const
{
index_value.must_bound("Using an unbound integer value for indexing a value of type @Osmocom_CTRL_Functions.CounterNameValsList.");
return (*this)[(int)index_value];
}

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

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

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

CounterNameValsList CounterNameValsList::operator>>=(int rotate_count) const
{
if (val_ptr == NULL) TTCN_error("Performing rotation operation on an unbound value of type @Osmocom_CTRL_Functions.CounterNameValsList.");
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;
CounterNameValsList ret_val;
ret_val.set_size(val_ptr->n_elements);
for (int i=0; i<val_ptr->n_elements; i++) {
if (val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[(i+rc)%val_ptr->n_elements] =new CounterNameVals(*val_ptr->value_elements[i]);
}
}
return ret_val;
}

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

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

CounterNameValsList CounterNameValsList::replace(int index, int len, const CounterNameValsList& repl) const
{
if (val_ptr == NULL) TTCN_error("The first argument of replace() is an unbound value of type @Osmocom_CTRL_Functions.CounterNameValsList.");
if (repl.val_ptr == NULL) TTCN_error("The fourth argument of replace() is an unbound value of type @Osmocom_CTRL_Functions.CounterNameValsList.");
check_replace_arguments(val_ptr->n_elements, index, len, "@Osmocom_CTRL_Functions.CounterNameValsList","element");
CounterNameValsList 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 CounterNameVals(*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 CounterNameVals(*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 CounterNameVals(*val_ptr->value_elements[index+i+len]);
}
}
return ret_val;
}

CounterNameValsList CounterNameValsList::replace(int index, int len, const CounterNameValsList_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 CounterNameValsList::set_size(int new_size)
{
if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a value of type @Osmocom_CTRL_Functions.CounterNameValsList.");
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 = (CounterNameVals**)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 CounterNameVals(*(val_ptr->value_elements[elem_count]));
}
}
clean_up();
val_ptr = new_val_ptr;
}
if (new_size > val_ptr->n_elements) {
val_ptr->value_elements = (CounterNameVals**)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 @Osmocom_CTRL_Functions.CounterNameValsList: %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 = (CounterNameVals**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size);
val_ptr->n_elements = new_size;
}
}

boolean CounterNameValsList::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 CounterNameValsList::size_of() const
{
if (val_ptr == NULL) TTCN_error("Performing sizeof operation on an unbound value of type @Osmocom_CTRL_Functions.CounterNameValsList.");
return val_ptr->n_elements;
}

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

void CounterNameValsList::encode_text(Text_Buf& text_buf) const
{
if (val_ptr == NULL) TTCN_error("Text encoder: Encoding an unbound value of type @Osmocom_CTRL_Functions.CounterNameValsList.");
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 CounterNameValsList::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 @Osmocom_CTRL_Functions.CounterNameValsList.");
val_ptr->value_elements = (CounterNameVals**)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 CounterNameVals;
val_ptr->value_elements[elem_count]->decode_text(text_buf);
}
}

void CounterNameValsList_template::copy_value(const CounterNameValsList& other_value)
{
if (!other_value.is_bound()) TTCN_error("Initialization of a template of type @Osmocom_CTRL_Functions.CounterNameValsList with an unbound value.");
single_value.n_elements = other_value.size_of();
single_value.value_elements = (CounterNameVals_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 CounterNameVals_template(other_value[elem_count]);
} else {
single_value.value_elements[elem_count] = new CounterNameVals_template;
}
}
set_selection(SPECIFIC_VALUE);
}

void CounterNameValsList_template::copy_template(const CounterNameValsList_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 = (CounterNameVals_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 CounterNameVals_template(*other_value.single_value.value_elements[elem_count]);
} else {
single_value.value_elements[elem_count] = new CounterNameVals_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 CounterNameValsList_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 CounterNameValsList_template(*other_value.implication_.precondition);
implication_.implied_template = new CounterNameValsList_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 @Osmocom_CTRL_Functions.CounterNameValsList.");
break;
}
set_selection(other_value);
}

boolean CounterNameValsList_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 CounterNameValsList_template*)template_ptr)->single_value.value_elements[template_index]->match((*(const CounterNameValsList*)value_ptr)[value_index], legacy);
else return ((const CounterNameValsList_template*)template_ptr)->single_value.value_elements[template_index]->is_any_or_omit();
}

CounterNameValsList_template::CounterNameValsList_template()
{
}

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

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

CounterNameValsList_template::CounterNameValsList_template(const CounterNameValsList& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

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

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

CounterNameVals_template& CounterNameValsList_template::operator[](int index_value)
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @Osmocom_CTRL_Functions.CounterNameValsList 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 @Osmocom_CTRL_Functions.CounterNameValsList.");
    break;
}
return *single_value.value_elements[index_value];
}

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

const CounterNameVals_template& CounterNameValsList_template::operator[](int index_value) const
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @Osmocom_CTRL_Functions.CounterNameValsList using a negative index: %d.", index_value);
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing an element of a non-specific template for type @Osmocom_CTRL_Functions.CounterNameValsList.");
if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @Osmocom_CTRL_Functions.CounterNameValsList: 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 CounterNameVals_template& CounterNameValsList_template::operator[](const INTEGER& index_value) const
{
index_value.must_bound("Using an unbound integer value for indexing a template of type @Osmocom_CTRL_Functions.CounterNameValsList.");
return (*this)[(int)index_value];
}

void CounterNameValsList_template::set_size(int new_size)
{
if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a template of type @Osmocom_CTRL_Functions.CounterNameValsList.");
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 = (CounterNameVals_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 CounterNameVals_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 CounterNameVals_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 = (CounterNameVals_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size);
single_value.n_elements = new_size;
}
}

int CounterNameValsList_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 CounterNameValsList_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 @Osmocom_CTRL_Functions.CounterNameValsList which has an ifpresent attribute.", op_name);
switch (template_selection)
{
case SPECIFIC_VALUE: {
  min_size = 0;
  has_any_or_none = FALSE;
  int elem_count = single_value.n_elements;
  if (!is_size) { while (elem_count>0 && !single_value.value_elements[elem_count-1]->is_bound()) elem_count--; }
  for (int i=0; i<elem_count; i++) {
    switch (single_value.value_elements[i]->get_selection()) {
    case OMIT_VALUE:
      TTCN_error("Performing %sof() operation on a template of type @Osmocom_CTRL_Functions.CounterNameValsList 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 @Osmocom_CTRL_Functions.CounterNameValsList 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 @Osmocom_CTRL_Functions.CounterNameValsList 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 @Osmocom_CTRL_Functions.CounterNameValsList 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 @Osmocom_CTRL_Functions.CounterNameValsList containing complemented list.", op_name);
default:
  TTCN_error("Performing %sof() operation on an uninitialized/unsupported template of type @Osmocom_CTRL_Functions.CounterNameValsList.", op_name);
}
return check_section_is_single(min_size, has_any_or_none, op_name, "a", "template of type @Osmocom_CTRL_Functions.CounterNameValsList");
}

boolean CounterNameValsList_template::match(const CounterNameValsList& 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 @Osmocom_CTRL_Functions.CounterNameValsList.");
}
return FALSE;
}

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

CounterNameValsList CounterNameValsList_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 @Osmocom_CTRL_Functions.CounterNameValsList.");
CounterNameValsList 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;
}

CounterNameValsList CounterNameValsList_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);
}

CounterNameValsList CounterNameValsList_template::replace(int index, int len, const CounterNameValsList_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());
}

CounterNameValsList CounterNameValsList_template::replace(int index, int len, const CounterNameValsList& 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 CounterNameValsList_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 CounterNameValsList_template[list_length];
break;
default:
TTCN_error("Internal error: Setting an invalid type for a template of type @Osmocom_CTRL_Functions.CounterNameValsList.");
}
set_selection(template_type);
}

CounterNameValsList_template& CounterNameValsList_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 @Osmocom_CTRL_Functions.CounterNameValsList.");
if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of type @Osmocom_CTRL_Functions.CounterNameValsList.");
return value_list.list_value[list_index];
}

void CounterNameValsList_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 CounterNameValsList_template::log_match(const CounterNameValsList& 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 CounterNameValsList_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 @Osmocom_CTRL_Functions.CounterNameValsList.");
}
}

void CounterNameValsList_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 @Osmocom_CTRL_Functions.CounterNameValsList.");
single_value.value_elements = (CounterNameVals_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 CounterNameVals_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 CounterNameValsList_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 @Osmocom_CTRL_Functions.CounterNameValsList.");
}
}

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

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

void CounterNameValsList_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: {
    CounterNameValsList_template temp;
    temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = temp;
    break; }
  case Module_Param::MP_Indexed_List:
    if (template_selection!=SPECIFIC_VALUE) set_size(0);
    for (size_t p_i=0; p_i<param.get_size(); ++p_i) {
      (*this)[(int)(param.get_elem(p_i)->get_id()->get_index())].set_param(*param.get_elem(p_i));
    }
    break;
  case Module_Param::MP_Value_List: {
    set_size(param.get_size());
    int curr_idx = 0;
    for (size_t p_i=0; p_i<param.get_size(); ++p_i) {
      switch (param.get_elem(p_i)->get_type()) {
      case Module_Param::MP_NotUsed:
        curr_idx++;
        break;
      case Module_Param::MP_Permutation_Template: {
        int perm_start_idx = curr_idx;
        Module_Param* param_i = param.get_elem(p_i);
        for (size_t perm_i=0; perm_i<param_i->get_size(); perm_i++) {
          (*this)[curr_idx].set_param(*(param_i->get_elem(perm_i)));
          curr_idx++;
        }
        int perm_end_idx = curr_idx - 1;
        add_permutation(perm_start_idx, perm_end_idx);
      } break;
      default:
        (*this)[curr_idx].set_param(*param.get_elem(p_i));
        curr_idx++;
      }
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    CounterNameValsList_template* precondition = new CounterNameValsList_template;
    precondition->set_param(*param.get_elem(0));
    CounterNameValsList_template* implied_template = new CounterNameValsList_template;
    implied_template->set_param(*param.get_elem(1));
    *this = CounterNameValsList_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record of template", "@Osmocom_CTRL_Functions.CounterNameValsList");
  }
  is_ifpresent = param.get_ifpresent();
  set_length_range(param);
}

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

boolean CounterNameValsList_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);
}
}

/* Bodies of functions, altsteps and testcases */

CHARSTRING f__gen__rand__id()
{
TTCN_Location current_location("Osmocom_CTRL_Functions.ttcn", 29, TTCN_Location::LOCATION_FUNCTION, "f_gen_rand_id");
current_location.update_lineno(30);
/* Osmocom_CTRL_Functions.ttcn, line 30 */
return int2str(float2int((rnd() * 9.99999999e8)));
}

CHARSTRING f__ctrl__get(IPA__Emulation::IPA__CTRL__PT& pt, const CHARSTRING& variable, const CHARSTRING_template& on__err)
{
TTCN_Location current_location("Osmocom_CTRL_Functions.ttcn", 34, TTCN_Location::LOCATION_FUNCTION, "f_ctrl_get");
current_location.update_lineno(35);
/* Osmocom_CTRL_Functions.ttcn, line 35 */
TIMER T("T", 2.0);
current_location.update_lineno(36);
/* Osmocom_CTRL_Functions.ttcn, line 36 */
Osmocom__CTRL__Types::CtrlMessage rx;
current_location.update_lineno(37);
/* Osmocom_CTRL_Functions.ttcn, line 37 */
CHARSTRING id(f__gen__rand__id());
current_location.update_lineno(38);
/* Osmocom_CTRL_Functions.ttcn, line 38 */
pt.send(Osmocom__CTRL__Types::ts__CtrlMsgGet(id, variable), NULL);
current_location.update_lineno(39);
/* Osmocom_CTRL_Functions.ttcn, line 39 */
T.start();
current_location.update_lineno(40);
/* Osmocom_CTRL_Functions.ttcn, line 40 */
{
tmp_0:
alt_status tmp_0_alt_flag_0 = ALT_MAYBE;
alt_status tmp_0_alt_flag_1 = ALT_MAYBE;
alt_status tmp_0_alt_flag_2 = ALT_MAYBE;
alt_status tmp_0_alt_flag_3 = ALT_MAYBE;
alt_status tmp_0_default_flag = ALT_MAYBE;
TTCN_Snapshot::take_new(FALSE);
for ( ; ; ) {
if (tmp_0_alt_flag_0 == ALT_MAYBE) {
current_location.update_lineno(41);
/* Osmocom_CTRL_Functions.ttcn, line 41 */
tmp_0_alt_flag_0 = pt.receive(Osmocom__CTRL__Types::tr__CtrlMsgGetRepl(CHARSTRING_template(id), CHARSTRING_template(variable)), &(rx), any_compref, NULL, NULL, NULL);
if (tmp_0_alt_flag_0 == ALT_YES) break;
}
if (tmp_0_alt_flag_1 == ALT_MAYBE) {
current_location.update_lineno(43);
/* Osmocom_CTRL_Functions.ttcn, line 43 */
tmp_0_alt_flag_1 = pt.receive(Osmocom__CTRL__Types::tr__CtrlMsgTrap(Osmocom__CTRL__Types::tr__CtrlMsgTrap_variable_defval, Osmocom__CTRL__Types::tr__CtrlMsgTrap_val_defval), NULL, any_compref, NULL, NULL, NULL);
if (tmp_0_alt_flag_1 == ALT_YES) {
current_location.update_lineno(43);
/* Osmocom_CTRL_Functions.ttcn, line 43 */
goto tmp_0;
}
}
if (tmp_0_alt_flag_2 == ALT_MAYBE) {
current_location.update_lineno(44);
/* Osmocom_CTRL_Functions.ttcn, line 44 */
tmp_0_alt_flag_2 = pt.receive(Osmocom__CTRL__Types::tr__CtrlMsgError(Osmocom__CTRL__Types::tr__CtrlMsgError_id_defval, Osmocom__CTRL__Types::tr__CtrlMsgError_reason_defval), &(rx), any_compref, NULL, NULL, NULL);
if (tmp_0_alt_flag_2 == ALT_YES) {
current_location.update_lineno(45);
/* Osmocom_CTRL_Functions.ttcn, line 45 */
if (on__err.get_istemplate_kind((const char*)cs_0)) {
current_location.update_lineno(46);
/* Osmocom_CTRL_Functions.ttcn, line 46 */
Misc__Helpers::f__shutdown(cs_1, 46, FAIL, (TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Error in CTRL GET "),variable.log(),TTCN_Logger::log_event_str(": "),const_cast< const Osmocom__CTRL__Types::CtrlMessage&>(rx).err().reason().log(),TTCN_Logger::end_event_log2str()));
}
else {
current_location.update_lineno(49);
/* Osmocom_CTRL_Functions.ttcn, line 49 */
rx.resp().val() = on__err.valueof();
}
break;
}
}
if (tmp_0_alt_flag_3 == ALT_MAYBE) {
current_location.update_lineno(52);
/* Osmocom_CTRL_Functions.ttcn, line 52 */
tmp_0_alt_flag_3 = T.timeout(NULL);
if (tmp_0_alt_flag_3 == ALT_YES) {
current_location.update_lineno(53);
/* Osmocom_CTRL_Functions.ttcn, line 53 */
Misc__Helpers::f__shutdown(cs_1, 53, FAIL, (TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Timeout waiting for CTRL GET REPLY "),variable.log(),TTCN_Logger::end_event_log2str()));
break;
}
}
if (tmp_0_default_flag == ALT_MAYBE) {
tmp_0_default_flag = TTCN_Default::try_altsteps();
if (tmp_0_default_flag == ALT_YES || tmp_0_default_flag == ALT_BREAK) break;
else if (tmp_0_default_flag == ALT_REPEAT) goto tmp_0;
}
current_location.update_lineno(40);
/* Osmocom_CTRL_Functions.ttcn, line 40 */
if (tmp_0_alt_flag_0 == ALT_NO && tmp_0_alt_flag_1 == ALT_NO && tmp_0_alt_flag_2 == ALT_NO && tmp_0_alt_flag_3 == ALT_NO && tmp_0_default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in the alt statement in file Osmocom_CTRL_Functions.ttcn between lines 40 and 56.");
TTCN_Snapshot::take_new(TRUE);
}
}
current_location.update_lineno(57);
/* Osmocom_CTRL_Functions.ttcn, line 57 */
return const_cast< const Osmocom__CTRL__Types::CtrlMessage&>(rx).resp().val();
}

void f__ctrl__set(IPA__Emulation::IPA__CTRL__PT& pt, const CHARSTRING& variable, const CHARSTRING& val)
{
TTCN_Location current_location("Osmocom_CTRL_Functions.ttcn", 61, TTCN_Location::LOCATION_FUNCTION, "f_ctrl_set");
current_location.update_lineno(62);
/* Osmocom_CTRL_Functions.ttcn, line 62 */
TIMER T("T", 2.0);
current_location.update_lineno(63);
/* Osmocom_CTRL_Functions.ttcn, line 63 */
Osmocom__CTRL__Types::CtrlMessage rx;
current_location.update_lineno(64);
/* Osmocom_CTRL_Functions.ttcn, line 64 */
CHARSTRING id(f__gen__rand__id());
current_location.update_lineno(65);
/* Osmocom_CTRL_Functions.ttcn, line 65 */
pt.send(Osmocom__CTRL__Types::ts__CtrlMsgSet(id, variable, val), NULL);
current_location.update_lineno(66);
/* Osmocom_CTRL_Functions.ttcn, line 66 */
T.start();
current_location.update_lineno(67);
/* Osmocom_CTRL_Functions.ttcn, line 67 */
{
tmp_2:
alt_status tmp_2_alt_flag_0 = ALT_MAYBE;
alt_status tmp_2_alt_flag_1 = ALT_MAYBE;
alt_status tmp_2_alt_flag_2 = ALT_MAYBE;
alt_status tmp_2_alt_flag_3 = ALT_MAYBE;
alt_status tmp_2_default_flag = ALT_MAYBE;
TTCN_Snapshot::take_new(FALSE);
for ( ; ; ) {
if (tmp_2_alt_flag_0 == ALT_MAYBE) {
current_location.update_lineno(68);
/* Osmocom_CTRL_Functions.ttcn, line 68 */
tmp_2_alt_flag_0 = pt.receive(Osmocom__CTRL__Types::tr__CtrlMsgSetRepl(CHARSTRING_template(id), CHARSTRING_template(variable), CHARSTRING_template(val)), NULL, any_compref, NULL, NULL, NULL);
if (tmp_2_alt_flag_0 == ALT_YES) break;
}
if (tmp_2_alt_flag_1 == ALT_MAYBE) {
current_location.update_lineno(69);
/* Osmocom_CTRL_Functions.ttcn, line 69 */
tmp_2_alt_flag_1 = pt.receive(Osmocom__CTRL__Types::tr__CtrlMsgTrap(Osmocom__CTRL__Types::tr__CtrlMsgTrap_variable_defval, Osmocom__CTRL__Types::tr__CtrlMsgTrap_val_defval), NULL, any_compref, NULL, NULL, NULL);
if (tmp_2_alt_flag_1 == ALT_YES) {
current_location.update_lineno(69);
/* Osmocom_CTRL_Functions.ttcn, line 69 */
goto tmp_2;
}
}
if (tmp_2_alt_flag_2 == ALT_MAYBE) {
current_location.update_lineno(70);
/* Osmocom_CTRL_Functions.ttcn, line 70 */
tmp_2_alt_flag_2 = pt.receive(Osmocom__CTRL__Types::tr__CtrlMsgError(Osmocom__CTRL__Types::tr__CtrlMsgError_id_defval, Osmocom__CTRL__Types::tr__CtrlMsgError_reason_defval), &(rx), any_compref, NULL, NULL, NULL);
if (tmp_2_alt_flag_2 == ALT_YES) {
current_location.update_lineno(71);
/* Osmocom_CTRL_Functions.ttcn, line 71 */
Misc__Helpers::f__shutdown(cs_1, 71, FAIL, (TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Error in CTRL SET "),variable.log(),TTCN_Logger::log_event_str(": "),const_cast< const Osmocom__CTRL__Types::CtrlMessage&>(rx).err().reason().log(),TTCN_Logger::end_event_log2str()));
break;
}
}
if (tmp_2_alt_flag_3 == ALT_MAYBE) {
current_location.update_lineno(74);
/* Osmocom_CTRL_Functions.ttcn, line 74 */
tmp_2_alt_flag_3 = T.timeout(NULL);
if (tmp_2_alt_flag_3 == ALT_YES) {
current_location.update_lineno(75);
/* Osmocom_CTRL_Functions.ttcn, line 75 */
Misc__Helpers::f__shutdown(cs_1, 75, FAIL, (TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Timeout waiting for CTRL SET REPLY "),variable.log(),TTCN_Logger::end_event_log2str()));
break;
}
}
if (tmp_2_default_flag == ALT_MAYBE) {
tmp_2_default_flag = TTCN_Default::try_altsteps();
if (tmp_2_default_flag == ALT_YES || tmp_2_default_flag == ALT_BREAK) break;
else if (tmp_2_default_flag == ALT_REPEAT) goto tmp_2;
}
current_location.update_lineno(67);
/* Osmocom_CTRL_Functions.ttcn, line 67 */
if (tmp_2_alt_flag_0 == ALT_NO && tmp_2_alt_flag_1 == ALT_NO && tmp_2_alt_flag_2 == ALT_NO && tmp_2_alt_flag_3 == ALT_NO && tmp_2_default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in the alt statement in file Osmocom_CTRL_Functions.ttcn between lines 67 and 78.");
TTCN_Snapshot::take_new(TRUE);
}
}
}

void f__ctrl__trap(IPA__Emulation::IPA__CTRL__PT& pt, const CHARSTRING& variable, const CHARSTRING& val)
{
TTCN_Location current_location("Osmocom_CTRL_Functions.ttcn", 82, TTCN_Location::LOCATION_FUNCTION, "f_ctrl_trap");
current_location.update_lineno(83);
/* Osmocom_CTRL_Functions.ttcn, line 83 */
pt.send(Osmocom__CTRL__Types::ts__CtrlMsgTrap(variable, CHARSTRING_template(val)), NULL);
}

CHARSTRING f__ctrl__exp__trap(IPA__Emulation::IPA__CTRL__PT& pt, const CHARSTRING_template& variable, const CHARSTRING_template& val, const FLOAT& timeout__val)
{
TTCN_Location current_location("Osmocom_CTRL_Functions.ttcn", 87, TTCN_Location::LOCATION_FUNCTION, "f_ctrl_exp_trap");
current_location.update_lineno(90);
/* Osmocom_CTRL_Functions.ttcn, line 90 */
TIMER T("T", timeout__val);
current_location.update_lineno(91);
/* Osmocom_CTRL_Functions.ttcn, line 91 */
Osmocom__CTRL__Types::CtrlMessage rx;
current_location.update_lineno(92);
/* Osmocom_CTRL_Functions.ttcn, line 92 */
T.start();
current_location.update_lineno(93);
/* Osmocom_CTRL_Functions.ttcn, line 93 */
{
tmp_3:
alt_status tmp_3_alt_flag_0 = ALT_MAYBE;
alt_status tmp_3_alt_flag_1 = ALT_MAYBE;
alt_status tmp_3_default_flag = ALT_MAYBE;
TTCN_Snapshot::take_new(FALSE);
for ( ; ; ) {
if (tmp_3_alt_flag_0 == ALT_MAYBE) {
current_location.update_lineno(94);
/* Osmocom_CTRL_Functions.ttcn, line 94 */
tmp_3_alt_flag_0 = pt.receive(Osmocom__CTRL__Types::tr__CtrlMsgTrap(variable, val), &(rx), any_compref, NULL, NULL, NULL);
if (tmp_3_alt_flag_0 == ALT_YES) break;
}
if (tmp_3_alt_flag_1 == ALT_MAYBE) {
current_location.update_lineno(96);
/* Osmocom_CTRL_Functions.ttcn, line 96 */
tmp_3_alt_flag_1 = T.timeout(NULL);
if (tmp_3_alt_flag_1 == ALT_YES) {
current_location.update_lineno(97);
/* Osmocom_CTRL_Functions.ttcn, line 97 */
Misc__Helpers::f__shutdown(cs_1, 97, FAIL, (TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Timeout waiting for TRAP "),variable.log(),TTCN_Logger::end_event_log2str()));
break;
}
}
if (tmp_3_default_flag == ALT_MAYBE) {
tmp_3_default_flag = TTCN_Default::try_altsteps();
if (tmp_3_default_flag == ALT_YES || tmp_3_default_flag == ALT_BREAK) break;
else if (tmp_3_default_flag == ALT_REPEAT) goto tmp_3;
}
current_location.update_lineno(93);
/* Osmocom_CTRL_Functions.ttcn, line 93 */
if (tmp_3_alt_flag_0 == ALT_NO && tmp_3_alt_flag_1 == ALT_NO && tmp_3_default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in the alt statement in file Osmocom_CTRL_Functions.ttcn between lines 93 and 100.");
TTCN_Snapshot::take_new(TRUE);
}
}
current_location.update_lineno(101);
/* Osmocom_CTRL_Functions.ttcn, line 101 */
return const_cast< const Osmocom__CTRL__Types::CtrlMessage&>(rx).trap().val();
}

CHARSTRING f__ctrl__exp__set(IPA__Emulation::IPA__CTRL__PT& pt, const CHARSTRING_template& variable, const CHARSTRING_template& val, const CHARSTRING_template& rsp, const FLOAT& timeout__val)
{
TTCN_Location current_location("Osmocom_CTRL_Functions.ttcn", 105, TTCN_Location::LOCATION_FUNCTION, "f_ctrl_exp_set");
current_location.update_lineno(110);
/* Osmocom_CTRL_Functions.ttcn, line 110 */
TIMER T("T", timeout__val);
current_location.update_lineno(111);
/* Osmocom_CTRL_Functions.ttcn, line 111 */
Osmocom__CTRL__Types::CtrlMessage rx;
current_location.update_lineno(112);
/* Osmocom_CTRL_Functions.ttcn, line 112 */
T.start();
current_location.update_lineno(113);
/* Osmocom_CTRL_Functions.ttcn, line 113 */
{
tmp_4:
alt_status tmp_4_alt_flag_0 = ALT_MAYBE;
alt_status tmp_4_alt_flag_1 = ALT_MAYBE;
alt_status tmp_4_default_flag = ALT_MAYBE;
TTCN_Snapshot::take_new(FALSE);
for ( ; ; ) {
if (tmp_4_alt_flag_0 == ALT_MAYBE) {
current_location.update_lineno(114);
/* Osmocom_CTRL_Functions.ttcn, line 114 */
tmp_4_alt_flag_0 = pt.receive(Osmocom__CTRL__Types::tr__CtrlMsgSet(CHARSTRING_template(ANY_VALUE), variable, val), &(rx), any_compref, NULL, NULL, NULL);
if (tmp_4_alt_flag_0 == ALT_YES) {
current_location.update_lineno(115);
/* Osmocom_CTRL_Functions.ttcn, line 115 */
if (rsp.is_present()) {
current_location.update_lineno(116);
/* Osmocom_CTRL_Functions.ttcn, line 116 */
pt.send(Osmocom__CTRL__Types::ts__CtrlMsgSetRepl(const_cast< const Osmocom__CTRL__Types::CtrlMessage&>(rx).cmd().id(), variable.valueof(), rsp.valueof()), NULL);
}
break;
}
}
if (tmp_4_alt_flag_1 == ALT_MAYBE) {
current_location.update_lineno(119);
/* Osmocom_CTRL_Functions.ttcn, line 119 */
tmp_4_alt_flag_1 = T.timeout(NULL);
if (tmp_4_alt_flag_1 == ALT_YES) {
current_location.update_lineno(120);
/* Osmocom_CTRL_Functions.ttcn, line 120 */
Misc__Helpers::f__shutdown(cs_1, 120, FAIL, (TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Timeout waiting for SET "),variable.log(),TTCN_Logger::end_event_log2str()));
break;
}
}
if (tmp_4_default_flag == ALT_MAYBE) {
tmp_4_default_flag = TTCN_Default::try_altsteps();
if (tmp_4_default_flag == ALT_YES || tmp_4_default_flag == ALT_BREAK) break;
else if (tmp_4_default_flag == ALT_REPEAT) goto tmp_4;
}
current_location.update_lineno(113);
/* Osmocom_CTRL_Functions.ttcn, line 113 */
if (tmp_4_alt_flag_0 == ALT_NO && tmp_4_alt_flag_1 == ALT_NO && tmp_4_default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in the alt statement in file Osmocom_CTRL_Functions.ttcn between lines 113 and 123.");
TTCN_Snapshot::take_new(TRUE);
}
}
current_location.update_lineno(124);
/* Osmocom_CTRL_Functions.ttcn, line 124 */
return const_cast< const Osmocom__CTRL__Types::CtrlMessage&>(rx).cmd().val()();
}

void f__ctrl__exp__get(IPA__Emulation::IPA__CTRL__PT& pt, const CHARSTRING_template& variable, const CHARSTRING_template& rsp, const FLOAT& timeout__val)
{
TTCN_Location current_location("Osmocom_CTRL_Functions.ttcn", 128, TTCN_Location::LOCATION_FUNCTION, "f_ctrl_exp_get");
current_location.update_lineno(131);
/* Osmocom_CTRL_Functions.ttcn, line 131 */
TIMER T("T", timeout__val);
current_location.update_lineno(132);
/* Osmocom_CTRL_Functions.ttcn, line 132 */
Osmocom__CTRL__Types::CtrlMessage rx;
current_location.update_lineno(133);
/* Osmocom_CTRL_Functions.ttcn, line 133 */
T.start();
current_location.update_lineno(134);
/* Osmocom_CTRL_Functions.ttcn, line 134 */
{
tmp_5:
alt_status tmp_5_alt_flag_0 = ALT_MAYBE;
alt_status tmp_5_alt_flag_1 = ALT_MAYBE;
alt_status tmp_5_default_flag = ALT_MAYBE;
TTCN_Snapshot::take_new(FALSE);
for ( ; ; ) {
if (tmp_5_alt_flag_0 == ALT_MAYBE) {
current_location.update_lineno(135);
/* Osmocom_CTRL_Functions.ttcn, line 135 */
tmp_5_alt_flag_0 = pt.receive(Osmocom__CTRL__Types::tr__CtrlMsgGet(CHARSTRING_template(ANY_VALUE), variable), &(rx), any_compref, NULL, NULL, NULL);
if (tmp_5_alt_flag_0 == ALT_YES) {
current_location.update_lineno(136);
/* Osmocom_CTRL_Functions.ttcn, line 136 */
if (rsp.is_present()) {
current_location.update_lineno(137);
/* Osmocom_CTRL_Functions.ttcn, line 137 */
pt.send(Osmocom__CTRL__Types::ts__CtrlMsgGetRepl(const_cast< const Osmocom__CTRL__Types::CtrlMessage&>(rx).cmd().id(), variable.valueof(), rsp.valueof()), NULL);
}
break;
}
}
if (tmp_5_alt_flag_1 == ALT_MAYBE) {
current_location.update_lineno(140);
/* Osmocom_CTRL_Functions.ttcn, line 140 */
tmp_5_alt_flag_1 = T.timeout(NULL);
if (tmp_5_alt_flag_1 == ALT_YES) {
current_location.update_lineno(141);
/* Osmocom_CTRL_Functions.ttcn, line 141 */
Misc__Helpers::f__shutdown(cs_1, 141, FAIL, (TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Timeout waiting for GET "),variable.log(),TTCN_Logger::end_event_log2str()));
break;
}
}
if (tmp_5_default_flag == ALT_MAYBE) {
tmp_5_default_flag = TTCN_Default::try_altsteps();
if (tmp_5_default_flag == ALT_YES || tmp_5_default_flag == ALT_BREAK) break;
else if (tmp_5_default_flag == ALT_REPEAT) goto tmp_5;
}
current_location.update_lineno(134);
/* Osmocom_CTRL_Functions.ttcn, line 134 */
if (tmp_5_alt_flag_0 == ALT_NO && tmp_5_alt_flag_1 == ALT_NO && tmp_5_default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in the alt statement in file Osmocom_CTRL_Functions.ttcn between lines 134 and 144.");
TTCN_Snapshot::take_new(TRUE);
}
}
}

void f__ctrl__get__exp(IPA__Emulation::IPA__CTRL__PT& pt, const CHARSTRING& variable, const CHARSTRING_template& exp)
{
TTCN_Location current_location("Osmocom_CTRL_Functions.ttcn", 148, TTCN_Location::LOCATION_FUNCTION, "f_ctrl_get_exp");
current_location.update_lineno(149);
/* Osmocom_CTRL_Functions.ttcn, line 149 */
CHARSTRING ctrl__resp;
current_location.update_lineno(150);
/* Osmocom_CTRL_Functions.ttcn, line 150 */
ctrl__resp = f__ctrl__get(pt, variable, f__ctrl__get_on__err_defval);
current_location.update_lineno(151);
/* Osmocom_CTRL_Functions.ttcn, line 151 */
if ((!(exp.match(ctrl__resp)))) {
current_location.update_lineno(152);
/* Osmocom_CTRL_Functions.ttcn, line 152 */
Misc__Helpers::f__shutdown(cs_1, 152, FAIL, (TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Unexpected "),variable.log(),TTCN_Logger::log_char(':'),ctrl__resp.log(),TTCN_Logger::log_event_str(" vs exp "),exp.log(),TTCN_Logger::end_event_log2str()));
}
}

CHARSTRING_template ts__ctrl__ratectr(const CHARSTRING& grp, const INTEGER& instance, const CHARSTRING& name, const CHARSTRING& kind)
{
TTCN_Location current_location("Osmocom_CTRL_Functions.ttcn", 157, TTCN_Location::LOCATION_TEMPLATE, "ts_ctrl_ratectr");
CHARSTRING_template ret_val;
ret_val = (((((((cs_2 + kind) + cs_3) + grp) + cs_3) + int2str(instance)) + cs_3) + name);
return ret_val;
}

INTEGER f__ctrl__get__ratectr__abs(IPA__Emulation::IPA__CTRL__PT& pt, const CHARSTRING& grp, const INTEGER& instance, const CHARSTRING& name)
{
TTCN_Location current_location("Osmocom_CTRL_Functions.ttcn", 161, TTCN_Location::LOCATION_FUNCTION, "f_ctrl_get_ratectr_abs");
current_location.update_lineno(163);
/* Osmocom_CTRL_Functions.ttcn, line 163 */
return str2int(f__ctrl__get(pt, ts__ctrl__ratectr(grp, instance, name, ts__ctrl__ratectr_kind_defval).valueof(), CHARSTRING_template(cs_5)));
}

void f__ctrl__get__exp__ratectr__abs(IPA__Emulation::IPA__CTRL__PT& pt, const CHARSTRING& grp, const INTEGER& instance, const CHARSTRING& name, const INTEGER_template& exp)
{
TTCN_Location current_location("Osmocom_CTRL_Functions.ttcn", 166, TTCN_Location::LOCATION_FUNCTION, "f_ctrl_get_exp_ratectr_abs");
current_location.update_lineno(168);
/* Osmocom_CTRL_Functions.ttcn, line 168 */
CHARSTRING ctrl__resp;
current_location.update_lineno(169);
/* Osmocom_CTRL_Functions.ttcn, line 169 */
CHARSTRING variable(ts__ctrl__ratectr(grp, instance, name, ts__ctrl__ratectr_kind_defval).valueof());
current_location.update_lineno(170);
/* Osmocom_CTRL_Functions.ttcn, line 170 */
ctrl__resp = f__ctrl__get(pt, variable, f__ctrl__get_on__err_defval);
current_location.update_lineno(171);
/* Osmocom_CTRL_Functions.ttcn, line 171 */
if ((!(exp.match(str2int(ctrl__resp))))) {
current_location.update_lineno(172);
/* Osmocom_CTRL_Functions.ttcn, line 172 */
Misc__Helpers::f__shutdown(cs_1, 172, FAIL, (TTCN_Logger::begin_event_log2str(),(((variable + cs_6) + ctrl__resp) + cs_7).log(),exp.log(),TTCN_Logger::end_event_log2str()));
}
}

boolean operator==(null_type, const CounterNameVals& other_value)
{
if (other_value.val_ptr == NULL)
TTCN_error("The right operand of comparison is an unbound value of type @Osmocom_CTRL_Functions.CounterNameVals.");
return other_value.val_ptr->n_elements == 0;
}

boolean operator==(null_type, const CounterNameValsList& other_value)
{
if (other_value.val_ptr == NULL)
TTCN_error("The right operand of comparison is an unbound value of type @Osmocom_CTRL_Functions.CounterNameValsList.");
return other_value.val_ptr->n_elements == 0;
}

CounterNameVals f__counter__name__vals__get(IPA__Emulation::IPA__CTRL__PT& pt, const CHARSTRING& instance__name, const INTEGER& instance__nr, const CounterNameVals& counternames)
{
TTCN_Location current_location("Osmocom_CTRL_Functions.ttcn", 226, TTCN_Location::LOCATION_FUNCTION, "f_counter_name_vals_get");
current_location.update_lineno(229);
/* Osmocom_CTRL_Functions.ttcn, line 229 */
CounterNameVals vals;
{
current_location.update_lineno(230);
/* Osmocom_CTRL_Functions.ttcn, line 230 */
INTEGER i(0);
current_location.update_lineno(230);
/* Osmocom_CTRL_Functions.ttcn, line 230 */
for ( ; ; ) {
current_location.update_lineno(230);
/* Osmocom_CTRL_Functions.ttcn, line 230 */
if (!(i < counternames.lengthof())) break;
current_location.update_lineno(231);
/* Osmocom_CTRL_Functions.ttcn, line 231 */
{
CounterNameVal& tmp_9 = vals[i]; /* 7388 */
tmp_9.name() = const_cast< const CounterNameVals&>(counternames)[i].name();
tmp_9.val() = f__ctrl__get__ratectr__abs(pt, instance__name, instance__nr, const_cast< const CounterNameVals&>(counternames)[i].name());
}
current_location.update_lineno(230);
/* Osmocom_CTRL_Functions.ttcn, line 230 */
{
INTEGER tmp_10;
++i;
}
}
}
current_location.update_lineno(236);
/* Osmocom_CTRL_Functions.ttcn, line 236 */
return vals;
}

CounterNameValsList f__counter__name__vals__get__n(IPA__Emulation::IPA__CTRL__PT& pt, const CHARSTRING& instance__name, const INTEGER& instance__count, const CounterNameVals& counternames, const INTEGER& start__idx)
{
TTCN_Location current_location("Osmocom_CTRL_Functions.ttcn", 240, TTCN_Location::LOCATION_FUNCTION, "f_counter_name_vals_get_n");
current_location.update_lineno(244);
/* Osmocom_CTRL_Functions.ttcn, line 244 */
CounterNameValsList valslist;
{
current_location.update_lineno(245);
/* Osmocom_CTRL_Functions.ttcn, line 245 */
INTEGER instance__nr(start__idx);
current_location.update_lineno(245);
/* Osmocom_CTRL_Functions.ttcn, line 245 */
for ( ; ; ) {
current_location.update_lineno(245);
/* Osmocom_CTRL_Functions.ttcn, line 245 */
if (!(instance__nr < (start__idx + instance__count))) break;
current_location.update_lineno(246);
/* Osmocom_CTRL_Functions.ttcn, line 246 */
valslist[instance__nr] = f__counter__name__vals__get(pt, instance__name, instance__nr, counternames);
current_location.update_lineno(245);
/* Osmocom_CTRL_Functions.ttcn, line 245 */
{
INTEGER tmp_12;
++instance__nr;
}
}
}
current_location.update_lineno(248);
/* Osmocom_CTRL_Functions.ttcn, line 248 */
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("retrieved rate counters: ");
instance__name.log();
TTCN_Logger::log_event_str(": ");
valslist.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(249);
/* Osmocom_CTRL_Functions.ttcn, line 249 */
return valslist;
}

void f__counter__name__vals__add(CounterNameVals& vals, const CHARSTRING& countername, const INTEGER& val)
{
TTCN_Location current_location("Osmocom_CTRL_Functions.ttcn", 253, TTCN_Location::LOCATION_FUNCTION, "f_counter_name_vals_add");
{
current_location.update_lineno(255);
/* Osmocom_CTRL_Functions.ttcn, line 255 */
INTEGER i(0);
current_location.update_lineno(255);
/* Osmocom_CTRL_Functions.ttcn, line 255 */
for ( ; ; ) {
current_location.update_lineno(255);
/* Osmocom_CTRL_Functions.ttcn, line 255 */
if (!(i < vals.lengthof())) break;
current_location.update_lineno(256);
/* Osmocom_CTRL_Functions.ttcn, line 256 */
if ((const_cast< const CounterNameVals&>(vals)[i].name() == countername)) {
current_location.update_lineno(257);
/* Osmocom_CTRL_Functions.ttcn, line 257 */
{
INTEGER tmp_13;
tmp_13 = (const_cast< const CounterNameVals&>(vals)[i].val() + val);
vals[i].val() = tmp_13;
}
current_location.update_lineno(258);
/* Osmocom_CTRL_Functions.ttcn, line 258 */
return;
}
current_location.update_lineno(255);
/* Osmocom_CTRL_Functions.ttcn, line 255 */
{
INTEGER tmp_14;
++i;
}
}
}
current_location.update_lineno(262);
/* Osmocom_CTRL_Functions.ttcn, line 262 */
{
CounterNameVal& tmp_16 = vals[vals.lengthof()]; /* 7388 */
tmp_16.name() = countername;
tmp_16.val() = val;
}
}

void f__counter__name__vals__set(CounterNameVals& vals, const CHARSTRING& countername, const INTEGER& val)
{
TTCN_Location current_location("Osmocom_CTRL_Functions.ttcn", 269, TTCN_Location::LOCATION_FUNCTION, "f_counter_name_vals_set");
{
current_location.update_lineno(271);
/* Osmocom_CTRL_Functions.ttcn, line 271 */
INTEGER i(0);
current_location.update_lineno(271);
/* Osmocom_CTRL_Functions.ttcn, line 271 */
for ( ; ; ) {
current_location.update_lineno(271);
/* Osmocom_CTRL_Functions.ttcn, line 271 */
if (!(i < vals.lengthof())) break;
current_location.update_lineno(272);
/* Osmocom_CTRL_Functions.ttcn, line 272 */
if ((const_cast< const CounterNameVals&>(vals)[i].name() == countername)) {
current_location.update_lineno(273);
/* Osmocom_CTRL_Functions.ttcn, line 273 */
vals[i].val() = val;
current_location.update_lineno(274);
/* Osmocom_CTRL_Functions.ttcn, line 274 */
return;
}
current_location.update_lineno(271);
/* Osmocom_CTRL_Functions.ttcn, line 271 */
{
INTEGER tmp_18;
++i;
}
}
}
current_location.update_lineno(278);
/* Osmocom_CTRL_Functions.ttcn, line 278 */
{
CounterNameVal& tmp_20 = vals[vals.lengthof()]; /* 7388 */
tmp_20.name() = countername;
tmp_20.val() = val;
}
}

void f__counter__name__vals__list__add(CounterNameValsList& vals, const INTEGER& instance__nr, const CHARSTRING& countername, const INTEGER& val)
{
TTCN_Location current_location("Osmocom_CTRL_Functions.ttcn", 285, TTCN_Location::LOCATION_FUNCTION, "f_counter_name_vals_list_add");
current_location.update_lineno(288);
/* Osmocom_CTRL_Functions.ttcn, line 288 */
f__counter__name__vals__add(vals[instance__nr], countername, val);
}

void f__counter__name__vals__list__set(CounterNameValsList& vals, const INTEGER& instance__nr, const CHARSTRING& countername, const INTEGER& val)
{
TTCN_Location current_location("Osmocom_CTRL_Functions.ttcn", 293, TTCN_Location::LOCATION_FUNCTION, "f_counter_name_vals_list_set");
current_location.update_lineno(296);
/* Osmocom_CTRL_Functions.ttcn, line 296 */
f__counter__name__vals__set(vals[instance__nr], countername, val);
}

CHARSTRING f__counter__val__to__str(const INTEGER& val)
{
TTCN_Location current_location("Osmocom_CTRL_Functions.ttcn", 299, TTCN_Location::LOCATION_FUNCTION, "f_counter_val_to_str");
current_location.update_lineno(301);
/* Osmocom_CTRL_Functions.ttcn, line 301 */
if ((val < 0)) {
current_location.update_lineno(302);
/* Osmocom_CTRL_Functions.ttcn, line 302 */
return cs_9;
}
current_location.update_lineno(304);
/* Osmocom_CTRL_Functions.ttcn, line 304 */
return int2str(val);
}

void f__counter__name__vals__expect(IPA__Emulation::IPA__CTRL__PT& pt, const CHARSTRING& instance__name, const INTEGER& instance__nr, const CounterNameVals& vals)
{
TTCN_Location current_location("Osmocom_CTRL_Functions.ttcn", 309, TTCN_Location::LOCATION_FUNCTION, "f_counter_name_vals_expect");
current_location.update_lineno(311);
/* Osmocom_CTRL_Functions.ttcn, line 311 */
CounterNameVals last(f__counter__name__vals__get(pt, instance__name, instance__nr, vals));
{
current_location.update_lineno(312);
/* Osmocom_CTRL_Functions.ttcn, line 312 */
INTEGER i(0);
current_location.update_lineno(312);
/* Osmocom_CTRL_Functions.ttcn, line 312 */
for ( ; ; ) {
current_location.update_lineno(312);
/* Osmocom_CTRL_Functions.ttcn, line 312 */
if (!(i < vals.lengthof())) break;
current_location.update_lineno(313);
/* Osmocom_CTRL_Functions.ttcn, line 313 */
if ((const_cast< const CounterNameVals&>(last)[i].name() != const_cast< const CounterNameVals&>(vals)[i].name())) {
current_location.update_lineno(314);
/* Osmocom_CTRL_Functions.ttcn, line 314 */
Misc__Helpers::f__shutdown(cs_1, 314, FAIL, cs_10);
}
current_location.update_lineno(316);
/* Osmocom_CTRL_Functions.ttcn, line 316 */
if ((const_cast< const CounterNameVals&>(last)[i].val() != const_cast< const CounterNameVals&>(vals)[i].val())) {
current_location.update_lineno(317);
/* Osmocom_CTRL_Functions.ttcn, line 317 */
Misc__Helpers::f__shutdown(cs_1, 317, FAIL, (((((((((cs_11 + instance__name) + cs_12) + int2str(instance__nr)) + cs_12) + const_cast< const CounterNameVals&>(vals)[i].name()) + cs_13) + f__counter__val__to__str(const_cast< const CounterNameVals&>(last)[i].val())) + cs_14) + f__counter__val__to__str(const_cast< const CounterNameVals&>(vals)[i].val())));
}
current_location.update_lineno(312);
/* Osmocom_CTRL_Functions.ttcn, line 312 */
{
INTEGER tmp_21;
++i;
}
}
}
current_location.update_lineno(323);
/* Osmocom_CTRL_Functions.ttcn, line 323 */
TTCN_Runtime::setverdict(PASS);
}

void f__counter__name__vals__expect__n(IPA__Emulation::IPA__CTRL__PT& pt, const CHARSTRING& instance__name, const CounterNameValsList& valslist)
{
TTCN_Location current_location("Osmocom_CTRL_Functions.ttcn", 328, TTCN_Location::LOCATION_FUNCTION, "f_counter_name_vals_expect_n");
{
current_location.update_lineno(329);
/* Osmocom_CTRL_Functions.ttcn, line 329 */
INTEGER instance__nr(0);
current_location.update_lineno(329);
/* Osmocom_CTRL_Functions.ttcn, line 329 */
for ( ; ; ) {
current_location.update_lineno(329);
/* Osmocom_CTRL_Functions.ttcn, line 329 */
if (!(instance__nr < valslist.lengthof())) break;
current_location.update_lineno(330);
/* Osmocom_CTRL_Functions.ttcn, line 330 */
f__counter__name__vals__expect(pt, instance__name, instance__nr, const_cast< const CounterNameValsList&>(valslist)[instance__nr]);
current_location.update_lineno(329);
/* Osmocom_CTRL_Functions.ttcn, line 329 */
{
INTEGER tmp_22;
++instance__nr;
}
}
}
}

charstring__list f__counter__name__vals__get__changed(IPA__Emulation::IPA__CTRL__PT& pt, const CHARSTRING& instance__name, const INTEGER& instance__nr, const CounterNameVals& vals)
{
TTCN_Location current_location("Osmocom_CTRL_Functions.ttcn", 336, TTCN_Location::LOCATION_FUNCTION, "f_counter_name_vals_get_changed");
current_location.update_lineno(339);
/* Osmocom_CTRL_Functions.ttcn, line 339 */
charstring__list changed(NULL_VALUE);
current_location.update_lineno(340);
/* Osmocom_CTRL_Functions.ttcn, line 340 */
CounterNameVals last(f__counter__name__vals__get(pt, instance__name, instance__nr, vals));
{
current_location.update_lineno(341);
/* Osmocom_CTRL_Functions.ttcn, line 341 */
INTEGER i(0);
current_location.update_lineno(341);
/* Osmocom_CTRL_Functions.ttcn, line 341 */
for ( ; ; ) {
current_location.update_lineno(341);
/* Osmocom_CTRL_Functions.ttcn, line 341 */
if (!(i < vals.lengthof())) break;
current_location.update_lineno(342);
/* Osmocom_CTRL_Functions.ttcn, line 342 */
if ((const_cast< const CounterNameVals&>(last)[i].name() != const_cast< const CounterNameVals&>(vals)[i].name())) {
current_location.update_lineno(343);
/* Osmocom_CTRL_Functions.ttcn, line 343 */
Misc__Helpers::f__shutdown(cs_1, 343, FAIL, cs_10);
}
current_location.update_lineno(345);
/* Osmocom_CTRL_Functions.ttcn, line 345 */
if ((const_cast< const CounterNameVals&>(last)[i].val() != const_cast< const CounterNameVals&>(vals)[i].val())) {
current_location.update_lineno(346);
/* Osmocom_CTRL_Functions.ttcn, line 346 */
{
charstring__list tmp_23;
{
charstring__list tmp_24;
tmp_24.set_size(1);
tmp_24[0] = ((((instance__name + cs_3) + int2str(instance__nr)) + cs_3) + const_cast< const CounterNameVals&>(vals)[i].name());
tmp_23 = (changed + tmp_24);
}
changed = tmp_23;
}
}
current_location.update_lineno(341);
/* Osmocom_CTRL_Functions.ttcn, line 341 */
{
INTEGER tmp_25;
++i;
}
}
}
current_location.update_lineno(349);
/* Osmocom_CTRL_Functions.ttcn, line 349 */
return changed;
}

charstring__list f__counter__name__vals__get__changed__n(IPA__Emulation::IPA__CTRL__PT& pt, const CHARSTRING& instance__name, const CounterNameValsList& valslist)
{
TTCN_Location current_location("Osmocom_CTRL_Functions.ttcn", 354, TTCN_Location::LOCATION_FUNCTION, "f_counter_name_vals_get_changed_n");
current_location.update_lineno(356);
/* Osmocom_CTRL_Functions.ttcn, line 356 */
charstring__list changed(NULL_VALUE);
{
current_location.update_lineno(357);
/* Osmocom_CTRL_Functions.ttcn, line 357 */
INTEGER instance__nr(0);
current_location.update_lineno(357);
/* Osmocom_CTRL_Functions.ttcn, line 357 */
for ( ; ; ) {
current_location.update_lineno(357);
/* Osmocom_CTRL_Functions.ttcn, line 357 */
if (!(instance__nr < valslist.lengthof())) break;
current_location.update_lineno(358);
/* Osmocom_CTRL_Functions.ttcn, line 358 */
{
charstring__list tmp_26;
tmp_26 = (changed + f__counter__name__vals__get__changed(pt, instance__name, instance__nr, const_cast< const CounterNameValsList&>(valslist)[instance__nr]));
changed = tmp_26;
}
current_location.update_lineno(357);
/* Osmocom_CTRL_Functions.ttcn, line 357 */
{
INTEGER tmp_27;
++instance__nr;
}
}
}
current_location.update_lineno(360);
/* Osmocom_CTRL_Functions.ttcn, line 360 */
return changed;
}

void f__counter__name__vals__expect__changed(IPA__Emulation::IPA__CTRL__PT& pt, const CHARSTRING& instance__name, const CounterNameValsList& valslist, const charstring__list& expect__changed)
{
TTCN_Location current_location("Osmocom_CTRL_Functions.ttcn", 363, TTCN_Location::LOCATION_FUNCTION, "f_counter_name_vals_expect_changed");
current_location.update_lineno(365);
/* Osmocom_CTRL_Functions.ttcn, line 365 */
charstring__list changed(f__counter__name__vals__get__changed__n(pt, instance__name, valslist));
current_location.update_lineno(366);
/* Osmocom_CTRL_Functions.ttcn, line 366 */
f__counter__name__vals__expect__changed__list(changed, expect__changed);
}

void f__counter__name__vals__expect__changed__list(const charstring__list& got__list, const charstring__list& expect__list)
{
TTCN_Location current_location("Osmocom_CTRL_Functions.ttcn", 369, TTCN_Location::LOCATION_FUNCTION, "f_counter_name_vals_expect_changed_list");
current_location.update_lineno(370);
/* Osmocom_CTRL_Functions.ttcn, line 370 */
CHARSTRING unexpected__change(cs_15);
{
current_location.update_lineno(371);
/* Osmocom_CTRL_Functions.ttcn, line 371 */
INTEGER i(0);
current_location.update_lineno(371);
/* Osmocom_CTRL_Functions.ttcn, line 371 */
for ( ; ; ) {
current_location.update_lineno(371);
/* Osmocom_CTRL_Functions.ttcn, line 371 */
if (!(i < got__list.lengthof())) break;
current_location.update_lineno(372);
/* Osmocom_CTRL_Functions.ttcn, line 372 */
BOOLEAN found(FALSE);
{
current_location.update_lineno(373);
/* Osmocom_CTRL_Functions.ttcn, line 373 */
INTEGER j(0);
current_location.update_lineno(373);
/* Osmocom_CTRL_Functions.ttcn, line 373 */
for ( ; ; ) {
current_location.update_lineno(373);
/* Osmocom_CTRL_Functions.ttcn, line 373 */
if (!(j < expect__list.lengthof())) break;
current_location.update_lineno(374);
/* Osmocom_CTRL_Functions.ttcn, line 374 */
if ((const_cast< const charstring__list&>(got__list)[i] == const_cast< const charstring__list&>(expect__list)[j])) {
current_location.update_lineno(375);
/* Osmocom_CTRL_Functions.ttcn, line 375 */
found = TRUE;
current_location.update_lineno(376);
/* Osmocom_CTRL_Functions.ttcn, line 376 */
break;
}
current_location.update_lineno(373);
/* Osmocom_CTRL_Functions.ttcn, line 373 */
{
INTEGER tmp_29;
++j;
}
}
}
current_location.update_lineno(379);
/* Osmocom_CTRL_Functions.ttcn, line 379 */
if ((!(found))) {
current_location.update_lineno(380);
/* Osmocom_CTRL_Functions.ttcn, line 380 */
{
CHARSTRING tmp_30;
tmp_30 = ((unexpected__change + cs_12) + const_cast< const charstring__list&>(got__list)[i]);
unexpected__change = tmp_30;
}
}
current_location.update_lineno(371);
/* Osmocom_CTRL_Functions.ttcn, line 371 */
{
INTEGER tmp_31;
++i;
}
}
}
current_location.update_lineno(383);
/* Osmocom_CTRL_Functions.ttcn, line 383 */
CHARSTRING missing__change(cs_15);
{
current_location.update_lineno(384);
/* Osmocom_CTRL_Functions.ttcn, line 384 */
INTEGER i(0);
current_location.update_lineno(384);
/* Osmocom_CTRL_Functions.ttcn, line 384 */
for ( ; ; ) {
current_location.update_lineno(384);
/* Osmocom_CTRL_Functions.ttcn, line 384 */
if (!(i < expect__list.lengthof())) break;
current_location.update_lineno(385);
/* Osmocom_CTRL_Functions.ttcn, line 385 */
BOOLEAN found(FALSE);
{
current_location.update_lineno(386);
/* Osmocom_CTRL_Functions.ttcn, line 386 */
INTEGER j(0);
current_location.update_lineno(386);
/* Osmocom_CTRL_Functions.ttcn, line 386 */
for ( ; ; ) {
current_location.update_lineno(386);
/* Osmocom_CTRL_Functions.ttcn, line 386 */
if (!(j < got__list.lengthof())) break;
current_location.update_lineno(387);
/* Osmocom_CTRL_Functions.ttcn, line 387 */
if ((const_cast< const charstring__list&>(expect__list)[i] == const_cast< const charstring__list&>(got__list)[j])) {
current_location.update_lineno(388);
/* Osmocom_CTRL_Functions.ttcn, line 388 */
found = TRUE;
current_location.update_lineno(389);
/* Osmocom_CTRL_Functions.ttcn, line 389 */
break;
}
current_location.update_lineno(386);
/* Osmocom_CTRL_Functions.ttcn, line 386 */
{
INTEGER tmp_33;
++j;
}
}
}
current_location.update_lineno(392);
/* Osmocom_CTRL_Functions.ttcn, line 392 */
if ((!(found))) {
current_location.update_lineno(393);
/* Osmocom_CTRL_Functions.ttcn, line 393 */
{
CHARSTRING tmp_34;
tmp_34 = ((missing__change + cs_12) + const_cast< const charstring__list&>(expect__list)[i]);
missing__change = tmp_34;
}
}
current_location.update_lineno(384);
/* Osmocom_CTRL_Functions.ttcn, line 384 */
{
INTEGER tmp_35;
++i;
}
}
}
current_location.update_lineno(396);
/* Osmocom_CTRL_Functions.ttcn, line 396 */
CHARSTRING diff(cs_15);
current_location.update_lineno(397);
/* Osmocom_CTRL_Functions.ttcn, line 397 */
if ((unexpected__change.lengthof() > 0)) {
current_location.update_lineno(398);
/* Osmocom_CTRL_Functions.ttcn, line 398 */
{
CHARSTRING tmp_36;
tmp_36 = (((diff + cs_16) + unexpected__change) + cs_17);
diff = tmp_36;
}
}
current_location.update_lineno(400);
/* Osmocom_CTRL_Functions.ttcn, line 400 */
if ((missing__change.lengthof() > 0)) {
current_location.update_lineno(401);
/* Osmocom_CTRL_Functions.ttcn, line 401 */
{
CHARSTRING tmp_37;
tmp_37 = (((diff + cs_18) + missing__change) + cs_17);
diff = tmp_37;
}
}
current_location.update_lineno(403);
/* Osmocom_CTRL_Functions.ttcn, line 403 */
if ((diff.lengthof() > 0)) {
current_location.update_lineno(404);
/* Osmocom_CTRL_Functions.ttcn, line 404 */
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("ERROR\nExpected: ");
expect__list.log();
TTCN_Logger::log_event_str("\nGot: ");
got__list.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(405);
/* Osmocom_CTRL_Functions.ttcn, line 405 */
Misc__Helpers::f__shutdown(cs_1, 405, FAIL, (cs_19 + diff));
}
else {
current_location.update_lineno(408);
/* Osmocom_CTRL_Functions.ttcn, line 408 */
TTCN_Runtime::setverdict(PASS);
}
}


/* Bodies of static functions */

void pre_init_module()
{
TTCN_Location current_location("Osmocom_CTRL_Functions.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "Osmocom_CTRL_Functions");
Misc__Helpers::module_object.pre_init_module();
IPA__Emulation::module_object.pre_init_module();
module_object.add_function("f_gen_rand_id", (genericfunc_t)&f__gen__rand__id, NULL);
module_object.add_function("f_ctrl_get", (genericfunc_t)&f__ctrl__get, NULL);
module_object.add_function("f_ctrl_set", (genericfunc_t)&f__ctrl__set, NULL);
module_object.add_function("f_ctrl_trap", (genericfunc_t)&f__ctrl__trap, NULL);
module_object.add_function("f_ctrl_exp_trap", (genericfunc_t)&f__ctrl__exp__trap, NULL);
module_object.add_function("f_ctrl_exp_set", (genericfunc_t)&f__ctrl__exp__set, NULL);
module_object.add_function("f_ctrl_exp_get", (genericfunc_t)&f__ctrl__exp__get, NULL);
module_object.add_function("f_ctrl_get_exp", (genericfunc_t)&f__ctrl__get__exp, NULL);
module_object.add_function("f_ctrl_get_ratectr_abs", (genericfunc_t)&f__ctrl__get__ratectr__abs, NULL);
module_object.add_function("f_ctrl_get_exp_ratectr_abs", (genericfunc_t)&f__ctrl__get__exp__ratectr__abs, NULL);
module_object.add_function("f_counter_name_vals_get", (genericfunc_t)&f__counter__name__vals__get, NULL);
module_object.add_function("f_counter_name_vals_get_n", (genericfunc_t)&f__counter__name__vals__get__n, NULL);
module_object.add_function("f_counter_name_vals_add", (genericfunc_t)&f__counter__name__vals__add, NULL);
module_object.add_function("f_counter_name_vals_set", (genericfunc_t)&f__counter__name__vals__set, NULL);
module_object.add_function("f_counter_name_vals_list_add", (genericfunc_t)&f__counter__name__vals__list__add, NULL);
module_object.add_function("f_counter_name_vals_list_set", (genericfunc_t)&f__counter__name__vals__list__set, NULL);
module_object.add_function("f_counter_val_to_str", (genericfunc_t)&f__counter__val__to__str, NULL);
module_object.add_function("f_counter_name_vals_expect", (genericfunc_t)&f__counter__name__vals__expect, NULL);
module_object.add_function("f_counter_name_vals_expect_n", (genericfunc_t)&f__counter__name__vals__expect__n, NULL);
module_object.add_function("f_counter_name_vals_get_changed", (genericfunc_t)&f__counter__name__vals__get__changed, NULL);
module_object.add_function("f_counter_name_vals_get_changed_n", (genericfunc_t)&f__counter__name__vals__get__changed__n, NULL);
module_object.add_function("f_counter_name_vals_expect_changed", (genericfunc_t)&f__counter__name__vals__expect__changed, NULL);
module_object.add_function("f_counter_name_vals_expect_changed_list", (genericfunc_t)&f__counter__name__vals__expect__changed__list, NULL);
}

void post_init_module()
{
TTCN_Location current_location("Osmocom_CTRL_Functions.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "Osmocom_CTRL_Functions");
Misc__Helpers::module_object.post_init_module();
IPA__Emulation::module_object.post_init_module();
current_location.update_lineno(34);
/* Osmocom_CTRL_Functions.ttcn, line 34 */
template_f__ctrl__get_on__err_defval = OMIT_VALUE;
current_location.update_lineno(88);
/* Osmocom_CTRL_Functions.ttcn, line 88 */
template_f__ctrl__exp__trap_val_defval = ANY_VALUE;
current_location.update_lineno(88);
/* Osmocom_CTRL_Functions.ttcn, line 88 */
const_f__ctrl__exp__trap_timeout__val_defval = 2.0;
current_location.update_lineno(106);
/* Osmocom_CTRL_Functions.ttcn, line 106 */
template_f__ctrl__exp__set_val_defval = ANY_VALUE;
current_location.update_lineno(107);
/* Osmocom_CTRL_Functions.ttcn, line 107 */
template_f__ctrl__exp__set_rsp_defval = OMIT_VALUE;
current_location.update_lineno(108);
/* Osmocom_CTRL_Functions.ttcn, line 108 */
const_f__ctrl__exp__set_timeout__val_defval = 2.0;
current_location.update_lineno(129);
/* Osmocom_CTRL_Functions.ttcn, line 129 */
template_f__ctrl__exp__get_rsp_defval = OMIT_VALUE;
current_location.update_lineno(130);
/* Osmocom_CTRL_Functions.ttcn, line 130 */
const_f__ctrl__exp__get_timeout__val_defval = 2.0;
current_location.update_lineno(158);
/* Osmocom_CTRL_Functions.ttcn, line 158 */
const_ts__ctrl__ratectr_kind_defval = cs_4;
current_location.update_lineno(240);
/* Osmocom_CTRL_Functions.ttcn, line 240 */
const_f__counter__name__vals__get__n_instance__name_defval = cs_8;
current_location.update_lineno(242);
/* Osmocom_CTRL_Functions.ttcn, line 242 */
const_f__counter__name__vals__get__n_start__idx_defval = 0;
current_location.update_lineno(253);
/* Osmocom_CTRL_Functions.ttcn, line 253 */
const_f__counter__name__vals__add_val_defval = 1;
current_location.update_lineno(269);
/* Osmocom_CTRL_Functions.ttcn, line 269 */
const_f__counter__name__vals__set_val_defval = 1;
current_location.update_lineno(286);
/* Osmocom_CTRL_Functions.ttcn, line 286 */
const_f__counter__name__vals__list__add_val_defval = 1;
current_location.update_lineno(294);
/* Osmocom_CTRL_Functions.ttcn, line 294 */
const_f__counter__name__vals__list__set_val_defval = 0;
}


} /* end of namespace */
