blob: 125aa5c9851e9dfcd345f3e64750f8a16c4cf021 [file] [log] [blame]
// This C++ source file was generated by the TTCN-3 compiler
// of the TTCN-3 Test Executor version CRL 113 200/6 R6A
// for Lénárd Nagy (elnrnag@elx78355y6x) on Thu Oct 24 10:29:40 2019
// Copyright (c) 2000-2019 Ericsson Telecom AB
// Do not edit this file unless you know what you are doing.
/* Including header files */
#include "SocketCANtest.hh"
namespace SocketCANtest {
/* Prototypes of static functions */
static void pre_init_module();
static void post_init_module();
static boolean init_comp_type(const char *component_type, boolean init_base_comps);
static boolean init_system_port(const char* component_type, const char* port_name);
static boolean start_ptc_function(const char *function_name, Text_Buf& function_arguments);
/* Literal string constants */
static const unsigned char module_checksum[] = { 0xb6, 0x43, 0x20, 0x73, 0x85, 0xdb, 0x97, 0xc0, 0xb3, 0x10, 0xa7, 0xb6, 0xb5, 0x9d, 0x7e, 0x65 };
/* Class definitions for internal use */
class alt__awaitPhaseStartReq_Default : public Default_Base {
e__Phase par_p__phase;
public:
alt__awaitPhaseStartReq_Default(const e__Phase& p__phase);
alt_status call_altstep();
};
/* Global variable definitions */
static FLOAT const_c__guard;
const FLOAT& c__guard = const_c__guard;
// No XER for SocketCAN__open__socket__type
const TTCN_Typedescriptor_t SocketCAN__open__socket__type_descr_ = { "@SocketCANtest.SocketCAN_open_socket_type", NULL, NULL, NULL, NULL, &ENUMERATED_json_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
// No XER for e__Phase
const TTCN_Typedescriptor_t e__Phase_descr_ = { "@SocketCANtest.e_Phase", NULL, NULL, NULL, NULL, &ENUMERATED_json_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t SocketCAN__open__raw__result_socket__id_xer_ = { {"socket_id>\n", "socket_id>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t SocketCAN__open__raw__result_socket__id_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t SocketCAN__open__raw__result_socket__id_descr_ = { "@SocketCANtest.SocketCAN_open_raw_result.socket_id", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &SocketCAN__open__raw__result_socket__id_xer_, &INTEGER_json_, &SocketCAN__open__raw__result_socket__id_oer_, NULL, TTCN_Typedescriptor_t::DONTCARE };
// No XER for SocketCAN__open__raw__result
const TTCN_Typedescriptor_t SocketCAN__open__raw__result_descr_ = { "@SocketCANtest.SocketCAN_open_raw_result", NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
// No XER for BCM__cmd
const TTCN_Typedescriptor_t BCM__cmd_descr_ = { "@SocketCANtest.BCM_cmd", NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
// No XER for BCM__cmds
const TTCN_Typedescriptor_t BCM__cmds_descr_ = { "@SocketCANtest.BCM_cmds", NULL, NULL, NULL, NULL, NULL, NULL, &BCM__cmd_descr_, TTCN_Typedescriptor_t::DONTCARE };
// No XER for SocketCAN__CAN__or__CAN__FD__frames
const TTCN_Typedescriptor_t SocketCAN__CAN__or__CAN__FD__frames_descr_ = { "@SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames", NULL, NULL, NULL, NULL, NULL, NULL, &SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame_descr_, TTCN_Typedescriptor_t::DONTCARE };
static e__Phase const_c__firstPhase;
const e__Phase& c__firstPhase = const_c__firstPhase;
static e__Phase const_c__testcase__complete;
const e__Phase& c__testcase__complete = const_c__testcase__complete;
const XERdescriptor_t PhaseStartReq_phase__int_xer_ = { {"phase_int>\n", "phase_int>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t PhaseStartReq_phase__int_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t PhaseStartReq_phase__int_descr_ = { "@SocketCANtest.PhaseStartReq.phase_int", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &PhaseStartReq_phase__int_xer_, &INTEGER_json_, &PhaseStartReq_phase__int_oer_, NULL, TTCN_Typedescriptor_t::DONTCARE };
// No XER for PhaseStartReq
const TTCN_Typedescriptor_t PhaseStartReq_descr_ = { "@SocketCANtest.PhaseStartReq", NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t PhaseEndInd_phase__int_xer_ = { {"phase_int>\n", "phase_int>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t PhaseEndInd_phase__int_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t PhaseEndInd_phase__int_descr_ = { "@SocketCANtest.PhaseEndInd.phase_int", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &PhaseEndInd_phase__int_xer_, &INTEGER_json_, &PhaseEndInd_phase__int_oer_, NULL, TTCN_Typedescriptor_t::DONTCARE };
// No XER for PhaseEndInd
const TTCN_Typedescriptor_t PhaseEndInd_descr_ = { "@SocketCANtest.PhaseEndInd", NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
// No XER for PTCSet
const TTCN_Typedescriptor_t PTCSet_descr_ = { "@SocketCANtest.PTCSet", NULL, NULL, NULL, NULL, NULL, NULL, &COMPONENT_descr_, TTCN_Typedescriptor_t::DONTCARE };
const TTCN_Typedescriptor_t& PTC_descr_ = COMPONENT_descr_;
SyncSlavePort PTC_component_pt__sync("pt_sync");
SocketCAN__PortType::SocketCAN__PT PTC_component_pt__socketCAN("pt_socketCAN");
e__Phase PTC_component_v__phase;
const TTCN_Typedescriptor_t& MTC_descr_ = COMPONENT_descr_;
TIMER MTC_component_t__guard("t_guard");
SyncMasterPort MTC_component_pt__sync("pt_sync");
PTCSet MTC_component_v__PTCSet;
TTCN_Module module_object("SocketCANtest", __DATE__, __TIME__, module_checksum, pre_init_module, NULL, 0U, 4294967295U, 4294967295U, 4294967295U, NULL, 0LU, 0, post_init_module, NULL, NULL, NULL, init_comp_type, init_system_port, start_ptc_function, NULL);
static const RuntimeVersionChecker ver_checker( current_runtime_version.requires_major_version_6,
current_runtime_version.requires_minor_version_6,
current_runtime_version.requires_patch_level_0, current_runtime_version.requires_runtime_1);
/* Member functions of C++ classes */
SocketCAN__open__socket__type::SocketCAN__open__socket__type()
{
enum_value = UNBOUND_VALUE;
}
SocketCAN__open__socket__type::SocketCAN__open__socket__type(int other_value)
{
if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @SocketCANtest.SocketCAN_open_socket_type with invalid numeric value %d.", other_value);
enum_value = (enum_type)other_value;
}
SocketCAN__open__socket__type::SocketCAN__open__socket__type(enum_type other_value)
{
enum_value = other_value;
}
SocketCAN__open__socket__type::SocketCAN__open__socket__type(const SocketCAN__open__socket__type& other_value)
: Base_Type()
{
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @SocketCANtest.SocketCAN_open_socket_type.");
enum_value = other_value.enum_value;
}
SocketCAN__open__socket__type& SocketCAN__open__socket__type::operator=(int other_value)
{
if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @SocketCANtest.SocketCAN_open_socket_type.", other_value);
enum_value = (enum_type)other_value;
return *this;
}
SocketCAN__open__socket__type& SocketCAN__open__socket__type::operator=(enum_type other_value)
{
enum_value = other_value;
return *this;
}
SocketCAN__open__socket__type& SocketCAN__open__socket__type::operator=(const SocketCAN__open__socket__type& other_value)
{
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @SocketCANtest.SocketCAN_open_socket_type.");
enum_value = other_value.enum_value;
return *this;
}
boolean SocketCAN__open__socket__type::operator==(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @SocketCANtest.SocketCAN_open_socket_type.");
return enum_value == other_value;
}
boolean SocketCAN__open__socket__type::operator==(const SocketCAN__open__socket__type& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @SocketCANtest.SocketCAN_open_socket_type.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @SocketCANtest.SocketCAN_open_socket_type.");
return enum_value == other_value.enum_value;
}
boolean SocketCAN__open__socket__type::operator<(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @SocketCANtest.SocketCAN_open_socket_type.");
return enum_value < other_value;
}
boolean SocketCAN__open__socket__type::operator<(const SocketCAN__open__socket__type& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @SocketCANtest.SocketCAN_open_socket_type.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @SocketCANtest.SocketCAN_open_socket_type.");
return enum_value < other_value.enum_value;
}
boolean SocketCAN__open__socket__type::operator>(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @SocketCANtest.SocketCAN_open_socket_type.");
return enum_value > other_value;
}
boolean SocketCAN__open__socket__type::operator>(const SocketCAN__open__socket__type& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @SocketCANtest.SocketCAN_open_socket_type.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @SocketCANtest.SocketCAN_open_socket_type.");
return enum_value > other_value.enum_value;
}
const char *SocketCAN__open__socket__type::enum_to_str(enum_type enum_par)
{
switch (enum_par) {
case OPEN__CAN__RAW: return "OPEN_CAN_RAW";
case OPEN__CAN__BCM: return "OPEN_CAN_BCM";
case OPEN__CAN__ISOTP: return "OPEN_CAN_ISOTP";
default: return "<unknown>";
}
}
SocketCAN__open__socket__type::enum_type SocketCAN__open__socket__type::str_to_enum(const char *str_par)
{
if (!strcmp(str_par, "OPEN_CAN_RAW")) return OPEN__CAN__RAW;
else if (!strcmp(str_par, "OPEN_CAN_BCM")) return OPEN__CAN__BCM;
else if (!strcmp(str_par, "OPEN_CAN_ISOTP")) return OPEN__CAN__ISOTP;
else return UNKNOWN_VALUE;
}
boolean SocketCAN__open__socket__type::is_valid_enum(int int_par)
{
switch (int_par) {
case 0:
case 1:
case 2:
return TRUE;
default:
return FALSE;
}
}
int SocketCAN__open__socket__type::enum2int(enum_type enum_par)
{
if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @SocketCANtest.SocketCAN_open_socket_type.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par;
}
int SocketCAN__open__socket__type::enum2int(const SocketCAN__open__socket__type& enum_par)
{
if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @SocketCANtest.SocketCAN_open_socket_type.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par.enum_value;
}
void SocketCAN__open__socket__type::int2enum(int int_val)
{
if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @SocketCANtest.SocketCAN_open_socket_type.", int_val);
enum_value = (enum_type)int_val;
}
SocketCAN__open__socket__type::operator SocketCAN__open__socket__type::enum_type() const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @SocketCANtest.SocketCAN_open_socket_type.");
return enum_value;
}
void SocketCAN__open__socket__type::log() const
{
if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value);
else TTCN_Logger::log_event_unbound();
}
void SocketCAN__open__socket__type::set_param(Module_Param& param)
{
param.basic_check(Module_Param::BC_VALUE, "enumerated value");
if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@SocketCANtest.SocketCAN_open_socket_type");
enum_value = str_to_enum(param.get_enumerated());
if (!is_valid_enum(enum_value)) {
param.error("Invalid enumerated value for type @SocketCANtest.SocketCAN_open_socket_type.");
}
}
void SocketCAN__open__socket__type::encode_text(Text_Buf& text_buf) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @SocketCANtest.SocketCAN_open_socket_type.");
text_buf.push_int(enum_value);
}
void SocketCAN__open__socket__type::decode_text(Text_Buf& text_buf)
{
enum_value = (enum_type)text_buf.pull_int().get_val();
if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @SocketCANtest.SocketCAN_open_socket_type.", enum_value);
}
void SocketCAN__open__socket__type_template::copy_template(const SocketCAN__open__socket__type_template& other_value)
{
set_selection(other_value);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = other_value.single_value;
break;
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new SocketCAN__open__socket__type_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;
default:
TTCN_error("Copying an uninitialized/unsupported template of enumerated type @SocketCANtest.SocketCAN_open_socket_type.");
}
}
SocketCAN__open__socket__type_template::SocketCAN__open__socket__type_template()
{
}
SocketCAN__open__socket__type_template::SocketCAN__open__socket__type_template(template_sel other_value)
: Base_Template(other_value)
{
check_single_selection(other_value);
}
SocketCAN__open__socket__type_template::SocketCAN__open__socket__type_template(int other_value)
: Base_Template(SPECIFIC_VALUE)
{
if (!SocketCAN__open__socket__type::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @SocketCANtest.SocketCAN_open_socket_type with unknown numeric value %d.", other_value);
single_value = (SocketCAN__open__socket__type::enum_type)other_value;
}
SocketCAN__open__socket__type_template::SocketCAN__open__socket__type_template(SocketCAN__open__socket__type::enum_type other_value)
: Base_Template(SPECIFIC_VALUE)
{
single_value = other_value;
}
SocketCAN__open__socket__type_template::SocketCAN__open__socket__type_template(const SocketCAN__open__socket__type& other_value)
: Base_Template(SPECIFIC_VALUE)
{
if (other_value.enum_value == SocketCAN__open__socket__type::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @SocketCANtest.SocketCAN_open_socket_type.");
single_value = other_value.enum_value;
}
SocketCAN__open__socket__type_template::SocketCAN__open__socket__type_template(const OPTIONAL<SocketCAN__open__socket__type>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (SocketCAN__open__socket__type::enum_type)(const SocketCAN__open__socket__type&)other_value;
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of enumerated type @SocketCANtest.SocketCAN_open_socket_type from an unbound optional field.");
}
}
SocketCAN__open__socket__type_template::SocketCAN__open__socket__type_template(const SocketCAN__open__socket__type_template& other_value)
: Base_Template()
{
copy_template(other_value);
}
SocketCAN__open__socket__type_template::~SocketCAN__open__socket__type_template()
{
clean_up();
}
boolean SocketCAN__open__socket__type_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
return TRUE;
}
boolean SocketCAN__open__socket__type_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value != SocketCAN__open__socket__type::UNBOUND_VALUE;
}
void SocketCAN__open__socket__type_template::clean_up()
{
if (template_selection == VALUE_LIST || template_selection == COMPLEMENTED_LIST) delete [] value_list.list_value;
template_selection = UNINITIALIZED_TEMPLATE;
}
SocketCAN__open__socket__type_template& SocketCAN__open__socket__type_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}
SocketCAN__open__socket__type_template& SocketCAN__open__socket__type_template::operator=(int other_value)
{
if (!SocketCAN__open__socket__type::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @SocketCANtest.SocketCAN_open_socket_type.", other_value);
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = (SocketCAN__open__socket__type::enum_type)other_value;
return *this;
}
SocketCAN__open__socket__type_template& SocketCAN__open__socket__type_template::operator=(SocketCAN__open__socket__type::enum_type other_value)
{
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = other_value;
return *this;
}
SocketCAN__open__socket__type_template& SocketCAN__open__socket__type_template::operator=(const SocketCAN__open__socket__type& other_value)
{
if (other_value.enum_value == SocketCAN__open__socket__type::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @SocketCANtest.SocketCAN_open_socket_type to a template.");
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = other_value.enum_value;
return *this;
}
SocketCAN__open__socket__type_template& SocketCAN__open__socket__type_template::operator=(const OPTIONAL<SocketCAN__open__socket__type>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (SocketCAN__open__socket__type::enum_type)(const SocketCAN__open__socket__type&)other_value;
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of enumerated type @SocketCANtest.SocketCAN_open_socket_type.");
}
return *this;
}
SocketCAN__open__socket__type_template& SocketCAN__open__socket__type_template::operator=(const SocketCAN__open__socket__type_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}
boolean SocketCAN__open__socket__type_template::match(SocketCAN__open__socket__type::enum_type other_value, boolean) const
{
switch (template_selection) {
case SPECIFIC_VALUE:
return single_value == other_value;
case OMIT_VALUE:
return FALSE;
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
default:
TTCN_error("Matching an uninitialized/unsupported template of enumerated type @SocketCANtest.SocketCAN_open_socket_type.");
}
return FALSE;
}
boolean SocketCAN__open__socket__type_template::match(const SocketCAN__open__socket__type& other_value, boolean) const
{
if (other_value.enum_value == SocketCAN__open__socket__type::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @SocketCANtest.SocketCAN_open_socket_type with an unbound value.");
return match(other_value.enum_value);
}
SocketCAN__open__socket__type::enum_type SocketCAN__open__socket__type_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @SocketCANtest.SocketCAN_open_socket_type.");
return single_value;
}
void SocketCAN__open__socket__type_template::set_type(template_sel template_type, unsigned int list_length)
{
if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST) TTCN_error("Setting an invalid list type for a template of enumerated type @SocketCANtest.SocketCAN_open_socket_type.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new SocketCAN__open__socket__type_template[list_length];
}
SocketCAN__open__socket__type_template& SocketCAN__open__socket__type_template::list_item(unsigned int list_index)
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST) TTCN_error("Accessing a list element in a non-list template of enumerated type @SocketCANtest.SocketCAN_open_socket_type.");
if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @SocketCANtest.SocketCAN_open_socket_type.");
return value_list.list_value[list_index];
}
void SocketCAN__open__socket__type_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_enum(SocketCAN__open__socket__type::enum_to_str(single_value), single_value);
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) {
if (elem_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[elem_count].log();
}
TTCN_Logger::log_char(')');
break;
default:
log_generic();
}
log_ifpresent();
}
void SocketCAN__open__socket__type_template::log_match(const SocketCAN__open__socket__type& match_value, boolean) const
{
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
void SocketCAN__open__socket__type_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
text_buf.push_int(single_value);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
text_buf.push_int(value_list.n_values);
for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++)
value_list.list_value[elem_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @SocketCANtest.SocketCAN_open_socket_type.");
}
}
void SocketCAN__open__socket__type_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = (SocketCAN__open__socket__type::enum_type)text_buf.pull_int().get_val();
if (!SocketCAN__open__socket__type::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @SocketCANtest.SocketCAN_open_socket_type.", single_value);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new SocketCAN__open__socket__type_template[value_list.n_values];
for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++)
value_list.list_value[elem_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @SocketCANtest.SocketCAN_open_socket_type.");
}
}
boolean SocketCAN__open__socket__type_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}
boolean SocketCAN__open__socket__type_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
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 SocketCAN__open__socket__type_template::set_param(Module_Param& param)
{
param.basic_check(Module_Param::BC_TEMPLATE, "enumerated template");
Module_Param_Ptr m_p = &param;
switch (m_p->get_type()) {
case Module_Param::MP_Omit:
*this = OMIT_VALUE;
break;
case Module_Param::MP_Any:
*this = ANY_VALUE;
break;
case Module_Param::MP_AnyOrNone:
*this = ANY_OR_OMIT;
break;
case Module_Param::MP_List_Template:
case Module_Param::MP_ComplementList_Template: {
SocketCAN__open__socket__type_template new_temp;
new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : COMPLEMENTED_LIST, m_p->get_size());
for (size_t p_i=0; p_i<m_p->get_size(); p_i++) {
new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i));
}
*this = new_temp;
break; }
case Module_Param::MP_Enumerated: {
SocketCAN__open__socket__type::enum_type enum_val = SocketCAN__open__socket__type::str_to_enum(m_p->get_enumerated());
if (!SocketCAN__open__socket__type::is_valid_enum(enum_val)) {
param.error("Invalid enumerated value for type @SocketCANtest.SocketCAN_open_socket_type.");
}
*this = enum_val;
} break;
default:
param.type_error("enumerated template", "@SocketCANtest.SocketCAN_open_socket_type");
}
is_ifpresent = param.get_ifpresent();
}
void SocketCAN__open__socket__type_template::check_restriction(template_res t_res, const char* t_name,
boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_VALUE:
if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return;
break;
case TR_OMIT:
if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return;
break;
case TR_PRESENT:
if (!match_omit(legacy)) return;
break;
default:
return;
}
TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@SocketCANtest.SocketCAN_open_socket_type");
}
e__Phase::e__Phase()
{
enum_value = UNBOUND_VALUE;
}
e__Phase::e__Phase(int other_value)
{
if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @SocketCANtest.e_Phase with invalid numeric value %d.", other_value);
enum_value = (enum_type)other_value;
}
e__Phase::e__Phase(enum_type other_value)
{
enum_value = other_value;
}
e__Phase::e__Phase(const e__Phase& other_value)
: Base_Type()
{
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @SocketCANtest.e_Phase.");
enum_value = other_value.enum_value;
}
e__Phase& e__Phase::operator=(int other_value)
{
if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @SocketCANtest.e_Phase.", other_value);
enum_value = (enum_type)other_value;
return *this;
}
e__Phase& e__Phase::operator=(enum_type other_value)
{
enum_value = other_value;
return *this;
}
e__Phase& e__Phase::operator=(const e__Phase& other_value)
{
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @SocketCANtest.e_Phase.");
enum_value = other_value.enum_value;
return *this;
}
boolean e__Phase::operator==(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @SocketCANtest.e_Phase.");
return enum_value == other_value;
}
boolean e__Phase::operator==(const e__Phase& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @SocketCANtest.e_Phase.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @SocketCANtest.e_Phase.");
return enum_value == other_value.enum_value;
}
boolean e__Phase::operator<(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @SocketCANtest.e_Phase.");
return enum_value < other_value;
}
boolean e__Phase::operator<(const e__Phase& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @SocketCANtest.e_Phase.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @SocketCANtest.e_Phase.");
return enum_value < other_value.enum_value;
}
boolean e__Phase::operator>(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @SocketCANtest.e_Phase.");
return enum_value > other_value;
}
boolean e__Phase::operator>(const e__Phase& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @SocketCANtest.e_Phase.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @SocketCANtest.e_Phase.");
return enum_value > other_value.enum_value;
}
const char *e__Phase::enum_to_str(enum_type enum_par)
{
switch (enum_par) {
case e__open__socket: return "e_open_socket";
case e__testbody1: return "e_testbody1";
case e__testbody2: return "e_testbody2";
case e__testbody3: return "e_testbody3";
case e__testbody4: return "e_testbody4";
case e__testbody5: return "e_testbody5";
case e__testbody6: return "e_testbody6";
case e__testbody7: return "e_testbody7";
case e__testbodyEnd: return "e_testbodyEnd";
case e__close__socket: return "e_close_socket";
case e__testcase__complete: return "e_testcase_complete";
default: return "<unknown>";
}
}
e__Phase::enum_type e__Phase::str_to_enum(const char *str_par)
{
if (!strcmp(str_par, "e_open_socket")) return e__open__socket;
else if (!strcmp(str_par, "e_testbody1")) return e__testbody1;
else if (!strcmp(str_par, "e_testbody2")) return e__testbody2;
else if (!strcmp(str_par, "e_testbody3")) return e__testbody3;
else if (!strcmp(str_par, "e_testbody4")) return e__testbody4;
else if (!strcmp(str_par, "e_testbody5")) return e__testbody5;
else if (!strcmp(str_par, "e_testbody6")) return e__testbody6;
else if (!strcmp(str_par, "e_testbody7")) return e__testbody7;
else if (!strcmp(str_par, "e_testbodyEnd")) return e__testbodyEnd;
else if (!strcmp(str_par, "e_close_socket")) return e__close__socket;
else if (!strcmp(str_par, "e_testcase_complete")) return e__testcase__complete;
else return UNKNOWN_VALUE;
}
boolean e__Phase::is_valid_enum(int int_par)
{
switch (int_par) {
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
return TRUE;
default:
return FALSE;
}
}
int e__Phase::enum2int(enum_type enum_par)
{
if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @SocketCANtest.e_Phase.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par;
}
int e__Phase::enum2int(const e__Phase& enum_par)
{
if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @SocketCANtest.e_Phase.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par.enum_value;
}
void e__Phase::int2enum(int int_val)
{
if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @SocketCANtest.e_Phase.", int_val);
enum_value = (enum_type)int_val;
}
e__Phase::operator e__Phase::enum_type() const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @SocketCANtest.e_Phase.");
return enum_value;
}
void e__Phase::log() const
{
if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value);
else TTCN_Logger::log_event_unbound();
}
void e__Phase::set_param(Module_Param& param)
{
param.basic_check(Module_Param::BC_VALUE, "enumerated value");
if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@SocketCANtest.e_Phase");
enum_value = str_to_enum(param.get_enumerated());
if (!is_valid_enum(enum_value)) {
param.error("Invalid enumerated value for type @SocketCANtest.e_Phase.");
}
}
void e__Phase::encode_text(Text_Buf& text_buf) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @SocketCANtest.e_Phase.");
text_buf.push_int(enum_value);
}
void e__Phase::decode_text(Text_Buf& text_buf)
{
enum_value = (enum_type)text_buf.pull_int().get_val();
if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @SocketCANtest.e_Phase.", enum_value);
}
void e__Phase_template::copy_template(const e__Phase_template& other_value)
{
set_selection(other_value);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = other_value.single_value;
break;
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new e__Phase_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;
default:
TTCN_error("Copying an uninitialized/unsupported template of enumerated type @SocketCANtest.e_Phase.");
}
}
e__Phase_template::e__Phase_template()
{
}
e__Phase_template::e__Phase_template(template_sel other_value)
: Base_Template(other_value)
{
check_single_selection(other_value);
}
e__Phase_template::e__Phase_template(int other_value)
: Base_Template(SPECIFIC_VALUE)
{
if (!e__Phase::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @SocketCANtest.e_Phase with unknown numeric value %d.", other_value);
single_value = (e__Phase::enum_type)other_value;
}
e__Phase_template::e__Phase_template(e__Phase::enum_type other_value)
: Base_Template(SPECIFIC_VALUE)
{
single_value = other_value;
}
e__Phase_template::e__Phase_template(const e__Phase& other_value)
: Base_Template(SPECIFIC_VALUE)
{
if (other_value.enum_value == e__Phase::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @SocketCANtest.e_Phase.");
single_value = other_value.enum_value;
}
e__Phase_template::e__Phase_template(const OPTIONAL<e__Phase>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (e__Phase::enum_type)(const e__Phase&)other_value;
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of enumerated type @SocketCANtest.e_Phase from an unbound optional field.");
}
}
e__Phase_template::e__Phase_template(const e__Phase_template& other_value)
: Base_Template()
{
copy_template(other_value);
}
e__Phase_template::~e__Phase_template()
{
clean_up();
}
boolean e__Phase_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
return TRUE;
}
boolean e__Phase_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value != e__Phase::UNBOUND_VALUE;
}
void e__Phase_template::clean_up()
{
if (template_selection == VALUE_LIST || template_selection == COMPLEMENTED_LIST) delete [] value_list.list_value;
template_selection = UNINITIALIZED_TEMPLATE;
}
e__Phase_template& e__Phase_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}
e__Phase_template& e__Phase_template::operator=(int other_value)
{
if (!e__Phase::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @SocketCANtest.e_Phase.", other_value);
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = (e__Phase::enum_type)other_value;
return *this;
}
e__Phase_template& e__Phase_template::operator=(e__Phase::enum_type other_value)
{
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = other_value;
return *this;
}
e__Phase_template& e__Phase_template::operator=(const e__Phase& other_value)
{
if (other_value.enum_value == e__Phase::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @SocketCANtest.e_Phase to a template.");
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = other_value.enum_value;
return *this;
}
e__Phase_template& e__Phase_template::operator=(const OPTIONAL<e__Phase>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (e__Phase::enum_type)(const e__Phase&)other_value;
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of enumerated type @SocketCANtest.e_Phase.");
}
return *this;
}
e__Phase_template& e__Phase_template::operator=(const e__Phase_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}
boolean e__Phase_template::match(e__Phase::enum_type other_value, boolean) const
{
switch (template_selection) {
case SPECIFIC_VALUE:
return single_value == other_value;
case OMIT_VALUE:
return FALSE;
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
default:
TTCN_error("Matching an uninitialized/unsupported template of enumerated type @SocketCANtest.e_Phase.");
}
return FALSE;
}
boolean e__Phase_template::match(const e__Phase& other_value, boolean) const
{
if (other_value.enum_value == e__Phase::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @SocketCANtest.e_Phase with an unbound value.");
return match(other_value.enum_value);
}
e__Phase::enum_type e__Phase_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @SocketCANtest.e_Phase.");
return single_value;
}
void e__Phase_template::set_type(template_sel template_type, unsigned int list_length)
{
if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST) TTCN_error("Setting an invalid list type for a template of enumerated type @SocketCANtest.e_Phase.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new e__Phase_template[list_length];
}
e__Phase_template& e__Phase_template::list_item(unsigned int list_index)
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST) TTCN_error("Accessing a list element in a non-list template of enumerated type @SocketCANtest.e_Phase.");
if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @SocketCANtest.e_Phase.");
return value_list.list_value[list_index];
}
void e__Phase_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_enum(e__Phase::enum_to_str(single_value), single_value);
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) {
if (elem_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[elem_count].log();
}
TTCN_Logger::log_char(')');
break;
default:
log_generic();
}
log_ifpresent();
}
void e__Phase_template::log_match(const e__Phase& match_value, boolean) const
{
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
void e__Phase_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
text_buf.push_int(single_value);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
text_buf.push_int(value_list.n_values);
for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++)
value_list.list_value[elem_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @SocketCANtest.e_Phase.");
}
}
void e__Phase_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = (e__Phase::enum_type)text_buf.pull_int().get_val();
if (!e__Phase::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @SocketCANtest.e_Phase.", single_value);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new e__Phase_template[value_list.n_values];
for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++)
value_list.list_value[elem_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @SocketCANtest.e_Phase.");
}
}
boolean e__Phase_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}
boolean e__Phase_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
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 e__Phase_template::set_param(Module_Param& param)
{
param.basic_check(Module_Param::BC_TEMPLATE, "enumerated template");
Module_Param_Ptr m_p = &param;
switch (m_p->get_type()) {
case Module_Param::MP_Omit:
*this = OMIT_VALUE;
break;
case Module_Param::MP_Any:
*this = ANY_VALUE;
break;
case Module_Param::MP_AnyOrNone:
*this = ANY_OR_OMIT;
break;
case Module_Param::MP_List_Template:
case Module_Param::MP_ComplementList_Template: {
e__Phase_template new_temp;
new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : COMPLEMENTED_LIST, m_p->get_size());
for (size_t p_i=0; p_i<m_p->get_size(); p_i++) {
new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i));
}
*this = new_temp;
break; }
case Module_Param::MP_Enumerated: {
e__Phase::enum_type enum_val = e__Phase::str_to_enum(m_p->get_enumerated());
if (!e__Phase::is_valid_enum(enum_val)) {
param.error("Invalid enumerated value for type @SocketCANtest.e_Phase.");
}
*this = enum_val;
} break;
default:
param.type_error("enumerated template", "@SocketCANtest.e_Phase");
}
is_ifpresent = param.get_ifpresent();
}
void e__Phase_template::check_restriction(template_res t_res, const char* t_name,
boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_VALUE:
if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return;
break;
case TR_OMIT:
if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return;
break;
case TR_PRESENT:
if (!match_omit(legacy)) return;
break;
default:
return;
}
TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@SocketCANtest.e_Phase");
}
SocketCAN__open__raw__result::SocketCAN__open__raw__result()
{
}
SocketCAN__open__raw__result::SocketCAN__open__raw__result(const SocketCAN__Types::SocketCAN__ifr& par_ifr,
const INTEGER& par_socket__id)
: field_ifr(par_ifr),
field_socket__id(par_socket__id)
{
}
SocketCAN__open__raw__result::SocketCAN__open__raw__result(const SocketCAN__open__raw__result& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @SocketCANtest.SocketCAN_open_raw_result.");
if (other_value.ifr().is_bound()) field_ifr = other_value.ifr();
else field_ifr.clean_up();
if (other_value.socket__id().is_bound()) field_socket__id = other_value.socket__id();
else field_socket__id.clean_up();
}
void SocketCAN__open__raw__result::clean_up()
{
field_ifr.clean_up();
field_socket__id.clean_up();
}
const TTCN_Typedescriptor_t* SocketCAN__open__raw__result::get_descriptor() const { return &SocketCAN__open__raw__result_descr_; }
SocketCAN__open__raw__result& SocketCAN__open__raw__result::operator=(const SocketCAN__open__raw__result& other_value)
{
if (this != &other_value) {
if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @SocketCANtest.SocketCAN_open_raw_result.");
if (other_value.ifr().is_bound()) field_ifr = other_value.ifr();
else field_ifr.clean_up();
if (other_value.socket__id().is_bound()) field_socket__id = other_value.socket__id();
else field_socket__id.clean_up();
}
return *this;
}
boolean SocketCAN__open__raw__result::operator==(const SocketCAN__open__raw__result& other_value) const
{
return field_ifr==other_value.field_ifr
&& field_socket__id==other_value.field_socket__id;
}
boolean SocketCAN__open__raw__result::is_bound() const
{
return (field_ifr.is_bound())
|| (field_socket__id.is_bound());
}
boolean SocketCAN__open__raw__result::is_value() const
{
return field_ifr.is_value()
&& field_socket__id.is_value();
}
void SocketCAN__open__raw__result::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ ifr := ");
field_ifr.log();
TTCN_Logger::log_event_str(", socket_id := ");
field_socket__id.log();
TTCN_Logger::log_event_str(" }");
}
void SocketCAN__open__raw__result::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 @SocketCANtest.SocketCAN_open_raw_result 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) ifr().set_param(*param.get_elem(0));
if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) socket__id().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(), "ifr")) {
if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
ifr().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(), "socket_id")) {
if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
socket__id().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 @SocketCANtest.SocketCAN_open_raw_result: %s", curr_param->get_id()->get_name());
break;
}
} break;
default:
param.type_error("record value", "@SocketCANtest.SocketCAN_open_raw_result");
}
}
void SocketCAN__open__raw__result::set_implicit_omit()
{
if (ifr().is_bound()) ifr().set_implicit_omit();
if (socket__id().is_bound()) socket__id().set_implicit_omit();
}
void SocketCAN__open__raw__result::encode_text(Text_Buf& text_buf) const
{
field_ifr.encode_text(text_buf);
field_socket__id.encode_text(text_buf);
}
void SocketCAN__open__raw__result::decode_text(Text_Buf& text_buf)
{
field_ifr.decode_text(text_buf);
field_socket__id.decode_text(text_buf);
}
struct SocketCAN__open__raw__result_template::single_value_struct {
SocketCAN__Types::SocketCAN__ifr_template field_ifr;
INTEGER_template field_socket__id;
};
void SocketCAN__open__raw__result_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_ifr = ANY_VALUE;
single_value->field_socket__id = ANY_VALUE;
}
}
}
void SocketCAN__open__raw__result_template::copy_value(const SocketCAN__open__raw__result& other_value)
{
single_value = new single_value_struct;
if (other_value.ifr().is_bound()) {
single_value->field_ifr = other_value.ifr();
} else {
single_value->field_ifr.clean_up();
}
if (other_value.socket__id().is_bound()) {
single_value->field_socket__id = other_value.socket__id();
} else {
single_value->field_socket__id.clean_up();
}
set_selection(SPECIFIC_VALUE);
}
void SocketCAN__open__raw__result_template::copy_template(const SocketCAN__open__raw__result_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.ifr().get_selection()) {
single_value->field_ifr = other_value.ifr();
} else {
single_value->field_ifr.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.socket__id().get_selection()) {
single_value->field_socket__id = other_value.socket__id();
} else {
single_value->field_socket__id.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new SocketCAN__open__raw__result_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;
default:
TTCN_error("Copying an uninitialized/unsupported template of type @SocketCANtest.SocketCAN_open_raw_result.");
break;
}
set_selection(other_value);
}
SocketCAN__open__raw__result_template::SocketCAN__open__raw__result_template()
{
}
SocketCAN__open__raw__result_template::SocketCAN__open__raw__result_template(template_sel other_value)
: Base_Template(other_value)
{
check_single_selection(other_value);
}
SocketCAN__open__raw__result_template::SocketCAN__open__raw__result_template(const SocketCAN__open__raw__result& other_value)
{
copy_value(other_value);
}
SocketCAN__open__raw__result_template::SocketCAN__open__raw__result_template(const OPTIONAL<SocketCAN__open__raw__result>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const SocketCAN__open__raw__result&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of type @SocketCANtest.SocketCAN_open_raw_result from an unbound optional field.");
}
}
SocketCAN__open__raw__result_template::SocketCAN__open__raw__result_template(const SocketCAN__open__raw__result_template& other_value)
: Base_Template()
{
copy_template(other_value);
}
SocketCAN__open__raw__result_template::~SocketCAN__open__raw__result_template()
{
clean_up();
}
SocketCAN__open__raw__result_template& SocketCAN__open__raw__result_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}
SocketCAN__open__raw__result_template& SocketCAN__open__raw__result_template::operator=(const SocketCAN__open__raw__result& other_value)
{
clean_up();
copy_value(other_value);
return *this;
}
SocketCAN__open__raw__result_template& SocketCAN__open__raw__result_template::operator=(const OPTIONAL<SocketCAN__open__raw__result>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const SocketCAN__open__raw__result&)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 @SocketCANtest.SocketCAN_open_raw_result.");
}
return *this;
}
SocketCAN__open__raw__result_template& SocketCAN__open__raw__result_template::operator=(const SocketCAN__open__raw__result_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}
boolean SocketCAN__open__raw__result_template::match(const SocketCAN__open__raw__result& 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.ifr().is_bound()) return FALSE;
if(!single_value->field_ifr.match(other_value.ifr(), legacy))return FALSE;
if(!other_value.socket__id().is_bound()) return FALSE;
if(!single_value->field_socket__id.match(other_value.socket__id(), 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;
default:
TTCN_error("Matching an uninitialized/unsupported template of type @SocketCANtest.SocketCAN_open_raw_result.");
}
return FALSE;
}
boolean SocketCAN__open__raw__result_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_ifr.is_bound()
||single_value->field_socket__id.is_bound()
;
}
boolean SocketCAN__open__raw__result_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_ifr.is_value()
&&single_value->field_socket__id.is_value();
}
void SocketCAN__open__raw__result_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
delete single_value;
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
delete [] value_list.list_value;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}
SocketCAN__open__raw__result SocketCAN__open__raw__result_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 @SocketCANtest.SocketCAN_open_raw_result.");
SocketCAN__open__raw__result ret_val;
if (single_value->field_ifr.is_bound()) {
ret_val.ifr() = single_value->field_ifr.valueof();
}
if (single_value->field_socket__id.is_bound()) {
ret_val.socket__id() = single_value->field_socket__id.valueof();
}
return ret_val;
}
void SocketCAN__open__raw__result_template::set_type(template_sel template_type, unsigned int list_length)
{
if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST)
TTCN_error("Setting an invalid list for a template of type @SocketCANtest.SocketCAN_open_raw_result.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new SocketCAN__open__raw__result_template[list_length];
}
SocketCAN__open__raw__result_template& SocketCAN__open__raw__result_template::list_item(unsigned int list_index) const
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST)
TTCN_error("Accessing a list element of a non-list template of type @SocketCANtest.SocketCAN_open_raw_result.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @SocketCANtest.SocketCAN_open_raw_result.");
return value_list.list_value[list_index];
}
SocketCAN__Types::SocketCAN__ifr_template& SocketCAN__open__raw__result_template::ifr()
{
set_specific();
return single_value->field_ifr;
}
const SocketCAN__Types::SocketCAN__ifr_template& SocketCAN__open__raw__result_template::ifr() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ifr of a non-specific template of type @SocketCANtest.SocketCAN_open_raw_result.");
return single_value->field_ifr;
}
INTEGER_template& SocketCAN__open__raw__result_template::socket__id()
{
set_specific();
return single_value->field_socket__id;
}
const INTEGER_template& SocketCAN__open__raw__result_template::socket__id() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field socket_id of a non-specific template of type @SocketCANtest.SocketCAN_open_raw_result.");
return single_value->field_socket__id;
}
int SocketCAN__open__raw__result_template::size_of() const
{
if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @SocketCANtest.SocketCAN_open_raw_result 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 @SocketCANtest.SocketCAN_open_raw_result 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 @SocketCANtest.SocketCAN_open_raw_result containing a value list with different sizes.");
}
return item_size;
}
case OMIT_VALUE:
TTCN_error("Performing sizeof() operation on a template of type @SocketCANtest.SocketCAN_open_raw_result containing omit value.");
case ANY_VALUE:
case ANY_OR_OMIT:
TTCN_error("Performing sizeof() operation on a template of type @SocketCANtest.SocketCAN_open_raw_result containing */? value.");
case COMPLEMENTED_LIST:
TTCN_error("Performing sizeof() operation on a template of type @SocketCANtest.SocketCAN_open_raw_result containing complemented list.");
default:
TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @SocketCANtest.SocketCAN_open_raw_result.");
}
return 0;
}
void SocketCAN__open__raw__result_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ ifr := ");
single_value->field_ifr.log();
TTCN_Logger::log_event_str(", socket_id := ");
single_value->field_socket__id.log();
TTCN_Logger::log_event_str(" }");
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
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;
default:
log_generic();
}
log_ifpresent();
}
void SocketCAN__open__raw__result_template::log_match(const SocketCAN__open__raw__result& 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_ifr.match(match_value.ifr(), legacy)){
TTCN_Logger::log_logmatch_info(".ifr");
single_value->field_ifr.log_match(match_value.ifr(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_socket__id.match(match_value.socket__id(), legacy)){
TTCN_Logger::log_logmatch_info(".socket_id");
single_value->field_socket__id.log_match(match_value.socket__id(), 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("{ ifr := ");
single_value->field_ifr.log_match(match_value.ifr(), legacy);
TTCN_Logger::log_event_str(", socket_id := ");
single_value->field_socket__id.log_match(match_value.socket__id(), 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 SocketCAN__open__raw__result_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_ifr.encode_text(text_buf);
single_value->field_socket__id.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 @SocketCANtest.SocketCAN_open_raw_result.");
}
}
void SocketCAN__open__raw__result_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_ifr.decode_text(text_buf);
single_value->field_socket__id.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 SocketCAN__open__raw__result_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 @SocketCANtest.SocketCAN_open_raw_result.");
}
}
void SocketCAN__open__raw__result_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: {
SocketCAN__open__raw__result_template new_temp;
new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : COMPLEMENTED_LIST, param.get_size());
for (size_t p_i=0; p_i<param.get_size(); p_i++) {
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 @SocketCANtest.SocketCAN_open_raw_result 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) ifr().set_param(*param.get_elem(0));
if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) socket__id().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(), "ifr")) {
if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
ifr().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(), "socket_id")) {
if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
socket__id().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 @SocketCANtest.SocketCAN_open_raw_result: %s", curr_param->get_id()->get_name());
break;
}
} break;
default:
param.type_error("record template", "@SocketCANtest.SocketCAN_open_raw_result");
}
is_ifpresent = param.get_ifpresent();
}
void SocketCAN__open__raw__result_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_ifr.check_restriction(t_res, t_name ? t_name : "@SocketCANtest.SocketCAN_open_raw_result");
single_value->field_socket__id.check_restriction(t_res, t_name ? t_name : "@SocketCANtest.SocketCAN_open_raw_result");
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 : "@SocketCANtest.SocketCAN_open_raw_result");
}
boolean SocketCAN__open__raw__result_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}
boolean SocketCAN__open__raw__result_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
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;
}
BCM__cmd::BCM__cmd()
{
}
BCM__cmd::BCM__cmd(const e__Phase& par_phase,
const Bcm::SocketCAN__bcm__frame& par_bcm__frame)
: field_phase(par_phase),
field_bcm__frame(par_bcm__frame)
{
}
BCM__cmd::BCM__cmd(const BCM__cmd& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @SocketCANtest.BCM_cmd.");
if (other_value.phase().is_bound()) field_phase = other_value.phase();
else field_phase.clean_up();
if (other_value.bcm__frame().is_bound()) field_bcm__frame = other_value.bcm__frame();
else field_bcm__frame.clean_up();
}
void BCM__cmd::clean_up()
{
field_phase.clean_up();
field_bcm__frame.clean_up();
}
const TTCN_Typedescriptor_t* BCM__cmd::get_descriptor() const { return &BCM__cmd_descr_; }
BCM__cmd& BCM__cmd::operator=(const BCM__cmd& other_value)
{
if (this != &other_value) {
if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @SocketCANtest.BCM_cmd.");
if (other_value.phase().is_bound()) field_phase = other_value.phase();
else field_phase.clean_up();
if (other_value.bcm__frame().is_bound()) field_bcm__frame = other_value.bcm__frame();
else field_bcm__frame.clean_up();
}
return *this;
}
boolean BCM__cmd::operator==(const BCM__cmd& other_value) const
{
return field_phase==other_value.field_phase
&& field_bcm__frame==other_value.field_bcm__frame;
}
boolean BCM__cmd::is_bound() const
{
return (field_phase.is_bound())
|| (field_bcm__frame.is_bound());
}
boolean BCM__cmd::is_value() const
{
return field_phase.is_value()
&& field_bcm__frame.is_value();
}
void BCM__cmd::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ phase := ");
field_phase.log();
TTCN_Logger::log_event_str(", bcm_frame := ");
field_bcm__frame.log();
TTCN_Logger::log_event_str(" }");
}
void BCM__cmd::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 @SocketCANtest.BCM_cmd 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) phase().set_param(*param.get_elem(0));
if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) bcm__frame().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(), "phase")) {
if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
phase().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(), "bcm_frame")) {
if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
bcm__frame().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 @SocketCANtest.BCM_cmd: %s", curr_param->get_id()->get_name());
break;
}
} break;
default:
param.type_error("record value", "@SocketCANtest.BCM_cmd");
}
}
void BCM__cmd::set_implicit_omit()
{
if (phase().is_bound()) phase().set_implicit_omit();
if (bcm__frame().is_bound()) bcm__frame().set_implicit_omit();
}
void BCM__cmd::encode_text(Text_Buf& text_buf) const
{
field_phase.encode_text(text_buf);
field_bcm__frame.encode_text(text_buf);
}
void BCM__cmd::decode_text(Text_Buf& text_buf)
{
field_phase.decode_text(text_buf);
field_bcm__frame.decode_text(text_buf);
}
struct BCM__cmd_template::single_value_struct {
e__Phase_template field_phase;
Bcm::SocketCAN__bcm__frame_template field_bcm__frame;
};
void BCM__cmd_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_phase = ANY_VALUE;
single_value->field_bcm__frame = ANY_VALUE;
}
}
}
void BCM__cmd_template::copy_value(const BCM__cmd& other_value)
{
single_value = new single_value_struct;
if (other_value.phase().is_bound()) {
single_value->field_phase = other_value.phase();
} else {
single_value->field_phase.clean_up();
}
if (other_value.bcm__frame().is_bound()) {
single_value->field_bcm__frame = other_value.bcm__frame();
} else {
single_value->field_bcm__frame.clean_up();
}
set_selection(SPECIFIC_VALUE);
}
void BCM__cmd_template::copy_template(const BCM__cmd_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.phase().get_selection()) {
single_value->field_phase = other_value.phase();
} else {
single_value->field_phase.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.bcm__frame().get_selection()) {
single_value->field_bcm__frame = other_value.bcm__frame();
} else {
single_value->field_bcm__frame.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new BCM__cmd_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;
default:
TTCN_error("Copying an uninitialized/unsupported template of type @SocketCANtest.BCM_cmd.");
break;
}
set_selection(other_value);
}
BCM__cmd_template::BCM__cmd_template()
{
}
BCM__cmd_template::BCM__cmd_template(template_sel other_value)
: Base_Template(other_value)
{
check_single_selection(other_value);
}
BCM__cmd_template::BCM__cmd_template(const BCM__cmd& other_value)
{
copy_value(other_value);
}
BCM__cmd_template::BCM__cmd_template(const OPTIONAL<BCM__cmd>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const BCM__cmd&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of type @SocketCANtest.BCM_cmd from an unbound optional field.");
}
}
BCM__cmd_template::BCM__cmd_template(const BCM__cmd_template& other_value)
: Base_Template()
{
copy_template(other_value);
}
BCM__cmd_template::~BCM__cmd_template()
{
clean_up();
}
BCM__cmd_template& BCM__cmd_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}
BCM__cmd_template& BCM__cmd_template::operator=(const BCM__cmd& other_value)
{
clean_up();
copy_value(other_value);
return *this;
}
BCM__cmd_template& BCM__cmd_template::operator=(const OPTIONAL<BCM__cmd>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const BCM__cmd&)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 @SocketCANtest.BCM_cmd.");
}
return *this;
}
BCM__cmd_template& BCM__cmd_template::operator=(const BCM__cmd_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}
boolean BCM__cmd_template::match(const BCM__cmd& 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.phase().is_bound()) return FALSE;
if(!single_value->field_phase.match(other_value.phase(), legacy))return FALSE;
if(!other_value.bcm__frame().is_bound()) return FALSE;
if(!single_value->field_bcm__frame.match(other_value.bcm__frame(), 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;
default:
TTCN_error("Matching an uninitialized/unsupported template of type @SocketCANtest.BCM_cmd.");
}
return FALSE;
}
boolean BCM__cmd_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_phase.is_bound()
||single_value->field_bcm__frame.is_bound()
;
}
boolean BCM__cmd_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_phase.is_value()
&&single_value->field_bcm__frame.is_value();
}
void BCM__cmd_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
delete single_value;
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
delete [] value_list.list_value;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}
BCM__cmd BCM__cmd_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 @SocketCANtest.BCM_cmd.");
BCM__cmd ret_val;
if (single_value->field_phase.is_bound()) {
ret_val.phase() = single_value->field_phase.valueof();
}
if (single_value->field_bcm__frame.is_bound()) {
ret_val.bcm__frame() = single_value->field_bcm__frame.valueof();
}
return ret_val;
}
void BCM__cmd_template::set_type(template_sel template_type, unsigned int list_length)
{
if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST)
TTCN_error("Setting an invalid list for a template of type @SocketCANtest.BCM_cmd.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new BCM__cmd_template[list_length];
}
BCM__cmd_template& BCM__cmd_template::list_item(unsigned int list_index) const
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST)
TTCN_error("Accessing a list element of a non-list template of type @SocketCANtest.BCM_cmd.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @SocketCANtest.BCM_cmd.");
return value_list.list_value[list_index];
}
e__Phase_template& BCM__cmd_template::phase()
{
set_specific();
return single_value->field_phase;
}
const e__Phase_template& BCM__cmd_template::phase() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field phase of a non-specific template of type @SocketCANtest.BCM_cmd.");
return single_value->field_phase;
}
Bcm::SocketCAN__bcm__frame_template& BCM__cmd_template::bcm__frame()
{
set_specific();
return single_value->field_bcm__frame;
}
const Bcm::SocketCAN__bcm__frame_template& BCM__cmd_template::bcm__frame() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field bcm_frame of a non-specific template of type @SocketCANtest.BCM_cmd.");
return single_value->field_bcm__frame;
}
int BCM__cmd_template::size_of() const
{
if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @SocketCANtest.BCM_cmd 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 @SocketCANtest.BCM_cmd 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 @SocketCANtest.BCM_cmd containing a value list with different sizes.");
}
return item_size;
}
case OMIT_VALUE:
TTCN_error("Performing sizeof() operation on a template of type @SocketCANtest.BCM_cmd containing omit value.");
case ANY_VALUE:
case ANY_OR_OMIT:
TTCN_error("Performing sizeof() operation on a template of type @SocketCANtest.BCM_cmd containing */? value.");
case COMPLEMENTED_LIST:
TTCN_error("Performing sizeof() operation on a template of type @SocketCANtest.BCM_cmd containing complemented list.");
default:
TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @SocketCANtest.BCM_cmd.");
}
return 0;
}
void BCM__cmd_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ phase := ");
single_value->field_phase.log();
TTCN_Logger::log_event_str(", bcm_frame := ");
single_value->field_bcm__frame.log();
TTCN_Logger::log_event_str(" }");
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
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;
default:
log_generic();
}
log_ifpresent();
}
void BCM__cmd_template::log_match(const BCM__cmd& 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_phase.match(match_value.phase(), legacy)){
TTCN_Logger::log_logmatch_info(".phase");
single_value->field_phase.log_match(match_value.phase(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_bcm__frame.match(match_value.bcm__frame(), legacy)){
TTCN_Logger::log_logmatch_info(".bcm_frame");
single_value->field_bcm__frame.log_match(match_value.bcm__frame(), 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("{ phase := ");
single_value->field_phase.log_match(match_value.phase(), legacy);
TTCN_Logger::log_event_str(", bcm_frame := ");
single_value->field_bcm__frame.log_match(match_value.bcm__frame(), 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 BCM__cmd_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_phase.encode_text(text_buf);
single_value->field_bcm__frame.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 @SocketCANtest.BCM_cmd.");
}
}
void BCM__cmd_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_phase.decode_text(text_buf);
single_value->field_bcm__frame.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 BCM__cmd_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 @SocketCANtest.BCM_cmd.");
}
}
void BCM__cmd_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: {
BCM__cmd_template new_temp;
new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : COMPLEMENTED_LIST, param.get_size());
for (size_t p_i=0; p_i<param.get_size(); p_i++) {
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 @SocketCANtest.BCM_cmd 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) phase().set_param(*param.get_elem(0));
if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) bcm__frame().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(), "phase")) {
if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
phase().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(), "bcm_frame")) {
if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
bcm__frame().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 @SocketCANtest.BCM_cmd: %s", curr_param->get_id()->get_name());
break;
}
} break;
default:
param.type_error("record template", "@SocketCANtest.BCM_cmd");
}
is_ifpresent = param.get_ifpresent();
}
void BCM__cmd_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_phase.check_restriction(t_res, t_name ? t_name : "@SocketCANtest.BCM_cmd");
single_value->field_bcm__frame.check_restriction(t_res, t_name ? t_name : "@SocketCANtest.BCM_cmd");
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 : "@SocketCANtest.BCM_cmd");
}
boolean BCM__cmd_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}
boolean BCM__cmd_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
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 BCM__cmd BCM__cmds::UNBOUND_ELEM;
BCM__cmds::BCM__cmds()
{
val_ptr = NULL;
}
BCM__cmds::BCM__cmds(null_type)
{
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = 0;
val_ptr->value_elements = NULL;
}
BCM__cmds::BCM__cmds(const BCM__cmds& other_value)
{
if (!other_value.is_bound()) TTCN_error("Copying an unbound value of type @SocketCANtest.BCM_cmds.");
val_ptr = other_value.val_ptr;
val_ptr->ref_count++;
}
BCM__cmds::~BCM__cmds()
{
clean_up();
if (val_ptr != NULL) val_ptr = NULL;
}
void BCM__cmds::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.");
}
}
BCM__cmds& BCM__cmds::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;
}
BCM__cmds& BCM__cmds::operator=(const BCM__cmds& other_value)
{
if (other_value.val_ptr == NULL) TTCN_error("Assigning an unbound value of type @SocketCANtest.BCM_cmds.");
if (this != &other_value) {
clean_up();
val_ptr = other_value.val_ptr;
val_ptr->ref_count++;
}
return *this;
}
boolean BCM__cmds::operator==(null_type) const
{
if (val_ptr == NULL)
TTCN_error("The left operand of comparison is an unbound value of type @SocketCANtest.BCM_cmds.");
return val_ptr->n_elements == 0 ;
}
boolean BCM__cmds::operator==(const BCM__cmds& other_value) const
{
if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @SocketCANtest.BCM_cmds.");
if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @SocketCANtest.BCM_cmds.");
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;
}
BCM__cmd& BCM__cmds::operator[](int index_value)
{
if (index_value < 0) TTCN_error("Accessing an element of type @SocketCANtest.BCM_cmds 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 = (BCM__cmd**)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 BCM__cmd(*(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 BCM__cmd;
}
return *val_ptr->value_elements[index_value];
}
BCM__cmd& BCM__cmds::operator[](const INTEGER& index_value)
{
index_value.must_bound("Using an unbound integer value for indexing a value of type @SocketCANtest.BCM_cmds.");
return (*this)[(int)index_value];
}
const BCM__cmd& BCM__cmds::operator[](int index_value) const
{
if (val_ptr == NULL)
TTCN_error("Accessing an element in an unbound value of type @SocketCANtest.BCM_cmds.");
if (index_value < 0) TTCN_error("Accessing an element of type @SocketCANtest.BCM_cmds using a negative index: %d.", index_value);
if (index_value >= val_ptr->n_elements) TTCN_error("Index overflow in a value of type @SocketCANtest.BCM_cmds: 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 BCM__cmd& BCM__cmds::operator[](const INTEGER& index_value) const
{
index_value.must_bound("Using an unbound integer value for indexing a value of type @SocketCANtest.BCM_cmds.");
return (*this)[(int)index_value];
}
BCM__cmds BCM__cmds::operator<<=(int rotate_count) const
{
return *this >>= (-rotate_count);
}
BCM__cmds BCM__cmds::operator<<=(const INTEGER& rotate_count) const
{
rotate_count.must_bound("Unbound integer operand of rotate left operator.");
return *this >>= (int)(-rotate_count);
}
BCM__cmds BCM__cmds::operator>>=(const INTEGER& rotate_count) const
{
rotate_count.must_bound("Unbound integer operand of rotate right operator.");
return *this >>= (int)rotate_count;
}
BCM__cmds BCM__cmds::operator>>=(int rotate_count) const
{
if (val_ptr == NULL) TTCN_error("Performing rotation operation on an unbound value of type @SocketCANtest.BCM_cmds.");
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;
BCM__cmds 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 BCM__cmd(*val_ptr->value_elements[i]);
}
}
return ret_val;
}
BCM__cmds BCM__cmds::operator+(const BCM__cmds& other_value) const
{
if (val_ptr == NULL || other_value.val_ptr == NULL) TTCN_error("Unbound operand of @SocketCANtest.BCM_cmds concatenation.");
if (val_ptr->n_elements == 0) return other_value;
if (other_value.val_ptr->n_elements == 0) return *this;
BCM__cmds 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 BCM__cmd(*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 BCM__cmd(*other_value.val_ptr->value_elements[i]);
}
}
return ret_val;
}
BCM__cmds BCM__cmds::substr(int index, int returncount) const
{
if (val_ptr == NULL) TTCN_error("The first argument of substr() is an unbound value of type @SocketCANtest.BCM_cmds.");
check_substr_arguments(val_ptr->n_elements, index, returncount, "@SocketCANtest.BCM_cmds","element");
BCM__cmds 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 BCM__cmd(*val_ptr->value_elements[i+index]);
}
}
return ret_val;
}
BCM__cmds BCM__cmds::replace(int index, int len, const BCM__cmds& repl) const
{
if (val_ptr == NULL) TTCN_error("The first argument of replace() is an unbound value of type @SocketCANtest.BCM_cmds.");
if (repl.val_ptr == NULL) TTCN_error("The fourth argument of replace() is an unbound value of type @SocketCANtest.BCM_cmds.");
check_replace_arguments(val_ptr->n_elements, index, len, "@SocketCANtest.BCM_cmds","element");
BCM__cmds 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 BCM__cmd(*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 BCM__cmd(*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 BCM__cmd(*val_ptr->value_elements[index+i+len]);
}
}
return ret_val;
}
BCM__cmds BCM__cmds::replace(int index, int len, const BCM__cmds_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 BCM__cmds::set_size(int new_size)
{
if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a value of type @SocketCANtest.BCM_cmds.");
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 = (BCM__cmd**)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 BCM__cmd(*(val_ptr->value_elements[elem_count]));
}
}
clean_up();
val_ptr = new_val_ptr;
}
if (new_size > val_ptr->n_elements) {
val_ptr->value_elements = (BCM__cmd**)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 @SocketCANtest.BCM_cmds: %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 = (BCM__cmd**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size);
val_ptr->n_elements = new_size;
}
}
boolean BCM__cmds::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 BCM__cmds::size_of() const
{
if (val_ptr == NULL) TTCN_error("Performing sizeof operation on an unbound value of type @SocketCANtest.BCM_cmds.");
return val_ptr->n_elements;
}
int BCM__cmds::lengthof() const
{
if (val_ptr == NULL) TTCN_error("Performing lengthof operation on an unbound value of type @SocketCANtest.BCM_cmds.");
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 BCM__cmds::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 BCM__cmds::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", "@SocketCANtest.BCM_cmds");
}
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", "@SocketCANtest.BCM_cmds");
}
break;
default:
TTCN_error("Internal error: Unknown operation type.");
}
}
void BCM__cmds::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 BCM__cmds::encode_text(Text_Buf& text_buf) const
{
if (val_ptr == NULL) TTCN_error("Text encoder: Encoding an unbound value of type @SocketCANtest.BCM_cmds.");
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 BCM__cmds::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 @SocketCANtest.BCM_cmds.");
val_ptr->value_elements = (BCM__cmd**)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 BCM__cmd;
val_ptr->value_elements[elem_count]->decode_text(text_buf);
}
}
void BCM__cmds_template::copy_value(const BCM__cmds& other_value)
{
if (!other_value.is_bound()) TTCN_error("Initialization of a template of type @SocketCANtest.BCM_cmds with an unbound value.");
single_value.n_elements = other_value.size_of();
single_value.value_elements = (BCM__cmd_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 BCM__cmd_template(other_value[elem_count]);
} else {
single_value.value_elements[elem_count] = new BCM__cmd_template;
}
}
set_selection(SPECIFIC_VALUE);
}
void BCM__cmds_template::copy_template(const BCM__cmds_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 = (BCM__cmd_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 BCM__cmd_template(*other_value.single_value.value_elements[elem_count]);
} else {
single_value.value_elements[elem_count] = new BCM__cmd_template;
}
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new BCM__cmds_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;
default:
TTCN_error("Copying an uninitialized/unsupported template of type @SocketCANtest.BCM_cmds.");
break;
}
set_selection(other_value);
}
boolean BCM__cmds_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 BCM__cmds_template*)template_ptr)->single_value.value_elements[template_index]->match((*(const BCM__cmds*)value_ptr)[value_index], legacy);
else return ((const BCM__cmds_template*)template_ptr)->single_value.value_elements[template_index]->is_any_or_omit();
}
BCM__cmds_template::BCM__cmds_template()
{
}
BCM__cmds_template::BCM__cmds_template(template_sel other_value)
: Record_Of_Template(other_value)
{
check_single_selection(other_value);
}
BCM__cmds_template::BCM__cmds_template(null_type)
: Record_Of_Template(SPECIFIC_VALUE)
{
single_value.n_elements = 0;
single_value.value_elements = NULL;
}
BCM__cmds_template::BCM__cmds_template(const BCM__cmds& other_value)
{
copy_value(other_value);
}
BCM__cmds_template::BCM__cmds_template(const OPTIONAL<BCM__cmds>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const BCM__cmds&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of type @SocketCANtest.BCM_cmds from an unbound optional field.");
}
}
BCM__cmds_template::BCM__cmds_template(const BCM__cmds_template& other_value)
: Record_Of_Template()
{
copy_template(other_value);
}
BCM__cmds_template::~BCM__cmds_template()
{
clean_up();
}
void BCM__cmds_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:
delete [] value_list.list_value;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}
BCM__cmds_template& BCM__cmds_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}
BCM__cmds_template& BCM__cmds_template::operator=(null_type)
{
clean_up();
set_selection(SPECIFIC_VALUE);
single_value.n_elements = 0;
single_value.value_elements = NULL;
return *this;
}
BCM__cmds_template& BCM__cmds_template::operator=(const BCM__cmds& other_value)
{
clean_up();
copy_value(other_value);
return *this;
}
BCM__cmds_template& BCM__cmds_template::operator=(const OPTIONAL<BCM__cmds>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const BCM__cmds&)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 @SocketCANtest.BCM_cmds.");
}
return *this;
}
BCM__cmds_template& BCM__cmds_template::operator=(const BCM__cmds_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}
BCM__cmd_template& BCM__cmds_template::operator[](int index_value)
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @SocketCANtest.BCM_cmds 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 @SocketCANtest.BCM_cmds.");
break;
}
return *single_value.value_elements[index_value];
}
BCM__cmd_template& BCM__cmds_template::operator[](const INTEGER& index_value)
{
index_value.must_bound("Using an unbound integer value for indexing a template of type @SocketCANtest.BCM_cmds.");
return (*this)[(int)index_value];
}
const BCM__cmd_template& BCM__cmds_template::operator[](int index_value) const
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @SocketCANtest.BCM_cmds using a negative index: %d.", index_value);
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing an element of a non-specific template for type @SocketCANtest.BCM_cmds.");
if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @SocketCANtest.BCM_cmds: 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 BCM__cmd_template& BCM__cmds_template::operator[](const INTEGER& index_value) const
{
index_value.must_bound("Using an unbound integer value for indexing a template of type @SocketCANtest.BCM_cmds.");
return (*this)[(int)index_value];
}
void BCM__cmds_template::set_size(int new_size)
{
if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a template of type @SocketCANtest.BCM_cmds.");
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 = (BCM__cmd_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 BCM__cmd_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 BCM__cmd_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 = (BCM__cmd_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size);
single_value.n_elements = new_size;
}
}
int BCM__cmds_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 BCM__cmds_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 @SocketCANtest.BCM_cmds 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 @SocketCANtest.BCM_cmds 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 @SocketCANtest.BCM_cmds 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 @SocketCANtest.BCM_cmds 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 @SocketCANtest.BCM_cmds 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 @SocketCANtest.BCM_cmds containing complemented list.", op_name);
default:
TTCN_error("Performing %sof() operation on an uninitialized/unsupported template of type @SocketCANtest.BCM_cmds.", op_name);
}
return check_section_is_single(min_size, has_any_or_none, op_name, "a", "template of type @SocketCANtest.BCM_cmds");
}
boolean BCM__cmds_template::match(const BCM__cmds& 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;
default:
TTCN_error("Matching with an uninitialized/unsupported template of type @SocketCANtest.BCM_cmds.");
}
return FALSE;
}
boolean BCM__cmds_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;
}
BCM__cmds BCM__cmds_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 @SocketCANtest.BCM_cmds.");
BCM__cmds 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;
}
BCM__cmds BCM__cmds_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);
}
BCM__cmds BCM__cmds_template::replace(int index, int len, const BCM__cmds_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());
}
BCM__cmds BCM__cmds_template::replace(int index, int len, const BCM__cmds& 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 BCM__cmds_template::set_type(template_sel template_type, unsigned int list_length)
{
clean_up();
switch (template_type) {
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = list_length;
value_list.list_value = new BCM__cmds_template[list_length];
break;
default:
TTCN_error("Internal error: Setting an invalid type for a template of type @SocketCANtest.BCM_cmds.");
}
set_selection(template_type);
}
BCM__cmds_template& BCM__cmds_template::list_item(unsigned int list_index)
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST) TTCN_error("Internal error: Accessing a list element of a non-list template of type @SocketCANtest.BCM_cmds.");
if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of type @SocketCANtest.BCM_cmds.");
return value_list.list_value[list_index];
}
void BCM__cmds_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 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;
default:
log_generic();
}
log_restricted();
log_ifpresent();
}
void BCM__cmds_template::log_match(const BCM__cmds& 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 BCM__cmds_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 @SocketCANtest.BCM_cmds.");
}
}
void BCM__cmds_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 @SocketCANtest.BCM_cmds.");
single_value.value_elements = (BCM__cmd_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 BCM__cmd_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 BCM__cmds_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 @SocketCANtest.BCM_cmds.");
}
}
boolean BCM__cmds_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}
boolean BCM__cmds_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
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 BCM__cmds_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: {
BCM__cmds_template temp;
temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : COMPLEMENTED_LIST, param.get_size());
for (size_t p_i=0; p_i<param.get_size(); p_i++) {
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;
default:
param.type_error("record of template", "@SocketCANtest.BCM_cmds");
}
is_ifpresent = param.get_ifpresent();
set_length_range(param);
}
void BCM__cmds_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 : "@SocketCANtest.BCM_cmds");
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 : "@SocketCANtest.BCM_cmds");
}
boolean BCM__cmds_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 SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame SocketCAN__CAN__or__CAN__FD__frames::UNBOUND_ELEM;
SocketCAN__CAN__or__CAN__FD__frames::SocketCAN__CAN__or__CAN__FD__frames()
{
val_ptr = NULL;
}
SocketCAN__CAN__or__CAN__FD__frames::SocketCAN__CAN__or__CAN__FD__frames(null_type)
{
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = 0;
val_ptr->value_elements = NULL;
}
SocketCAN__CAN__or__CAN__FD__frames::SocketCAN__CAN__or__CAN__FD__frames(const SocketCAN__CAN__or__CAN__FD__frames& other_value)
{
if (!other_value.is_bound()) TTCN_error("Copying an unbound value of type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames.");
val_ptr = other_value.val_ptr;
val_ptr->ref_count++;
}
SocketCAN__CAN__or__CAN__FD__frames::~SocketCAN__CAN__or__CAN__FD__frames()
{
clean_up();
if (val_ptr != NULL) val_ptr = NULL;
}
void SocketCAN__CAN__or__CAN__FD__frames::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.");
}
}
SocketCAN__CAN__or__CAN__FD__frames& SocketCAN__CAN__or__CAN__FD__frames::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;
}
SocketCAN__CAN__or__CAN__FD__frames& SocketCAN__CAN__or__CAN__FD__frames::operator=(const SocketCAN__CAN__or__CAN__FD__frames& other_value)
{
if (other_value.val_ptr == NULL) TTCN_error("Assigning an unbound value of type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames.");
if (this != &other_value) {
clean_up();
val_ptr = other_value.val_ptr;
val_ptr->ref_count++;
}
return *this;
}
boolean SocketCAN__CAN__or__CAN__FD__frames::operator==(null_type) const
{
if (val_ptr == NULL)
TTCN_error("The left operand of comparison is an unbound value of type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames.");
return val_ptr->n_elements == 0 ;
}
boolean SocketCAN__CAN__or__CAN__FD__frames::operator==(const SocketCAN__CAN__or__CAN__FD__frames& other_value) const
{
if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames.");
if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames.");
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;
}
SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame& SocketCAN__CAN__or__CAN__FD__frames::operator[](int index_value)
{
if (index_value < 0) TTCN_error("Accessing an element of type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames 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 = (SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame**)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 SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame(*(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 SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame;
}
return *val_ptr->value_elements[index_value];
}
SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame& SocketCAN__CAN__or__CAN__FD__frames::operator[](const INTEGER& index_value)
{
index_value.must_bound("Using an unbound integer value for indexing a value of type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames.");
return (*this)[(int)index_value];
}
const SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame& SocketCAN__CAN__or__CAN__FD__frames::operator[](int index_value) const
{
if (val_ptr == NULL)
TTCN_error("Accessing an element in an unbound value of type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames.");
if (index_value < 0) TTCN_error("Accessing an element of type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames using a negative index: %d.", index_value);
if (index_value >= val_ptr->n_elements) TTCN_error("Index overflow in a value of type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames: 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 SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame& SocketCAN__CAN__or__CAN__FD__frames::operator[](const INTEGER& index_value) const
{
index_value.must_bound("Using an unbound integer value for indexing a value of type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames.");
return (*this)[(int)index_value];
}
SocketCAN__CAN__or__CAN__FD__frames SocketCAN__CAN__or__CAN__FD__frames::operator<<=(int rotate_count) const
{
return *this >>= (-rotate_count);
}
SocketCAN__CAN__or__CAN__FD__frames SocketCAN__CAN__or__CAN__FD__frames::operator<<=(const INTEGER& rotate_count) const
{
rotate_count.must_bound("Unbound integer operand of rotate left operator.");
return *this >>= (int)(-rotate_count);
}
SocketCAN__CAN__or__CAN__FD__frames SocketCAN__CAN__or__CAN__FD__frames::operator>>=(const INTEGER& rotate_count) const
{
rotate_count.must_bound("Unbound integer operand of rotate right operator.");
return *this >>= (int)rotate_count;
}
SocketCAN__CAN__or__CAN__FD__frames SocketCAN__CAN__or__CAN__FD__frames::operator>>=(int rotate_count) const
{
if (val_ptr == NULL) TTCN_error("Performing rotation operation on an unbound value of type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames.");
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;
SocketCAN__CAN__or__CAN__FD__frames 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 SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame(*val_ptr->value_elements[i]);
}
}
return ret_val;
}
SocketCAN__CAN__or__CAN__FD__frames SocketCAN__CAN__or__CAN__FD__frames::operator+(const SocketCAN__CAN__or__CAN__FD__frames& other_value) const
{
if (val_ptr == NULL || other_value.val_ptr == NULL) TTCN_error("Unbound operand of @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames concatenation.");
if (val_ptr->n_elements == 0) return other_value;
if (other_value.val_ptr->n_elements == 0) return *this;
SocketCAN__CAN__or__CAN__FD__frames 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 SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame(*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 SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame(*other_value.val_ptr->value_elements[i]);
}
}
return ret_val;
}
SocketCAN__CAN__or__CAN__FD__frames SocketCAN__CAN__or__CAN__FD__frames::substr(int index, int returncount) const
{
if (val_ptr == NULL) TTCN_error("The first argument of substr() is an unbound value of type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames.");
check_substr_arguments(val_ptr->n_elements, index, returncount, "@SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames","element");
SocketCAN__CAN__or__CAN__FD__frames 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 SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame(*val_ptr->value_elements[i+index]);
}
}
return ret_val;
}
SocketCAN__CAN__or__CAN__FD__frames SocketCAN__CAN__or__CAN__FD__frames::replace(int index, int len, const SocketCAN__CAN__or__CAN__FD__frames& repl) const
{
if (val_ptr == NULL) TTCN_error("The first argument of replace() is an unbound value of type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames.");
if (repl.val_ptr == NULL) TTCN_error("The fourth argument of replace() is an unbound value of type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames.");
check_replace_arguments(val_ptr->n_elements, index, len, "@SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames","element");
SocketCAN__CAN__or__CAN__FD__frames 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 SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame(*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 SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame(*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 SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame(*val_ptr->value_elements[index+i+len]);
}
}
return ret_val;
}
SocketCAN__CAN__or__CAN__FD__frames SocketCAN__CAN__or__CAN__FD__frames::replace(int index, int len, const SocketCAN__CAN__or__CAN__FD__frames_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 SocketCAN__CAN__or__CAN__FD__frames::set_size(int new_size)
{
if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a value of type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames.");
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 = (SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame**)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 SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame(*(val_ptr->value_elements[elem_count]));
}
}
clean_up();
val_ptr = new_val_ptr;
}
if (new_size > val_ptr->n_elements) {
val_ptr->value_elements = (SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame**)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 @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames: %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 = (SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size);
val_ptr->n_elements = new_size;
}
}
boolean SocketCAN__CAN__or__CAN__FD__frames::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 SocketCAN__CAN__or__CAN__FD__frames::size_of() const
{
if (val_ptr == NULL) TTCN_error("Performing sizeof operation on an unbound value of type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames.");
return val_ptr->n_elements;
}
int SocketCAN__CAN__or__CAN__FD__frames::lengthof() const
{
if (val_ptr == NULL) TTCN_error("Performing lengthof operation on an unbound value of type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames.");
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 SocketCAN__CAN__or__CAN__FD__frames::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 SocketCAN__CAN__or__CAN__FD__frames::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", "@SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames");
}
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", "@SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames");
}
break;
default:
TTCN_error("Internal error: Unknown operation type.");
}
}
void SocketCAN__CAN__or__CAN__FD__frames::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 SocketCAN__CAN__or__CAN__FD__frames::encode_text(Text_Buf& text_buf) const
{
if (val_ptr == NULL) TTCN_error("Text encoder: Encoding an unbound value of type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames.");
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 SocketCAN__CAN__or__CAN__FD__frames::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 @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames.");
val_ptr->value_elements = (SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame**)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 SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame;
val_ptr->value_elements[elem_count]->decode_text(text_buf);
}
}
void SocketCAN__CAN__or__CAN__FD__frames_template::copy_value(const SocketCAN__CAN__or__CAN__FD__frames& other_value)
{
if (!other_value.is_bound()) TTCN_error("Initialization of a template of type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames with an unbound value.");
single_value.n_elements = other_value.size_of();
single_value.value_elements = (SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame_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 SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame_template(other_value[elem_count]);
} else {
single_value.value_elements[elem_count] = new SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame_template;
}
}
set_selection(SPECIFIC_VALUE);
}
void SocketCAN__CAN__or__CAN__FD__frames_template::copy_template(const SocketCAN__CAN__or__CAN__FD__frames_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 = (SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame_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 SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame_template(*other_value.single_value.value_elements[elem_count]);
} else {
single_value.value_elements[elem_count] = new SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame_template;
}
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new SocketCAN__CAN__or__CAN__FD__frames_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;
default:
TTCN_error("Copying an uninitialized/unsupported template of type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames.");
break;
}
set_selection(other_value);
}
boolean SocketCAN__CAN__or__CAN__FD__frames_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 SocketCAN__CAN__or__CAN__FD__frames_template*)template_ptr)->single_value.value_elements[template_index]->match((*(const SocketCAN__CAN__or__CAN__FD__frames*)value_ptr)[value_index], legacy);
else return ((const SocketCAN__CAN__or__CAN__FD__frames_template*)template_ptr)->single_value.value_elements[template_index]->is_any_or_omit();
}
SocketCAN__CAN__or__CAN__FD__frames_template::SocketCAN__CAN__or__CAN__FD__frames_template()
{
}
SocketCAN__CAN__or__CAN__FD__frames_template::SocketCAN__CAN__or__CAN__FD__frames_template(template_sel other_value)
: Record_Of_Template(other_value)
{
check_single_selection(other_value);
}
SocketCAN__CAN__or__CAN__FD__frames_template::SocketCAN__CAN__or__CAN__FD__frames_template(null_type)
: Record_Of_Template(SPECIFIC_VALUE)
{
single_value.n_elements = 0;
single_value.value_elements = NULL;
}
SocketCAN__CAN__or__CAN__FD__frames_template::SocketCAN__CAN__or__CAN__FD__frames_template(const SocketCAN__CAN__or__CAN__FD__frames& other_value)
{
copy_value(other_value);
}
SocketCAN__CAN__or__CAN__FD__frames_template::SocketCAN__CAN__or__CAN__FD__frames_template(const OPTIONAL<SocketCAN__CAN__or__CAN__FD__frames>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const SocketCAN__CAN__or__CAN__FD__frames&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames from an unbound optional field.");
}
}
SocketCAN__CAN__or__CAN__FD__frames_template::SocketCAN__CAN__or__CAN__FD__frames_template(const SocketCAN__CAN__or__CAN__FD__frames_template& other_value)
: Record_Of_Template()
{
copy_template(other_value);
}
SocketCAN__CAN__or__CAN__FD__frames_template::~SocketCAN__CAN__or__CAN__FD__frames_template()
{
clean_up();
}
void SocketCAN__CAN__or__CAN__FD__frames_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:
delete [] value_list.list_value;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}
SocketCAN__CAN__or__CAN__FD__frames_template& SocketCAN__CAN__or__CAN__FD__frames_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}
SocketCAN__CAN__or__CAN__FD__frames_template& SocketCAN__CAN__or__CAN__FD__frames_template::operator=(null_type)
{
clean_up();
set_selection(SPECIFIC_VALUE);
single_value.n_elements = 0;
single_value.value_elements = NULL;
return *this;
}
SocketCAN__CAN__or__CAN__FD__frames_template& SocketCAN__CAN__or__CAN__FD__frames_template::operator=(const SocketCAN__CAN__or__CAN__FD__frames& other_value)
{
clean_up();
copy_value(other_value);
return *this;
}
SocketCAN__CAN__or__CAN__FD__frames_template& SocketCAN__CAN__or__CAN__FD__frames_template::operator=(const OPTIONAL<SocketCAN__CAN__or__CAN__FD__frames>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const SocketCAN__CAN__or__CAN__FD__frames&)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 @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames.");
}
return *this;
}
SocketCAN__CAN__or__CAN__FD__frames_template& SocketCAN__CAN__or__CAN__FD__frames_template::operator=(const SocketCAN__CAN__or__CAN__FD__frames_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}
SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame_template& SocketCAN__CAN__or__CAN__FD__frames_template::operator[](int index_value)
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames 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 @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames.");
break;
}
return *single_value.value_elements[index_value];
}
SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame_template& SocketCAN__CAN__or__CAN__FD__frames_template::operator[](const INTEGER& index_value)
{
index_value.must_bound("Using an unbound integer value for indexing a template of type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames.");
return (*this)[(int)index_value];
}
const SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame_template& SocketCAN__CAN__or__CAN__FD__frames_template::operator[](int index_value) const
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames using a negative index: %d.", index_value);
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing an element of a non-specific template for type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames.");
if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames: 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 SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame_template& SocketCAN__CAN__or__CAN__FD__frames_template::operator[](const INTEGER& index_value) const
{
index_value.must_bound("Using an unbound integer value for indexing a template of type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames.");
return (*this)[(int)index_value];
}
void SocketCAN__CAN__or__CAN__FD__frames_template::set_size(int new_size)
{
if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a template of type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames.");
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 = (SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame_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 SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame_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 SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame_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 = (SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size);
single_value.n_elements = new_size;
}
}
int SocketCAN__CAN__or__CAN__FD__frames_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 SocketCAN__CAN__or__CAN__FD__frames_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 @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames 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 @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames 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 @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames 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 @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames 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 @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames 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 @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames containing complemented list.", op_name);
default:
TTCN_error("Performing %sof() operation on an uninitialized/unsupported template of type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames.", op_name);
}
return check_section_is_single(min_size, has_any_or_none, op_name, "a", "template of type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames");
}
boolean SocketCAN__CAN__or__CAN__FD__frames_template::match(const SocketCAN__CAN__or__CAN__FD__frames& 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;
default:
TTCN_error("Matching with an uninitialized/unsupported template of type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames.");
}
return FALSE;
}
boolean SocketCAN__CAN__or__CAN__FD__frames_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;
}
SocketCAN__CAN__or__CAN__FD__frames SocketCAN__CAN__or__CAN__FD__frames_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 @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames.");
SocketCAN__CAN__or__CAN__FD__frames 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;
}
SocketCAN__CAN__or__CAN__FD__frames SocketCAN__CAN__or__CAN__FD__frames_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);
}
SocketCAN__CAN__or__CAN__FD__frames SocketCAN__CAN__or__CAN__FD__frames_template::replace(int index, int len, const SocketCAN__CAN__or__CAN__FD__frames_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());
}
SocketCAN__CAN__or__CAN__FD__frames SocketCAN__CAN__or__CAN__FD__frames_template::replace(int index, int len, const SocketCAN__CAN__or__CAN__FD__frames& 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 SocketCAN__CAN__or__CAN__FD__frames_template::set_type(template_sel template_type, unsigned int list_length)
{
clean_up();
switch (template_type) {
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = list_length;
value_list.list_value = new SocketCAN__CAN__or__CAN__FD__frames_template[list_length];
break;
default:
TTCN_error("Internal error: Setting an invalid type for a template of type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames.");
}
set_selection(template_type);
}
SocketCAN__CAN__or__CAN__FD__frames_template& SocketCAN__CAN__or__CAN__FD__frames_template::list_item(unsigned int list_index)
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST) TTCN_error("Internal error: Accessing a list element of a non-list template of type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames.");
if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames.");
return value_list.list_value[list_index];
}
void SocketCAN__CAN__or__CAN__FD__frames_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 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;
default:
log_generic();
}
log_restricted();
log_ifpresent();
}
void SocketCAN__CAN__or__CAN__FD__frames_template::log_match(const SocketCAN__CAN__or__CAN__FD__frames& 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 SocketCAN__CAN__or__CAN__FD__frames_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 @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames.");
}
}
void SocketCAN__CAN__or__CAN__FD__frames_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 @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames.");
single_value.value_elements = (SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame_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 SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame_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 SocketCAN__CAN__or__CAN__FD__frames_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 @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames.");
}
}
boolean SocketCAN__CAN__or__CAN__FD__frames_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}
boolean SocketCAN__CAN__or__CAN__FD__frames_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
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 SocketCAN__CAN__or__CAN__FD__frames_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: {
SocketCAN__CAN__or__CAN__FD__frames_template temp;
temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : COMPLEMENTED_LIST, param.get_size());
for (size_t p_i=0; p_i<param.get_size(); p_i++) {
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;
default:
param.type_error("record of template", "@SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames");
}
is_ifpresent = param.get_ifpresent();
set_length_range(param);
}
void SocketCAN__CAN__or__CAN__FD__frames_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 : "@SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames");
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 : "@SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames");
}
boolean SocketCAN__CAN__or__CAN__FD__frames_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);
}
}
PhaseStartReq::PhaseStartReq()
{
}
PhaseStartReq::PhaseStartReq(const e__Phase& par_phase,
const INTEGER& par_phase__int)
: field_phase(par_phase),
field_phase__int(par_phase__int)
{
}
PhaseStartReq::PhaseStartReq(const PhaseStartReq& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @SocketCANtest.PhaseStartReq.");
if (other_value.phase().is_bound()) field_phase = other_value.phase();
else field_phase.clean_up();
if (other_value.phase__int().is_bound()) field_phase__int = other_value.phase__int();
else field_phase__int.clean_up();
}
void PhaseStartReq::clean_up()
{
field_phase.clean_up();
field_phase__int.clean_up();
}
const TTCN_Typedescriptor_t* PhaseStartReq::get_descriptor() const { return &PhaseStartReq_descr_; }
PhaseStartReq& PhaseStartReq::operator=(const PhaseStartReq& other_value)
{
if (this != &other_value) {
if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @SocketCANtest.PhaseStartReq.");
if (other_value.phase().is_bound()) field_phase = other_value.phase();
else field_phase.clean_up();
if (other_value.phase__int().is_bound()) field_phase__int = other_value.phase__int();
else field_phase__int.clean_up();
}
return *this;
}
boolean PhaseStartReq::operator==(const PhaseStartReq& other_value) const
{
return field_phase==other_value.field_phase
&& field_phase__int==other_value.field_phase__int;
}
boolean PhaseStartReq::is_bound() const
{
return (field_phase.is_bound())
|| (field_phase__int.is_bound());
}
boolean PhaseStartReq::is_value() const
{
return field_phase.is_value()
&& field_phase__int.is_value();
}
void PhaseStartReq::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ phase := ");
field_phase.log();
TTCN_Logger::log_event_str(", phase_int := ");
field_phase__int.log();
TTCN_Logger::log_event_str(" }");
}
void PhaseStartReq::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 @SocketCANtest.PhaseStartReq 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) phase().set_param(*param.get_elem(0));
if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) phase__int().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(), "phase")) {
if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
phase().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(), "phase_int")) {
if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
phase__int().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 @SocketCANtest.PhaseStartReq: %s", curr_param->get_id()->get_name());
break;
}
} break;
default:
param.type_error("record value", "@SocketCANtest.PhaseStartReq");
}
}
void PhaseStartReq::set_implicit_omit()
{
if (phase().is_bound()) phase().set_implicit_omit();
if (phase__int().is_bound()) phase__int().set_implicit_omit();
}
void PhaseStartReq::encode_text(Text_Buf& text_buf) const
{
field_phase.encode_text(text_buf);
field_phase__int.encode_text(text_buf);
}
void PhaseStartReq::decode_text(Text_Buf& text_buf)
{
field_phase.decode_text(text_buf);
field_phase__int.decode_text(text_buf);
}
struct PhaseStartReq_template::single_value_struct {
e__Phase_template field_phase;
INTEGER_template field_phase__int;
};
void PhaseStartReq_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_phase = ANY_VALUE;
single_value->field_phase__int = ANY_VALUE;
}
}
}
void PhaseStartReq_template::copy_value(const PhaseStartReq& other_value)
{
single_value = new single_value_struct;
if (other_value.phase().is_bound()) {
single_value->field_phase = other_value.phase();
} else {
single_value->field_phase.clean_up();
}
if (other_value.phase__int().is_bound()) {
single_value->field_phase__int = other_value.phase__int();
} else {
single_value->field_phase__int.clean_up();
}
set_selection(SPECIFIC_VALUE);
}
void PhaseStartReq_template::copy_template(const PhaseStartReq_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.phase().get_selection()) {
single_value->field_phase = other_value.phase();
} else {
single_value->field_phase.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.phase__int().get_selection()) {
single_value->field_phase__int = other_value.phase__int();
} else {
single_value->field_phase__int.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new PhaseStartReq_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;
default:
TTCN_error("Copying an uninitialized/unsupported template of type @SocketCANtest.PhaseStartReq.");
break;
}
set_selection(other_value);
}
PhaseStartReq_template::PhaseStartReq_template()
{
}
PhaseStartReq_template::PhaseStartReq_template(template_sel other_value)
: Base_Template(other_value)
{
check_single_selection(other_value);
}
PhaseStartReq_template::PhaseStartReq_template(const PhaseStartReq& other_value)
{
copy_value(other_value);
}
PhaseStartReq_template::PhaseStartReq_template(const OPTIONAL<PhaseStartReq>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const PhaseStartReq&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of type @SocketCANtest.PhaseStartReq from an unbound optional field.");
}
}
PhaseStartReq_template::PhaseStartReq_template(const PhaseStartReq_template& other_value)
: Base_Template()
{
copy_template(other_value);
}
PhaseStartReq_template::~PhaseStartReq_template()
{
clean_up();
}
PhaseStartReq_template& PhaseStartReq_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}
PhaseStartReq_template& PhaseStartReq_template::operator=(const PhaseStartReq& other_value)
{
clean_up();
copy_value(other_value);
return *this;
}
PhaseStartReq_template& PhaseStartReq_template::operator=(const OPTIONAL<PhaseStartReq>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const PhaseStartReq&)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 @SocketCANtest.PhaseStartReq.");
}
return *this;
}
PhaseStartReq_template& PhaseStartReq_template::operator=(const PhaseStartReq_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}
boolean PhaseStartReq_template::match(const PhaseStartReq& 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.phase().is_bound()) return FALSE;
if(!single_value->field_phase.match(other_value.phase(), legacy))return FALSE;
if(!other_value.phase__int().is_bound()) return FALSE;
if(!single_value->field_phase__int.match(other_value.phase__int(), 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;
default:
TTCN_error("Matching an uninitialized/unsupported template of type @SocketCANtest.PhaseStartReq.");
}
return FALSE;
}
boolean PhaseStartReq_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_phase.is_bound()
||single_value->field_phase__int.is_bound()
;
}
boolean PhaseStartReq_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_phase.is_value()
&&single_value->field_phase__int.is_value();
}
void PhaseStartReq_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
delete single_value;
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
delete [] value_list.list_value;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}
PhaseStartReq PhaseStartReq_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 @SocketCANtest.PhaseStartReq.");
PhaseStartReq ret_val;
if (single_value->field_phase.is_bound()) {
ret_val.phase() = single_value->field_phase.valueof();
}
if (single_value->field_phase__int.is_bound()) {
ret_val.phase__int() = single_value->field_phase__int.valueof();
}
return ret_val;
}
void PhaseStartReq_template::set_type(template_sel template_type, unsigned int list_length)
{
if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST)
TTCN_error("Setting an invalid list for a template of type @SocketCANtest.PhaseStartReq.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new PhaseStartReq_template[list_length];
}
PhaseStartReq_template& PhaseStartReq_template::list_item(unsigned int list_index) const
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST)
TTCN_error("Accessing a list element of a non-list template of type @SocketCANtest.PhaseStartReq.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @SocketCANtest.PhaseStartReq.");
return value_list.list_value[list_index];
}
e__Phase_template& PhaseStartReq_template::phase()
{
set_specific();
return single_value->field_phase;
}
const e__Phase_template& PhaseStartReq_template::phase() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field phase of a non-specific template of type @SocketCANtest.PhaseStartReq.");
return single_value->field_phase;
}
INTEGER_template& PhaseStartReq_template::phase__int()
{
set_specific();
return single_value->field_phase__int;
}
const INTEGER_template& PhaseStartReq_template::phase__int() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field phase_int of a non-specific template of type @SocketCANtest.PhaseStartReq.");
return single_value->field_phase__int;
}
int PhaseStartReq_template::size_of() const
{
if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @SocketCANtest.PhaseStartReq 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 @SocketCANtest.PhaseStartReq 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 @SocketCANtest.PhaseStartReq containing a value list with different sizes.");
}
return item_size;
}
case OMIT_VALUE:
TTCN_error("Performing sizeof() operation on a template of type @SocketCANtest.PhaseStartReq containing omit value.");
case ANY_VALUE:
case ANY_OR_OMIT:
TTCN_error("Performing sizeof() operation on a template of type @SocketCANtest.PhaseStartReq containing */? value.");
case COMPLEMENTED_LIST:
TTCN_error("Performing sizeof() operation on a template of type @SocketCANtest.PhaseStartReq containing complemented list.");
default:
TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @SocketCANtest.PhaseStartReq.");
}
return 0;
}
void PhaseStartReq_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ phase := ");
single_value->field_phase.log();
TTCN_Logger::log_event_str(", phase_int := ");
single_value->field_phase__int.log();
TTCN_Logger::log_event_str(" }");
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
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;
default:
log_generic();
}
log_ifpresent();
}
void PhaseStartReq_template::log_match(const PhaseStartReq& 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_phase.match(match_value.phase(), legacy)){
TTCN_Logger::log_logmatch_info(".phase");
single_value->field_phase.log_match(match_value.phase(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_phase__int.match(match_value.phase__int(), legacy)){
TTCN_Logger::log_logmatch_info(".phase_int");
single_value->field_phase__int.log_match(match_value.phase__int(), 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("{ phase := ");
single_value->field_phase.log_match(match_value.phase(), legacy);
TTCN_Logger::log_event_str(", phase_int := ");
single_value->field_phase__int.log_match(match_value.phase__int(), 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 PhaseStartReq_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_phase.encode_text(text_buf);
single_value->field_phase__int.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 @SocketCANtest.PhaseStartReq.");
}
}
void PhaseStartReq_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_phase.decode_text(text_buf);
single_value->field_phase__int.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 PhaseStartReq_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 @SocketCANtest.PhaseStartReq.");
}
}
void PhaseStartReq_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: {
PhaseStartReq_template new_temp;
new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : COMPLEMENTED_LIST, param.get_size());
for (size_t p_i=0; p_i<param.get_size(); p_i++) {
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 @SocketCANtest.PhaseStartReq 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) phase().set_param(*param.get_elem(0));
if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) phase__int().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(), "phase")) {
if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
phase().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(), "phase_int")) {
if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
phase__int().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 @SocketCANtest.PhaseStartReq: %s", curr_param->get_id()->get_name());
break;
}
} break;
default:
param.type_error("record template", "@SocketCANtest.PhaseStartReq");
}
is_ifpresent = param.get_ifpresent();
}
void PhaseStartReq_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_phase.check_restriction(t_res, t_name ? t_name : "@SocketCANtest.PhaseStartReq");
single_value->field_phase__int.check_restriction(t_res, t_name ? t_name : "@SocketCANtest.PhaseStartReq");
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 : "@SocketCANtest.PhaseStartReq");
}
boolean PhaseStartReq_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}
boolean PhaseStartReq_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
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;
}
PhaseEndInd::PhaseEndInd()
{
}
PhaseEndInd::PhaseEndInd(const e__Phase& par_phase,
const INTEGER& par_phase__int)
: field_phase(par_phase),
field_phase__int(par_phase__int)
{
}
PhaseEndInd::PhaseEndInd(const PhaseEndInd& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @SocketCANtest.PhaseEndInd.");
if (other_value.phase().is_bound()) field_phase = other_value.phase();
else field_phase.clean_up();
if (other_value.phase__int().is_bound()) field_phase__int = other_value.phase__int();
else field_phase__int.clean_up();
}
void PhaseEndInd::clean_up()
{
field_phase.clean_up();
field_phase__int.clean_up();
}
const TTCN_Typedescriptor_t* PhaseEndInd::get_descriptor() const { return &PhaseEndInd_descr_; }
PhaseEndInd& PhaseEndInd::operator=(const PhaseEndInd& other_value)
{
if (this != &other_value) {
if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @SocketCANtest.PhaseEndInd.");
if (other_value.phase().is_bound()) field_phase = other_value.phase();
else field_phase.clean_up();
if (other_value.phase__int().is_bound()) field_phase__int = other_value.phase__int();
else field_phase__int.clean_up();
}
return *this;
}
boolean PhaseEndInd::operator==(const PhaseEndInd& other_value) const
{
return field_phase==other_value.field_phase
&& field_phase__int==other_value.field_phase__int;
}
boolean PhaseEndInd::is_bound() const
{
return (field_phase.is_bound())
|| (field_phase__int.is_bound());
}
boolean PhaseEndInd::is_value() const
{
return field_phase.is_value()
&& field_phase__int.is_value();
}
void PhaseEndInd::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ phase := ");
field_phase.log();
TTCN_Logger::log_event_str(", phase_int := ");
field_phase__int.log();
TTCN_Logger::log_event_str(" }");
}
void PhaseEndInd::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 @SocketCANtest.PhaseEndInd 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) phase().set_param(*param.get_elem(0));
if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) phase__int().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(), "phase")) {
if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
phase().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(), "phase_int")) {
if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
phase__int().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 @SocketCANtest.PhaseEndInd: %s", curr_param->get_id()->get_name());
break;
}
} break;
default:
param.type_error("record value", "@SocketCANtest.PhaseEndInd");
}
}
void PhaseEndInd::set_implicit_omit()
{
if (phase().is_bound()) phase().set_implicit_omit();
if (phase__int().is_bound()) phase__int().set_implicit_omit();
}
void PhaseEndInd::encode_text(Text_Buf& text_buf) const
{
field_phase.encode_text(text_buf);
field_phase__int.encode_text(text_buf);
}
void PhaseEndInd::decode_text(Text_Buf& text_buf)
{
field_phase.decode_text(text_buf);
field_phase__int.decode_text(text_buf);
}
struct PhaseEndInd_template::single_value_struct {
e__Phase_template field_phase;
INTEGER_template field_phase__int;
};
void PhaseEndInd_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_phase = ANY_VALUE;
single_value->field_phase__int = ANY_VALUE;
}
}
}
void PhaseEndInd_template::copy_value(const PhaseEndInd& other_value)
{
single_value = new single_value_struct;
if (other_value.phase().is_bound()) {
single_value->field_phase = other_value.phase();
} else {
single_value->field_phase.clean_up();
}
if (other_value.phase__int().is_bound()) {
single_value->field_phase__int = other_value.phase__int();
} else {
single_value->field_phase__int.clean_up();
}
set_selection(SPECIFIC_VALUE);
}
void PhaseEndInd_template::copy_template(const PhaseEndInd_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.phase().get_selection()) {
single_value->field_phase = other_value.phase();
} else {
single_value->field_phase.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.phase__int().get_selection()) {
single_value->field_phase__int = other_value.phase__int();
} else {
single_value->field_phase__int.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new PhaseEndInd_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;
default:
TTCN_error("Copying an uninitialized/unsupported template of type @SocketCANtest.PhaseEndInd.");
break;
}
set_selection(other_value);
}
PhaseEndInd_template::PhaseEndInd_template()
{
}
PhaseEndInd_template::PhaseEndInd_template(template_sel other_value)
: Base_Template(other_value)
{
check_single_selection(other_value);
}
PhaseEndInd_template::PhaseEndInd_template(const PhaseEndInd& other_value)
{
copy_value(other_value);
}
PhaseEndInd_template::PhaseEndInd_template(const OPTIONAL<PhaseEndInd>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const PhaseEndInd&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of type @SocketCANtest.PhaseEndInd from an unbound optional field.");
}
}
PhaseEndInd_template::PhaseEndInd_template(const PhaseEndInd_template& other_value)
: Base_Template()
{
copy_template(other_value);
}
PhaseEndInd_template::~PhaseEndInd_template()
{
clean_up();
}
PhaseEndInd_template& PhaseEndInd_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}
PhaseEndInd_template& PhaseEndInd_template::operator=(const PhaseEndInd& other_value)
{
clean_up();
copy_value(other_value);
return *this;
}
PhaseEndInd_template& PhaseEndInd_template::operator=(const OPTIONAL<PhaseEndInd>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const PhaseEndInd&)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 @SocketCANtest.PhaseEndInd.");
}
return *this;
}
PhaseEndInd_template& PhaseEndInd_template::operator=(const PhaseEndInd_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}
boolean PhaseEndInd_template::match(const PhaseEndInd& 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.phase().is_bound()) return FALSE;
if(!single_value->field_phase.match(other_value.phase(), legacy))return FALSE;
if(!other_value.phase__int().is_bound()) return FALSE;
if(!single_value->field_phase__int.match(other_value.phase__int(), 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;
default:
TTCN_error("Matching an uninitialized/unsupported template of type @SocketCANtest.PhaseEndInd.");
}
return FALSE;
}
boolean PhaseEndInd_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_phase.is_bound()
||single_value->field_phase__int.is_bound()
;
}
boolean PhaseEndInd_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_phase.is_value()
&&single_value->field_phase__int.is_value();
}
void PhaseEndInd_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
delete single_value;
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
delete [] value_list.list_value;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}
PhaseEndInd PhaseEndInd_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 @SocketCANtest.PhaseEndInd.");
PhaseEndInd ret_val;
if (single_value->field_phase.is_bound()) {
ret_val.phase() = single_value->field_phase.valueof();
}
if (single_value->field_phase__int.is_bound()) {
ret_val.phase__int() = single_value->field_phase__int.valueof();
}
return ret_val;
}
void PhaseEndInd_template::set_type(template_sel template_type, unsigned int list_length)
{
if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST)
TTCN_error("Setting an invalid list for a template of type @SocketCANtest.PhaseEndInd.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new PhaseEndInd_template[list_length];
}
PhaseEndInd_template& PhaseEndInd_template::list_item(unsigned int list_index) const
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST)
TTCN_error("Accessing a list element of a non-list template of type @SocketCANtest.PhaseEndInd.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @SocketCANtest.PhaseEndInd.");
return value_list.list_value[list_index];
}
e__Phase_template& PhaseEndInd_template::phase()
{
set_specific();
return single_value->field_phase;
}
const e__Phase_template& PhaseEndInd_template::phase() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field phase of a non-specific template of type @SocketCANtest.PhaseEndInd.");
return single_value->field_phase;
}
INTEGER_template& PhaseEndInd_template::phase__int()
{
set_specific();
return single_value->field_phase__int;
}
const INTEGER_template& PhaseEndInd_template::phase__int() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field phase_int of a non-specific template of type @SocketCANtest.PhaseEndInd.");
return single_value->field_phase__int;
}
int PhaseEndInd_template::size_of() const
{
if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @SocketCANtest.PhaseEndInd 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 @SocketCANtest.PhaseEndInd 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 @SocketCANtest.PhaseEndInd containing a value list with different sizes.");
}
return item_size;
}
case OMIT_VALUE:
TTCN_error("Performing sizeof() operation on a template of type @SocketCANtest.PhaseEndInd containing omit value.");
case ANY_VALUE:
case ANY_OR_OMIT:
TTCN_error("Performing sizeof() operation on a template of type @SocketCANtest.PhaseEndInd containing */? value.");
case COMPLEMENTED_LIST:
TTCN_error("Performing sizeof() operation on a template of type @SocketCANtest.PhaseEndInd containing complemented list.");
default:
TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @SocketCANtest.PhaseEndInd.");
}
return 0;
}
void PhaseEndInd_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ phase := ");
single_value->field_phase.log();
TTCN_Logger::log_event_str(", phase_int := ");
single_value->field_phase__int.log();
TTCN_Logger::log_event_str(" }");
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
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;
default:
log_generic();
}
log_ifpresent();
}
void PhaseEndInd_template::log_match(const PhaseEndInd& 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_phase.match(match_value.phase(), legacy)){
TTCN_Logger::log_logmatch_info(".phase");
single_value->field_phase.log_match(match_value.phase(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_phase__int.match(match_value.phase__int(), legacy)){
TTCN_Logger::log_logmatch_info(".phase_int");
single_value->field_phase__int.log_match(match_value.phase__int(), 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("{ phase := ");
single_value->field_phase.log_match(match_value.phase(), legacy);
TTCN_Logger::log_event_str(", phase_int := ");
single_value->field_phase__int.log_match(match_value.phase__int(), 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 PhaseEndInd_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_phase.encode_text(text_buf);
single_value->field_phase__int.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 @SocketCANtest.PhaseEndInd.");
}
}
void PhaseEndInd_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_phase.decode_text(text_buf);
single_value->field_phase__int.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 PhaseEndInd_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 @SocketCANtest.PhaseEndInd.");
}
}
void PhaseEndInd_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: {
PhaseEndInd_template new_temp;
new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : COMPLEMENTED_LIST, param.get_size());
for (size_t p_i=0; p_i<param.get_size(); p_i++) {
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 @SocketCANtest.PhaseEndInd 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) phase().set_param(*param.get_elem(0));
if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) phase__int().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(), "phase")) {
if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
phase().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(), "phase_int")) {
if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
phase__int().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 @SocketCANtest.PhaseEndInd: %s", curr_param->get_id()->get_name());
break;
}
} break;
default:
param.type_error("record template", "@SocketCANtest.PhaseEndInd");
}
is_ifpresent = param.get_ifpresent();
}
void PhaseEndInd_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_phase.check_restriction(t_res, t_name ? t_name : "@SocketCANtest.PhaseEndInd");
single_value->field_phase__int.check_restriction(t_res, t_name ? t_name : "@SocketCANtest.PhaseEndInd");
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 : "@SocketCANtest.PhaseEndInd");
}
boolean PhaseEndInd_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}
boolean PhaseEndInd_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
if (legacy) {
for (unsigned int l_idx=0; l_idx<value_list.n_values; l_idx++)
if (value_list.list_value[l_idx].match_omit())
return template_selection==VALUE_LIST;
return template_selection==COMPLEMENTED_LIST;
} // else fall through
default:
return FALSE;
}
return FALSE;
}
void SyncMasterPort::remove_msg_queue_head()
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
switch (my_head->item_selection) {
case MESSAGE_0:
delete (my_head)->message_0;
break;
default:
TTCN_error("Internal error: Invalid message selector in the queue of port %s.", port_name);
}
msg_queue_item_base *next_item = msg_queue_head->next_item;
delete (msg_queue_item*)msg_queue_head;
msg_queue_head = next_item;
if (next_item == NULL) msg_queue_tail = NULL;
TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::extract__msg, port_name, 0, ++msg_head_count, CHARSTRING(0,NULL), CHARSTRING(0,NULL));}
void SyncMasterPort::clear_queue()
{
while (msg_queue_head != NULL) remove_msg_queue_head();
}
SyncMasterPort::SyncMasterPort(const char *par_port_name)
: PORT(par_port_name)
{
msg_queue_head = NULL;
msg_queue_tail = NULL;
}
SyncMasterPort::~SyncMasterPort()
{
clear_queue();
}
void SyncMasterPort::send(const PhaseStartReq& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name);
if (!destination_component.is_bound()) TTCN_error("Unbound component reference in the to clause of send operation.");
const TTCN_Logger::Severity log_sev = destination_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMSEND:TTCN_Logger::PORTEVENT_MCSEND;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_send(port_name, destination_component,
(TTCN_Logger::begin_event(log_sev, TRUE), TTCN_Logger::log_event_str(" @SocketCANtest.PhaseStartReq : "),
send_par.log(), TTCN_Logger::end_event_log2str()));
}
if (destination_component == SYSTEM_COMPREF) TTCN_error("Message cannot be sent to system on internal port %s.", port_name);
else {
Text_Buf text_buf;
prepare_message(text_buf, "@SocketCANtest.PhaseStartReq");
send_par.encode_text(text_buf);
send_data(text_buf, destination_component);
}
}
void SyncMasterPort::send(const PhaseStartReq& send_par, FLOAT* timestamp_redirect)
{
send(send_par, COMPONENT(get_default_destination()), timestamp_redirect);
}
void SyncMasterPort::send(const PhaseStartReq_template& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
const PhaseStartReq& send_par_value = PhaseStartReq(send_par.valueof());
send(send_par_value, destination_component, timestamp_redirect);
}
void SyncMasterPort::send(const PhaseStartReq_template& send_par, FLOAT* timestamp_redirect)
{
const PhaseStartReq& send_par_value = PhaseStartReq(send_par.valueof());
send(send_par_value, COMPONENT(get_default_destination()), timestamp_redirect);
}
alt_status SyncMasterPort::receive(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else {
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS, "Matching on port %s succeeded.", port_name);
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
switch (my_head->item_selection) {
case MESSAGE_0:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @SocketCANtest.PhaseEndInd: "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
default:
TTCN_error("Internal error: unknown message");
}
}
remove_msg_queue_head();
return ALT_YES;
}
}
alt_status SyncMasterPort::check_receive(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else {
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS, "Matching on port %s succeeded.", port_name);
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
switch (my_head->item_selection) {
case MESSAGE_0:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @SocketCANtest.PhaseEndInd: "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
default:
TTCN_error("Internal error: unknown message");
}
}
return ALT_YES;
}
}
alt_status SyncMasterPort::trigger(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s will drop a message: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
remove_msg_queue_head();
return ALT_REPEAT;
} else {
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS, "Matching on port %s succeeded.", port_name);
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
switch (my_head->item_selection) {
case MESSAGE_0:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @SocketCANtest.PhaseEndInd: "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
default:
TTCN_error("Internal error: unknown message");
}
}
remove_msg_queue_head();
return ALT_YES;
}
}
alt_status SyncMasterPort::receive(const PhaseEndInd_template& value_template, PhaseEndInd *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_0) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @SocketCANtest.PhaseEndInd.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_0)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_0;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @SocketCANtest.PhaseEndInd : "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}
alt_status SyncMasterPort::check_receive(const PhaseEndInd_template& value_template, PhaseEndInd *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Check-receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_0) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @SocketCANtest.PhaseEndInd.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_0)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_0;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @SocketCANtest.PhaseEndInd : "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
return ALT_YES;
}
}
alt_status SyncMasterPort::trigger(const PhaseEndInd_template& value_template, PhaseEndInd *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Trigger operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s will drop a message: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
remove_msg_queue_head();
return ALT_REPEAT;
} else if (my_head->item_selection != MESSAGE_0) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s will drop a message: Type of the first message in the queue is not @SocketCANtest.PhaseEndInd.", port_name);
remove_msg_queue_head();
return ALT_REPEAT;
} else if (!value_template.match(*my_head->message_0)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
TTCN_Logger::end_event_log2str()));
}
remove_msg_queue_head();
return ALT_REPEAT;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_0;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @SocketCANtest.PhaseEndInd : "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}
void SyncMasterPort::incoming_message(const PhaseEndInd& incoming_par, component sender_component)
{
if (!is_started) TTCN_error("Port %s is not started but a message has arrived on it.", port_name);
msg_tail_count++;
if (TTCN_Logger::log_this_event(TTCN_Logger::PORTEVENT_MQUEUE)) {
TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::enqueue__msg, port_name, sender_component, msg_tail_count,
CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MQUEUE, TRUE), TTCN_Logger::log_event_str(" @SocketCANtest.PhaseEndInd : "), incoming_par.log(), TTCN_Logger::end_event_log2str()));
}
msg_queue_item *new_item = new msg_queue_item;
new_item->item_selection = MESSAGE_0;
new_item->message_0 = new PhaseEndInd(incoming_par);
new_item->sender_component = sender_component;
append_to_msg_queue(new_item);
}
boolean SyncMasterPort::process_message(const char *message_type, Text_Buf& incoming_buf, component sender_component, OCTETSTRING&)
{
if (!strcmp(message_type, "@SocketCANtest.PhaseEndInd")) {
PhaseEndInd incoming_par;
incoming_par.decode_text(incoming_buf);
incoming_message(incoming_par, sender_component);
return TRUE;
} else return FALSE;
}
void SyncSlavePort::remove_msg_queue_head()
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
switch (my_head->item_selection) {
case MESSAGE_0:
delete (my_head)->message_0;
break;
default:
TTCN_error("Internal error: Invalid message selector in the queue of port %s.", port_name);
}
msg_queue_item_base *next_item = msg_queue_head->next_item;
delete (msg_queue_item*)msg_queue_head;
msg_queue_head = next_item;
if (next_item == NULL) msg_queue_tail = NULL;
TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::extract__msg, port_name, 0, ++msg_head_count, CHARSTRING(0,NULL), CHARSTRING(0,NULL));}
void SyncSlavePort::clear_queue()
{
while (msg_queue_head != NULL) remove_msg_queue_head();
}
SyncSlavePort::SyncSlavePort(const char *par_port_name)
: PORT(par_port_name)
{
msg_queue_head = NULL;
msg_queue_tail = NULL;
}
SyncSlavePort::~SyncSlavePort()
{
clear_queue();
}
void SyncSlavePort::send(const PhaseEndInd& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name);
if (!destination_component.is_bound()) TTCN_error("Unbound component reference in the to clause of send operation.");
const TTCN_Logger::Severity log_sev = destination_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMSEND:TTCN_Logger::PORTEVENT_MCSEND;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_send(port_name, destination_component,
(TTCN_Logger::begin_event(log_sev, TRUE), TTCN_Logger::log_event_str(" @SocketCANtest.PhaseEndInd : "),
send_par.log(), TTCN_Logger::end_event_log2str()));
}
if (destination_component == SYSTEM_COMPREF) TTCN_error("Message cannot be sent to system on internal port %s.", port_name);
else {
Text_Buf text_buf;
prepare_message(text_buf, "@SocketCANtest.PhaseEndInd");
send_par.encode_text(text_buf);
send_data(text_buf, destination_component);
}
}
void SyncSlavePort::send(const PhaseEndInd& send_par, FLOAT* timestamp_redirect)
{
send(send_par, COMPONENT(get_default_destination()), timestamp_redirect);
}
void SyncSlavePort::send(const PhaseEndInd_template& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
const PhaseEndInd& send_par_value = PhaseEndInd(send_par.valueof());
send(send_par_value, destination_component, timestamp_redirect);
}
void SyncSlavePort::send(const PhaseEndInd_template& send_par, FLOAT* timestamp_redirect)
{
const PhaseEndInd& send_par_value = PhaseEndInd(send_par.valueof());
send(send_par_value, COMPONENT(get_default_destination()), timestamp_redirect);
}
alt_status SyncSlavePort::receive(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else {
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS, "Matching on port %s succeeded.", port_name);
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
switch (my_head->item_selection) {
case MESSAGE_0:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @SocketCANtest.PhaseStartReq: "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
default:
TTCN_error("Internal error: unknown message");
}
}
remove_msg_queue_head();
return ALT_YES;
}
}
alt_status SyncSlavePort::check_receive(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else {
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS, "Matching on port %s succeeded.", port_name);
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
switch (my_head->item_selection) {
case MESSAGE_0:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @SocketCANtest.PhaseStartReq: "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
default:
TTCN_error("Internal error: unknown message");
}
}
return ALT_YES;
}
}
alt_status SyncSlavePort::trigger(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s will drop a message: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
remove_msg_queue_head();
return ALT_REPEAT;
} else {
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS, "Matching on port %s succeeded.", port_name);
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
switch (my_head->item_selection) {
case MESSAGE_0:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @SocketCANtest.PhaseStartReq: "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
default:
TTCN_error("Internal error: unknown message");
}
}
remove_msg_queue_head();
return ALT_YES;
}
}
alt_status SyncSlavePort::receive(const PhaseStartReq_template& value_template, PhaseStartReq *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_0) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @SocketCANtest.PhaseStartReq.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_0)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_0;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @SocketCANtest.PhaseStartReq : "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}
alt_status SyncSlavePort::check_receive(const PhaseStartReq_template& value_template, PhaseStartReq *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Check-receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_0) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @SocketCANtest.PhaseStartReq.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_0)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_0;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @SocketCANtest.PhaseStartReq : "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
return ALT_YES;
}
}
alt_status SyncSlavePort::trigger(const PhaseStartReq_template& value_template, PhaseStartReq *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Trigger operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s will drop a message: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
remove_msg_queue_head();
return ALT_REPEAT;
} else if (my_head->item_selection != MESSAGE_0) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s will drop a message: Type of the first message in the queue is not @SocketCANtest.PhaseStartReq.", port_name);
remove_msg_queue_head();
return ALT_REPEAT;
} else if (!value_template.match(*my_head->message_0)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
TTCN_Logger::end_event_log2str()));
}
remove_msg_queue_head();
return ALT_REPEAT;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_0;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @SocketCANtest.PhaseStartReq : "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}
void SyncSlavePort::incoming_message(const PhaseStartReq& incoming_par, component sender_component)
{
if (!is_started) TTCN_error("Port %s is not started but a message has arrived on it.", port_name);
msg_tail_count++;
if (TTCN_Logger::log_this_event(TTCN_Logger::PORTEVENT_MQUEUE)) {
TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::enqueue__msg, port_name, sender_component, msg_tail_count,
CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MQUEUE, TRUE), TTCN_Logger::log_event_str(" @SocketCANtest.PhaseStartReq : "), incoming_par.log(), TTCN_Logger::end_event_log2str()));
}
msg_queue_item *new_item = new msg_queue_item;
new_item->item_selection = MESSAGE_0;
new_item->message_0 = new PhaseStartReq(incoming_par);
new_item->sender_component = sender_component;
append_to_msg_queue(new_item);
}
boolean SyncSlavePort::process_message(const char *message_type, Text_Buf& incoming_buf, component sender_component, OCTETSTRING&)
{
if (!strcmp(message_type, "@SocketCANtest.PhaseStartReq")) {
PhaseStartReq incoming_par;
incoming_par.decode_text(incoming_buf);
incoming_message(incoming_par, sender_component);
return TRUE;
} else return FALSE;
}
const COMPONENT PTCSet::UNBOUND_ELEM;
PTCSet::PTCSet()
{
val_ptr = NULL;
}
PTCSet::PTCSet(null_type)
{
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = 0;
val_ptr->value_elements = NULL;
}
PTCSet::PTCSet(const PTCSet& other_value)
{
if (!other_value.is_bound()) TTCN_error("Copying an unbound value of type @SocketCANtest.PTCSet.");
val_ptr = other_value.val_ptr;
val_ptr->ref_count++;
}
PTCSet::~PTCSet()
{
clean_up();
if (val_ptr != NULL) val_ptr = NULL;
}
void PTCSet::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.");
}
}
PTCSet& PTCSet::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;
}
PTCSet& PTCSet::operator=(const PTCSet& other_value)
{
if (other_value.val_ptr == NULL) TTCN_error("Assigning an unbound value of type @SocketCANtest.PTCSet.");
if (this != &other_value) {
clean_up();
val_ptr = other_value.val_ptr;
val_ptr->ref_count++;
}
return *this;
}
boolean PTCSet::operator==(null_type) const
{
if (val_ptr == NULL)
TTCN_error("The left operand of comparison is an unbound value of type @SocketCANtest.PTCSet.");
return val_ptr->n_elements == 0 ;
}
boolean PTCSet::operator==(const PTCSet& other_value) const
{
if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @SocketCANtest.PTCSet.");
if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @SocketCANtest.PTCSet.");
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;
}
COMPONENT& PTCSet::operator[](int index_value)
{
if (index_value < 0) TTCN_error("Accessing an element of type @SocketCANtest.PTCSet 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 = (COMPONENT**)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 COMPONENT(*(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 COMPONENT;
}
return *val_ptr->value_elements[index_value];
}
COMPONENT& PTCSet::operator[](const INTEGER& index_value)
{
index_value.must_bound("Using an unbound integer value for indexing a value of type @SocketCANtest.PTCSet.");
return (*this)[(int)index_value];
}
const COMPONENT& PTCSet::operator[](int index_value) const
{
if (val_ptr == NULL)
TTCN_error("Accessing an element in an unbound value of type @SocketCANtest.PTCSet.");
if (index_value < 0) TTCN_error("Accessing an element of type @SocketCANtest.PTCSet using a negative index: %d.", index_value);
if (index_value >= val_ptr->n_elements) TTCN_error("Index overflow in a value of type @SocketCANtest.PTCSet: 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 COMPONENT& PTCSet::operator[](const INTEGER& index_value) const
{
index_value.must_bound("Using an unbound integer value for indexing a value of type @SocketCANtest.PTCSet.");
return (*this)[(int)index_value];
}
PTCSet PTCSet::operator<<=(int rotate_count) const
{
return *this >>= (-rotate_count);
}
PTCSet PTCSet::operator<<=(const INTEGER& rotate_count) const
{
rotate_count.must_bound("Unbound integer operand of rotate left operator.");
return *this >>= (int)(-rotate_count);
}
PTCSet PTCSet::operator>>=(const INTEGER& rotate_count) const
{
rotate_count.must_bound("Unbound integer operand of rotate right operator.");
return *this >>= (int)rotate_count;
}
PTCSet PTCSet::operator>>=(int rotate_count) const
{
if (val_ptr == NULL) TTCN_error("Performing rotation operation on an unbound value of type @SocketCANtest.PTCSet.");
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;
PTCSet 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 COMPONENT(*val_ptr->value_elements[i]);
}
}
return ret_val;
}
PTCSet PTCSet::operator+(const PTCSet& other_value) const
{
if (val_ptr == NULL || other_value.val_ptr == NULL) TTCN_error("Unbound operand of @SocketCANtest.PTCSet concatenation.");
if (val_ptr->n_elements == 0) return other_value;
if (other_value.val_ptr->n_elements == 0) return *this;
PTCSet 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 COMPONENT(*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 COMPONENT(*other_value.val_ptr->value_elements[i]);
}
}
return ret_val;
}
PTCSet PTCSet::substr(int index, int returncount) const
{
if (val_ptr == NULL) TTCN_error("The first argument of substr() is an unbound value of type @SocketCANtest.PTCSet.");
check_substr_arguments(val_ptr->n_elements, index, returncount, "@SocketCANtest.PTCSet","element");
PTCSet 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 COMPONENT(*val_ptr->value_elements[i+index]);
}
}
return ret_val;
}
PTCSet PTCSet::replace(int index, int len, const PTCSet& repl) const
{
if (val_ptr == NULL) TTCN_error("The first argument of replace() is an unbound value of type @SocketCANtest.PTCSet.");
if (repl.val_ptr == NULL) TTCN_error("The fourth argument of replace() is an unbound value of type @SocketCANtest.PTCSet.");
check_replace_arguments(val_ptr->n_elements, index, len, "@SocketCANtest.PTCSet","element");
PTCSet 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 COMPONENT(*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 COMPONENT(*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 COMPONENT(*val_ptr->value_elements[index+i+len]);
}
}
return ret_val;
}
PTCSet PTCSet::replace(int index, int len, const PTCSet_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 PTCSet::set_size(int new_size)
{
if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a value of type @SocketCANtest.PTCSet.");
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 = (COMPONENT**)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 COMPONENT(*(val_ptr->value_elements[elem_count]));
}
}
clean_up();
val_ptr = new_val_ptr;
}
if (new_size > val_ptr->n_elements) {
val_ptr->value_elements = (COMPONENT**)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 @SocketCANtest.PTCSet: %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 = (COMPONENT**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size);
val_ptr->n_elements = new_size;
}
}
boolean PTCSet::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 PTCSet::size_of() const
{
if (val_ptr == NULL) TTCN_error("Performing sizeof operation on an unbound value of type @SocketCANtest.PTCSet.");
return val_ptr->n_elements;
}
int PTCSet::lengthof() const
{
if (val_ptr == NULL) TTCN_error("Performing lengthof operation on an unbound value of type @SocketCANtest.PTCSet.");
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 PTCSet::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 PTCSet::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", "@SocketCANtest.PTCSet");
}
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", "@SocketCANtest.PTCSet");
}
break;
default:
TTCN_error("Internal error: Unknown operation type.");
}
}
void PTCSet::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 PTCSet::encode_text(Text_Buf& text_buf) const
{
if (val_ptr == NULL) TTCN_error("Text encoder: Encoding an unbound value of type @SocketCANtest.PTCSet.");
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 PTCSet::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 @SocketCANtest.PTCSet.");
val_ptr->value_elements = (COMPONENT**)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 COMPONENT;
val_ptr->value_elements[elem_count]->decode_text(text_buf);
}
}
void PTCSet_template::copy_value(const PTCSet& other_value)
{
if (!other_value.is_bound()) TTCN_error("Initialization of a template of type @SocketCANtest.PTCSet with an unbound value.");
single_value.n_elements = other_value.size_of();
single_value.value_elements = (COMPONENT_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 COMPONENT_template(other_value[elem_count]);
} else {
single_value.value_elements[elem_count] = new COMPONENT_template;
}
}
set_selection(SPECIFIC_VALUE);
}
void PTCSet_template::copy_template(const PTCSet_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 = (COMPONENT_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 COMPONENT_template(*other_value.single_value.value_elements[elem_count]);
} else {
single_value.value_elements[elem_count] = new COMPONENT_template;
}
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new PTCSet_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;
default:
TTCN_error("Copying an uninitialized/unsupported template of type @SocketCANtest.PTCSet.");
break;
}
set_selection(other_value);
}
boolean PTCSet_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 PTCSet_template*)template_ptr)->single_value.value_elements[template_index]->match((*(const PTCSet*)value_ptr)[value_index], legacy);
else return ((const PTCSet_template*)template_ptr)->single_value.value_elements[template_index]->is_any_or_omit();
}
PTCSet_template::PTCSet_template()
{
}
PTCSet_template::PTCSet_template(template_sel other_value)
: Record_Of_Template(other_value)
{
check_single_selection(other_value);
}
PTCSet_template::PTCSet_template(null_type)
: Record_Of_Template(SPECIFIC_VALUE)
{
single_value.n_elements = 0;
single_value.value_elements = NULL;
}
PTCSet_template::PTCSet_template(const PTCSet& other_value)
{
copy_value(other_value);
}
PTCSet_template::PTCSet_template(const OPTIONAL<PTCSet>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const PTCSet&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of type @SocketCANtest.PTCSet from an unbound optional field.");
}
}
PTCSet_template::PTCSet_template(const PTCSet_template& other_value)
: Record_Of_Template()
{
copy_template(other_value);
}
PTCSet_template::~PTCSet_template()
{
clean_up();
}
void PTCSet_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:
delete [] value_list.list_value;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}
PTCSet_template& PTCSet_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}
PTCSet_template& PTCSet_template::operator=(null_type)
{
clean_up();
set_selection(SPECIFIC_VALUE);
single_value.n_elements = 0;
single_value.value_elements = NULL;
return *this;
}
PTCSet_template& PTCSet_template::operator=(const PTCSet& other_value)
{
clean_up();
copy_value(other_value);
return *this;
}
PTCSet_template& PTCSet_template::operator=(const OPTIONAL<PTCSet>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const PTCSet&)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 @SocketCANtest.PTCSet.");
}
return *this;
}
PTCSet_template& PTCSet_template::operator=(const PTCSet_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}
COMPONENT_template& PTCSet_template::operator[](int index_value)
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @SocketCANtest.PTCSet 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 @SocketCANtest.PTCSet.");
break;
}
return *single_value.value_elements[index_value];
}
COMPONENT_template& PTCSet_template::operator[](const INTEGER& index_value)
{
index_value.must_bound("Using an unbound integer value for indexing a template of type @SocketCANtest.PTCSet.");
return (*this)[(int)index_value];
}
const COMPONENT_template& PTCSet_template::operator[](int index_value) const
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @SocketCANtest.PTCSet using a negative index: %d.", index_value);
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing an element of a non-specific template for type @SocketCANtest.PTCSet.");
if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @SocketCANtest.PTCSet: 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 COMPONENT_template& PTCSet_template::operator[](const INTEGER& index_value) const
{
index_value.must_bound("Using an unbound integer value for indexing a template of type @SocketCANtest.PTCSet.");
return (*this)[(int)index_value];
}
void PTCSet_template::set_size(int new_size)
{
if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a template of type @SocketCANtest.PTCSet.");
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 = (COMPONENT_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 COMPONENT_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 COMPONENT_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 = (COMPONENT_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size);
single_value.n_elements = new_size;
}
}
int PTCSet_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 PTCSet_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 @SocketCANtest.PTCSet 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 @SocketCANtest.PTCSet 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 @SocketCANtest.PTCSet 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 @SocketCANtest.PTCSet 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 @SocketCANtest.PTCSet 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 @SocketCANtest.PTCSet containing complemented list.", op_name);
default:
TTCN_error("Performing %sof() operation on an uninitialized/unsupported template of type @SocketCANtest.PTCSet.", op_name);
}
return check_section_is_single(min_size, has_any_or_none, op_name, "a", "template of type @SocketCANtest.PTCSet");
}
boolean PTCSet_template::match(const PTCSet& 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;
default:
TTCN_error("Matching with an uninitialized/unsupported template of type @SocketCANtest.PTCSet.");
}
return FALSE;
}
boolean PTCSet_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;
}
PTCSet PTCSet_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 @SocketCANtest.PTCSet.");
PTCSet 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;
}
PTCSet PTCSet_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);
}
PTCSet PTCSet_template::replace(int index, int len, const PTCSet_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());
}
PTCSet PTCSet_template::replace(int index, int len, const PTCSet& 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 PTCSet_template::set_type(template_sel template_type, unsigned int list_length)
{
clean_up();
switch (template_type) {
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = list_length;
value_list.list_value = new PTCSet_template[list_length];
break;
default:
TTCN_error("Internal error: Setting an invalid type for a template of type @SocketCANtest.PTCSet.");
}
set_selection(template_type);
}
PTCSet_template& PTCSet_template::list_item(unsigned int list_index)
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST) TTCN_error("Internal error: Accessing a list element of a non-list template of type @SocketCANtest.PTCSet.");
if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of type @SocketCANtest.PTCSet.");
return value_list.list_value[list_index];
}
void PTCSet_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 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;
default:
log_generic();
}
log_restricted();
log_ifpresent();
}
void PTCSet_template::log_match(const PTCSet& 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 PTCSet_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 @SocketCANtest.PTCSet.");
}
}
void PTCSet_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 @SocketCANtest.PTCSet.");
single_value.value_elements = (COMPONENT_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 COMPONENT_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 PTCSet_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 @SocketCANtest.PTCSet.");
}
}
boolean PTCSet_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}
boolean PTCSet_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
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 PTCSet_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: {
PTCSet_template temp;
temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : COMPLEMENTED_LIST, param.get_size());
for (size_t p_i=0; p_i<param.get_size(); p_i++) {
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;
default:
param.type_error("record of template", "@SocketCANtest.PTCSet");
}
is_ifpresent = param.get_ifpresent();
set_length_range(param);
}
void PTCSet_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 : "@SocketCANtest.PTCSet");
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 : "@SocketCANtest.PTCSet");
}
boolean PTCSet_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);
}
}
alt__awaitPhaseStartReq_Default::alt__awaitPhaseStartReq_Default(const e__Phase& p__phase)
: Default_Base("alt_awaitPhaseStartReq"), par_p__phase(p__phase)
{
}
alt_status alt__awaitPhaseStartReq_Default::call_altstep()
{
return alt__awaitPhaseStartReq_instance(par_p__phase);
}
/* Bodies of functions, altsteps and testcases */
boolean operator==(null_type, const BCM__cmds& other_value)
{
if (other_value.val_ptr == NULL)
TTCN_error("The right operand of comparison is an unbound value of type @SocketCANtest.BCM_cmds.");
return other_value.val_ptr->n_elements == 0;
}
boolean operator==(null_type, const SocketCAN__CAN__or__CAN__FD__frames& other_value)
{
if (other_value.val_ptr == NULL)
TTCN_error("The right operand of comparison is an unbound value of type @SocketCANtest.SocketCAN_CAN_or_CAN_FD_frames.");
return other_value.val_ptr->n_elements == 0;
}
boolean operator==(null_type, const PTCSet& other_value)
{
if (other_value.val_ptr == NULL)
TTCN_error("The right operand of comparison is an unbound value of type @SocketCANtest.PTCSet.");
return other_value.val_ptr->n_elements == 0;
}
alt_status alt__awaitPhaseStartReq_instance(const e__Phase& p__phase)
{
TTCN_Location current_location("SocketCANtest.ttcn", 99, TTCN_Location::LOCATION_ALTSTEP, "alt_awaitPhaseStartReq");
current_location.update_lineno(100);
#line 100 "SocketCANtest.ttcn"
PhaseStartReq v__PhaseStartReq;
alt_status ret_val = ALT_NO;
current_location.update_lineno(101);
#line 101 "SocketCANtest.ttcn"
{
alt_status tmp_1;
{
PhaseStartReq_template tmp_0;
tmp_0.phase() = p__phase;
tmp_0.phase__int() = ANY_VALUE;
tmp_1 = PTC_component_pt__sync.receive(tmp_0, NULL, any_compref, NULL, NULL, NULL);
}
switch (tmp_1) {
case ALT_YES:
{
current_location.update_lineno(102);
#line 102 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("PTC name: ");
{
COMPONENT tmp_2(self);
tmp_2.log();
}
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(103);
#line 103 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("Waits for start of phase: ");
p__phase.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
}
current_location.update_lineno(106);
#line 106 "SocketCANtest.ttcn"
{
alt_status tmp_5;
{
PhaseStartReq_template tmp_3;
tmp_3.phase() = ANY_VALUE;
{
INTEGER_template& tmp_4 = tmp_3.phase__int();
tmp_4.set_type(VALUE_RANGE);
tmp_4.set_min(0);
tmp_4.set_max(e__Phase::enum2int(PTC_component_v__phase));
}
tmp_5 = PTC_component_pt__sync.receive(tmp_3, &(v__PhaseStartReq), any_compref, NULL, NULL, NULL);
}
switch (tmp_5) {
case ALT_YES:
{
current_location.update_lineno(109);
#line 109 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("PTC name: ");
{
COMPONENT tmp_6(self);
tmp_6.log();
}
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(110);
#line 110 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("Waits for start of phase: ");
p__phase.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(111);
#line 111 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("Received completion of phase: ");
p__phase.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(112);
#line 112 "SocketCANtest.ttcn"
f__sendPhaseEndInd();
current_location.update_lineno(113);
#line 113 "SocketCANtest.ttcn"
return ALT_REPEAT;
}
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
}
current_location.update_lineno(115);
#line 115 "SocketCANtest.ttcn"
{
alt_status tmp_8;
{
PhaseStartReq_template tmp_7;
tmp_7.phase() = ANY_VALUE;
tmp_7.phase__int() = ANY_VALUE;
tmp_8 = PTC_component_pt__sync.receive(tmp_7, &(v__PhaseStartReq), any_compref, NULL, NULL, NULL);
}
switch (tmp_8) {
case ALT_YES:
{
current_location.update_lineno(116);
#line 116 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("Received unexpected message:");
v__PhaseStartReq.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(116);
#line 116 "SocketCANtest.ttcn"
TTCN_Runtime::setverdict(INCONC);
}
return ALT_YES;
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
}
return ret_val;
}
void alt__awaitPhaseStartReq(const e__Phase& p__phase)
{
altstep_begin:
boolean block_flag = FALSE;
alt_status altstep_flag = ALT_UNCHECKED, default_flag = ALT_UNCHECKED;
for ( ; ; ) {
TTCN_Snapshot::take_new(block_flag);
if (altstep_flag != ALT_NO) {
altstep_flag = alt__awaitPhaseStartReq_instance(p__phase);
if (altstep_flag == ALT_YES || altstep_flag == ALT_BREAK) return;
else if (altstep_flag == ALT_REPEAT) goto altstep_begin;
}
if (default_flag != ALT_NO) {
default_flag = TTCN_Default::try_altsteps();
if (default_flag == ALT_YES || default_flag == ALT_BREAK) return;
else if (default_flag == ALT_REPEAT) goto altstep_begin;
}
if (altstep_flag == ALT_NO && default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in altstep alt_awaitPhaseStartReq.");
else block_flag = TRUE;
}
}
Default_Base *activate_alt__awaitPhaseStartReq(const e__Phase& p__phase)
{
return new alt__awaitPhaseStartReq_Default(p__phase);
}
void f__startPhase(const e__Phase& p__phase)
{
TTCN_Location current_location("SocketCANtest.ttcn", 119, TTCN_Location::LOCATION_FUNCTION, "f_startPhase");
current_location.update_lineno(120);
#line 120 "SocketCANtest.ttcn"
INTEGER v__i;
current_location.update_lineno(121);
#line 121 "SocketCANtest.ttcn"
INTEGER v__amount(MTC_component_v__PTCSet.size_of());
current_location.update_lineno(122);
#line 122 "SocketCANtest.ttcn"
PhaseStartReq v__phaseStartReq;
v__phaseStartReq.phase() = p__phase;
v__phaseStartReq.phase__int() = e__Phase::enum2int(p__phase);
current_location.update_lineno(124);
#line 124 "SocketCANtest.ttcn"
v__i = 0;
current_location.update_lineno(124);
#line 124 "SocketCANtest.ttcn"
for ( ; ; ) {
current_location.update_lineno(124);
#line 124 "SocketCANtest.ttcn"
if (!(v__i < v__amount)) break;
current_location.update_lineno(125);
#line 125 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("MTC instance: ");
{
COMPONENT tmp_10(self);
tmp_10.log();
}
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(126);
#line 126 "SocketCANtest.ttcn"
MTC_component_pt__sync.send(v__phaseStartReq, const_cast< const PTCSet&>(MTC_component_v__PTCSet)[v__i], NULL);
current_location.update_lineno(124);
#line 124 "SocketCANtest.ttcn"
{
INTEGER tmp_11;
++v__i;
}
}
}
void start_f__startPhase(const COMPONENT& component_reference, const e__Phase& p__phase)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_startPhase(");
p__phase.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "SocketCANtest", "f_startPhase", text_buf);
p__phase.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}
e__Phase f__incPTCPhase(const e__Phase& p__currentPhase)
{
TTCN_Location current_location("SocketCANtest.ttcn", 130, TTCN_Location::LOCATION_FUNCTION, "f_incPTCPhase");
current_location.update_lineno(131);
#line 131 "SocketCANtest.ttcn"
e__Phase v__nextPhase;
current_location.update_lineno(132);
#line 132 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("PTC: ");
{
COMPONENT tmp_12(self);
tmp_12.log();
}
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(133);
#line 133 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("PTC instance: ");
{
COMPONENT tmp_13(self);
tmp_13.log();
}
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(134);
#line 134 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("Current PTC phase: ");
p__currentPhase.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(135);
#line 135 "SocketCANtest.ttcn"
v__nextPhase.int2enum((e__Phase::enum2int(p__currentPhase) + 1));
current_location.update_lineno(136);
#line 136 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("Next PTC phase:");
v__nextPhase.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(137);
#line 137 "SocketCANtest.ttcn"
return v__nextPhase;
}
void start_f__incPTCPhase(const COMPONENT& component_reference, const e__Phase& p__currentPhase)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_incPTCPhase(");
p__currentPhase.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "SocketCANtest", "f_incPTCPhase", text_buf);
p__currentPhase.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}
void f__sendPhaseEndInd()
{
TTCN_Location current_location("SocketCANtest.ttcn", 140, TTCN_Location::LOCATION_FUNCTION, "f_sendPhaseEndInd");
current_location.update_lineno(142);
#line 142 "SocketCANtest.ttcn"
PhaseEndInd v__PhaseEndInd;
v__PhaseEndInd.phase() = PTC_component_v__phase;
v__PhaseEndInd.phase__int() = e__Phase::enum2int(PTC_component_v__phase);
current_location.update_lineno(143);
#line 143 "SocketCANtest.ttcn"
PTC_component_pt__sync.send(v__PhaseEndInd, NULL);
current_location.update_lineno(144);
#line 144 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("PTC: PhaseEndInd to MTC with content: ");
v__PhaseEndInd.log();
{
COMPONENT tmp_14(self);
tmp_14.log();
}
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(145);
#line 145 "SocketCANtest.ttcn"
PTC_component_v__phase = f__incPTCPhase(e__Phase(PTC_component_v__phase));
}
void start_f__sendPhaseEndInd(const COMPONENT& component_reference)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_sendPhaseEndInd(");
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "SocketCANtest", "f_sendPhaseEndInd", text_buf);
TTCN_Runtime::send_start_component(text_buf);
}
void f__addSyncSlaveSet(const COMPONENT& p__slave, PTCSet& p__set)
{
TTCN_Location current_location("SocketCANtest.ttcn", 148, TTCN_Location::LOCATION_FUNCTION, "f_addSyncSlaveSet");
current_location.update_lineno(150);
#line 150 "SocketCANtest.ttcn"
p__set[p__set.size_of()] = p__slave;
current_location.update_lineno(151);
#line 151 "SocketCANtest.ttcn"
return;
}
e__Phase f__incMTCPhase(const e__Phase& p__currentPhase)
{
TTCN_Location current_location("SocketCANtest.ttcn", 154, TTCN_Location::LOCATION_FUNCTION, "f_incMTCPhase");
current_location.update_lineno(155);
#line 155 "SocketCANtest.ttcn"
e__Phase v__nextPhase;
current_location.update_lineno(156);
#line 156 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("MTC: ");
{
COMPONENT tmp_17(self);
tmp_17.log();
}
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(157);
#line 157 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("Current phase: ");
p__currentPhase.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(158);
#line 158 "SocketCANtest.ttcn"
v__nextPhase.int2enum((e__Phase::enum2int(p__currentPhase) + 1));
current_location.update_lineno(159);
#line 159 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("Next phase:");
v__nextPhase.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(160);
#line 160 "SocketCANtest.ttcn"
return v__nextPhase;
}
void start_f__incMTCPhase(const COMPONENT& component_reference, const e__Phase& p__currentPhase)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_incMTCPhase(");
p__currentPhase.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "SocketCANtest", "f_incMTCPhase", text_buf);
p__currentPhase.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}
void f__awaitEndPhase(const e__Phase& p__phase)
{
TTCN_Location current_location("SocketCANtest.ttcn", 163, TTCN_Location::LOCATION_FUNCTION, "f_awaitEndPhase");
current_location.update_lineno(164);
#line 164 "SocketCANtest.ttcn"
INTEGER v__amount(MTC_component_v__PTCSet.size_of());
current_location.update_lineno(165);
#line 165 "SocketCANtest.ttcn"
INTEGER v__i;
current_location.update_lineno(166);
#line 166 "SocketCANtest.ttcn"
MTC_component_t__guard.start(1.0e1);
current_location.update_lineno(167);
#line 167 "SocketCANtest.ttcn"
PhaseEndInd v__PhaseEndInd;
current_location.update_lineno(169);
#line 169 "SocketCANtest.ttcn"
v__i = 0;
current_location.update_lineno(169);
#line 169 "SocketCANtest.ttcn"
for ( ; ; ) {
current_location.update_lineno(169);
#line 169 "SocketCANtest.ttcn"
if (!(v__i < v__amount)) break;
current_location.update_lineno(170);
#line 170 "SocketCANtest.ttcn"
{
tmp_19:
alt_status tmp_19_alt_flag_0 = ALT_MAYBE;
alt_status tmp_19_alt_flag_1 = ALT_MAYBE;
alt_status tmp_19_alt_flag_2 = ALT_MAYBE;
alt_status tmp_19_alt_flag_3 = ALT_MAYBE;
alt_status tmp_19_alt_flag_4 = ALT_MAYBE;
alt_status tmp_19_default_flag = ALT_MAYBE;
TTCN_Snapshot::take_new(FALSE);
for ( ; ; ) {
if (tmp_19_alt_flag_0 == ALT_MAYBE) {
current_location.update_lineno(171);
#line 171 "SocketCANtest.ttcn"
{
PhaseEndInd_template tmp_20;
tmp_20.phase() = p__phase;
tmp_20.phase__int() = ANY_VALUE;
tmp_19_alt_flag_0 = MTC_component_pt__sync.receive(tmp_20, NULL, any_compref, NULL, NULL, NULL);
}
if (tmp_19_alt_flag_0 == ALT_YES) break;
}
if (tmp_19_alt_flag_1 == ALT_MAYBE) {
current_location.update_lineno(173);
#line 173 "SocketCANtest.ttcn"
{
PhaseEndInd_template tmp_21;
tmp_21.phase() = ANY_VALUE;
{
INTEGER_template& tmp_22 = tmp_21.phase__int();
tmp_22.set_type(VALUE_RANGE);
tmp_22.set_min(e__Phase::enum2int(p__phase));
tmp_22.set_max(10);
}
tmp_19_alt_flag_1 = MTC_component_pt__sync.receive(tmp_21, NULL, any_compref, NULL, NULL, NULL);
}
if (tmp_19_alt_flag_1 == ALT_YES) break;
}
if (tmp_19_alt_flag_2 == ALT_MAYBE) {
current_location.update_lineno(174);
#line 174 "SocketCANtest.ttcn"
tmp_19_alt_flag_2 = MTC_component_t__guard.timeout(NULL);
if (tmp_19_alt_flag_2 == ALT_YES) {
current_location.update_lineno(175);
#line 175 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("Timeout in MTC phase:");
p__phase.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(176);
#line 176 "SocketCANtest.ttcn"
TTCN_Runtime::setverdict(INCONC);
break;
}
}
if (tmp_19_alt_flag_3 == ALT_MAYBE) {
current_location.update_lineno(178);
#line 178 "SocketCANtest.ttcn"
tmp_19_alt_flag_3 = MTC_component_pt__sync.receive(PhaseEndInd_template(ANY_VALUE), &(v__PhaseEndInd), any_compref, NULL, NULL, NULL);
if (tmp_19_alt_flag_3 == ALT_YES) {
current_location.update_lineno(179);
#line 179 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("Unexpected phase recieved: ");
v__PhaseEndInd.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(180);
#line 180 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("Expected phase range: ");
p__phase.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(181);
#line 181 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str(" to ");
c__testcase__complete.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(182);
#line 182 "SocketCANtest.ttcn"
TTCN_Runtime::setverdict(INCONC);
break;
}
}
if (tmp_19_alt_flag_4 == ALT_MAYBE) {
current_location.update_lineno(184);
#line 184 "SocketCANtest.ttcn"
tmp_19_alt_flag_4 = PORT::any_receive(any_compref, NULL, NULL);
if (tmp_19_alt_flag_4 == ALT_YES) {
current_location.update_lineno(185);
#line 185 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("Expected phase:");
p__phase.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(186);
#line 186 "SocketCANtest.ttcn"
TTCN_Runtime::setverdict(INCONC);
break;
}
}
if (tmp_19_default_flag == ALT_MAYBE) {
tmp_19_default_flag = TTCN_Default::try_altsteps();
if (tmp_19_default_flag == ALT_YES || tmp_19_default_flag == ALT_BREAK) break;
else if (tmp_19_default_flag == ALT_REPEAT) goto tmp_19;
}
current_location.update_lineno(170);
#line 170 "SocketCANtest.ttcn"
if (tmp_19_alt_flag_0 == ALT_NO && tmp_19_alt_flag_1 == ALT_NO && tmp_19_alt_flag_2 == ALT_NO && tmp_19_alt_flag_3 == ALT_NO && tmp_19_alt_flag_4 == ALT_NO && tmp_19_default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in the alt statement in file SocketCANtest.ttcn between lines 170 and 188.");
TTCN_Snapshot::take_new(TRUE);
}
}
current_location.update_lineno(169);
#line 169 "SocketCANtest.ttcn"
{
INTEGER tmp_23;
++v__i;
}
}
current_location.update_lineno(190);
#line 190 "SocketCANtest.ttcn"
MTC_component_t__guard.stop();
}
void start_f__awaitEndPhase(const COMPONENT& component_reference, const e__Phase& p__phase)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_awaitEndPhase(");
p__phase.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "SocketCANtest", "f_awaitEndPhase", text_buf);
p__phase.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}
SocketCAN__Types::SocketCAN__socket__result f__open__socket(const SocketCAN__open__socket__type& v__socket__type)
{
TTCN_Location current_location("SocketCANtest.ttcn", 193, TTCN_Location::LOCATION_FUNCTION, "f_open_socket");
current_location.update_lineno(197);
#line 197 "SocketCANtest.ttcn"
SocketCAN__Types::SocketCAN__socket__result v__result;
current_location.update_lineno(198);
#line 198 "SocketCANtest.ttcn"
TIMER t__guard("t_guard");
current_location.update_lineno(199);
#line 199 "SocketCANtest.ttcn"
t__guard.start(1.0e1);
current_location.update_lineno(201);
#line 201 "SocketCANtest.ttcn"
SocketCAN__Types::SocketCAN__socket socket;
current_location.update_lineno(203);
#line 203 "SocketCANtest.ttcn"
if ((v__socket__type == SocketCAN__open__socket__type::OPEN__CAN__RAW)) {
current_location.update_lineno(204);
#line 204 "SocketCANtest.ttcn"
socket.domain() = Can::AdresseFamily__enum::PF__CAN;
socket.ptype() = Can::ProtocolFamily__enum::SOCK__RAW;
socket.protocol() = Can::PF__CAN__protocols__enum::CAN__RAW;
}
else {
current_location.update_lineno(205);
#line 205 "SocketCANtest.ttcn"
if ((v__socket__type == SocketCAN__open__socket__type::OPEN__CAN__BCM)) {
current_location.update_lineno(206);
#line 206 "SocketCANtest.ttcn"
socket.domain() = Can::AdresseFamily__enum::PF__CAN;
socket.ptype() = Can::ProtocolFamily__enum::SOCK__DGRAM;
socket.protocol() = Can::PF__CAN__protocols__enum::CAN__BCM;
}
}
current_location.update_lineno(208);
#line 208 "SocketCANtest.ttcn"
PTC_component_pt__socketCAN.send(socket, NULL);
current_location.update_lineno(211);
#line 211 "SocketCANtest.ttcn"
{
tmp_26:
alt_status tmp_26_alt_flag_0 = ALT_MAYBE;
alt_status tmp_26_alt_flag_1 = ALT_MAYBE;
alt_status tmp_26_alt_flag_2 = ALT_MAYBE;
alt_status tmp_26_alt_flag_3 = ALT_MAYBE;
alt_status tmp_26_default_flag = ALT_MAYBE;
TTCN_Snapshot::take_new(FALSE);
for ( ; ; ) {
if (tmp_26_alt_flag_0 == ALT_MAYBE) {
current_location.update_lineno(212);
#line 212 "SocketCANtest.ttcn"
tmp_26_alt_flag_0 = PTC_component_pt__socketCAN.receive(SocketCAN__Templates::a__SocketCAN__socket__result(SocketCAN__Templates::a__result(SocketCAN__Types::SocketCAN__Result__code::SocketCAN__SUCCESS)), &(v__result), any_compref, NULL, NULL, NULL);
if (tmp_26_alt_flag_0 == ALT_YES) {
current_location.update_lineno(214);
#line 214 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("SocketCan:Socket opened: ");
const_cast< const SocketCAN__Types::SocketCAN__socket__result&>(v__result).id().log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
break;
}
}
if (tmp_26_alt_flag_1 == ALT_MAYBE) {
current_location.update_lineno(215);
#line 215 "SocketCANtest.ttcn"
tmp_26_alt_flag_1 = PTC_component_pt__socketCAN.receive(SocketCAN__Templates::a__SocketCAN__socket__result(SocketCAN__Templates::a__result(SocketCAN__Types::SocketCAN__Result__code::SocketCAN__ERROR)), NULL, any_compref, NULL, NULL, NULL);
if (tmp_26_alt_flag_1 == ALT_YES) {
current_location.update_lineno(216);
#line 216 "SocketCANtest.ttcn"
TTCN_Logger::log_str(TTCN_USER, "Received Opening Socket failed");
current_location.update_lineno(216);
#line 216 "SocketCANtest.ttcn"
TTCN_Runtime::setverdict(FAIL);
break;
}
}
if (tmp_26_alt_flag_2 == ALT_MAYBE) {
current_location.update_lineno(217);
#line 217 "SocketCANtest.ttcn"
tmp_26_alt_flag_2 = t__guard.timeout(NULL);
if (tmp_26_alt_flag_2 == ALT_YES) {
current_location.update_lineno(218);
#line 218 "SocketCANtest.ttcn"
TTCN_Logger::log_str(TTCN_USER, "timeout!");
current_location.update_lineno(219);
#line 219 "SocketCANtest.ttcn"
TTCN_Runtime::setverdict(FAIL);
break;
}
}
if (tmp_26_alt_flag_3 == ALT_MAYBE) {
current_location.update_lineno(220);
#line 220 "SocketCANtest.ttcn"
tmp_26_alt_flag_3 = t__guard.timeout(NULL);
if (tmp_26_alt_flag_3 == ALT_YES) {
current_location.update_lineno(221);
#line 221 "SocketCANtest.ttcn"
TTCN_Logger::log_str(TTCN_USER, "timeout!");
current_location.update_lineno(222);
#line 222 "SocketCANtest.ttcn"
TTCN_Runtime::setverdict(FAIL);
break;
}
}
if (tmp_26_default_flag == ALT_MAYBE) {
tmp_26_default_flag = TTCN_Default::try_altsteps();
if (tmp_26_default_flag == ALT_YES || tmp_26_default_flag == ALT_BREAK) break;
else if (tmp_26_default_flag == ALT_REPEAT) goto tmp_26;
}
current_location.update_lineno(211);
#line 211 "SocketCANtest.ttcn"
if (tmp_26_alt_flag_0 == ALT_NO && tmp_26_alt_flag_1 == ALT_NO && tmp_26_alt_flag_2 == ALT_NO && tmp_26_alt_flag_3 == ALT_NO && tmp_26_default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in the alt statement in file SocketCANtest.ttcn between lines 211 and 223.");
TTCN_Snapshot::take_new(TRUE);
}
}
current_location.update_lineno(224);
#line 224 "SocketCANtest.ttcn"
t__guard.stop();
current_location.update_lineno(225);
#line 225 "SocketCANtest.ttcn"
return v__result;
}
void start_f__open__socket(const COMPONENT& component_reference, const SocketCAN__open__socket__type& v__socket__type)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_open_socket(");
v__socket__type.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "SocketCANtest", "f_open_socket", text_buf);
v__socket__type.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}
SocketCAN__Types::SocketCAN__ioctl__result f__ioctl__get__if__index(const INTEGER& p__socket__id)
{
TTCN_Location current_location("SocketCANtest.ttcn", 228, TTCN_Location::LOCATION_FUNCTION, "f_ioctl_get_if_index");
current_location.update_lineno(231);
#line 231 "SocketCANtest.ttcn"
SocketCAN__Types::SocketCAN__ioctl__result v__result;
current_location.update_lineno(232);
#line 232 "SocketCANtest.ttcn"
TIMER t__guard("t_guard");
current_location.update_lineno(233);
#line 233 "SocketCANtest.ttcn"
t__guard.start(1.0e1);
current_location.update_lineno(235);
#line 235 "SocketCANtest.ttcn"
{
SocketCAN__Types::SocketCAN__ioctl_template tmp_27;
tmp_27.id() = p__socket__id;
tmp_27.ifu() = OMIT_VALUE;
PTC_component_pt__socketCAN.send(tmp_27, NULL);
}
current_location.update_lineno(237);
#line 237 "SocketCANtest.ttcn"
{
tmp_28:
alt_status tmp_28_alt_flag_0 = ALT_MAYBE;
alt_status tmp_28_alt_flag_1 = ALT_MAYBE;
alt_status tmp_28_alt_flag_2 = ALT_MAYBE;
alt_status tmp_28_default_flag = ALT_MAYBE;
TTCN_Snapshot::take_new(FALSE);
for ( ; ; ) {
if (tmp_28_alt_flag_0 == ALT_MAYBE) {
current_location.update_lineno(238);
#line 238 "SocketCANtest.ttcn"
tmp_28_alt_flag_0 = PTC_component_pt__socketCAN.receive(SocketCAN__Templates::a__SocketCAN__ioctl__result(SocketCAN__Templates::a__result(SocketCAN__Types::SocketCAN__Result__code::SocketCAN__SUCCESS)), &(v__result), any_compref, NULL, NULL, NULL);
if (tmp_28_alt_flag_0 == ALT_YES) {
current_location.update_lineno(239);
#line 239 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("Retrieved interface index");
const_cast< const SocketCAN__Types::SocketCAN__ioctl__result&>(v__result).ifr().if__index().log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
break;
}
}
if (tmp_28_alt_flag_1 == ALT_MAYBE) {
current_location.update_lineno(240);
#line 240 "SocketCANtest.ttcn"
tmp_28_alt_flag_1 = PTC_component_pt__socketCAN.receive(SocketCAN__Templates::a__SocketCAN__ioctl__result(SocketCAN__Templates::a__result(SocketCAN__Types::SocketCAN__Result__code::SocketCAN__ERROR)), NULL, any_compref, NULL, NULL, NULL);
if (tmp_28_alt_flag_1 == ALT_YES) {
current_location.update_lineno(241);
#line 241 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("Retrieving interface index failed");
p__socket__id.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(241);
#line 241 "SocketCANtest.ttcn"
TTCN_Runtime::setverdict(FAIL);
break;
}
}
if (tmp_28_alt_flag_2 == ALT_MAYBE) {
current_location.update_lineno(242);
#line 242 "SocketCANtest.ttcn"
tmp_28_alt_flag_2 = t__guard.timeout(NULL);
if (tmp_28_alt_flag_2 == ALT_YES) {
current_location.update_lineno(243);
#line 243 "SocketCANtest.ttcn"
TTCN_Logger::log_str(TTCN_USER, "timeout!");
current_location.update_lineno(244);
#line 244 "SocketCANtest.ttcn"
TTCN_Runtime::setverdict(FAIL);
break;
}
}
if (tmp_28_default_flag == ALT_MAYBE) {
tmp_28_default_flag = TTCN_Default::try_altsteps();
if (tmp_28_default_flag == ALT_YES || tmp_28_default_flag == ALT_BREAK) break;
else if (tmp_28_default_flag == ALT_REPEAT) goto tmp_28;
}
current_location.update_lineno(237);
#line 237 "SocketCANtest.ttcn"
if (tmp_28_alt_flag_0 == ALT_NO && tmp_28_alt_flag_1 == ALT_NO && tmp_28_alt_flag_2 == ALT_NO && tmp_28_default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in the alt statement in file SocketCANtest.ttcn between lines 237 and 246.");
TTCN_Snapshot::take_new(TRUE);
}
}
current_location.update_lineno(247);
#line 247 "SocketCANtest.ttcn"
return v__result;
}
void start_f__ioctl__get__if__index(const COMPONENT& component_reference, const INTEGER& p__socket__id)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_ioctl_get_if_index(");
p__socket__id.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "SocketCANtest", "f_ioctl_get_if_index", text_buf);
p__socket__id.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}
SocketCAN__Types::SocketCAN__connect__result f__connect(const INTEGER& p__socket__id, const INTEGER& p__if__index)
{
TTCN_Location current_location("SocketCANtest.ttcn", 250, TTCN_Location::LOCATION_FUNCTION, "f_connect");
current_location.update_lineno(254);
#line 254 "SocketCANtest.ttcn"
SocketCAN__Types::SocketCAN__connect__result v__result;
current_location.update_lineno(255);
#line 255 "SocketCANtest.ttcn"
TIMER t__guard("t_guard");
current_location.update_lineno(256);
#line 256 "SocketCANtest.ttcn"
t__guard.start(1.0e1);
current_location.update_lineno(258);
#line 258 "SocketCANtest.ttcn"
{
SocketCAN__Types::SocketCAN__connect_template tmp_29;
tmp_29.id() = p__socket__id;
tmp_29.connectu().bcm().if__index() = p__if__index;
PTC_component_pt__socketCAN.send(tmp_29, NULL);
}
current_location.update_lineno(260);
#line 260 "SocketCANtest.ttcn"
{
tmp_30:
alt_status tmp_30_alt_flag_0 = ALT_MAYBE;
alt_status tmp_30_alt_flag_1 = ALT_MAYBE;
alt_status tmp_30_alt_flag_2 = ALT_MAYBE;
alt_status tmp_30_default_flag = ALT_MAYBE;
TTCN_Snapshot::take_new(FALSE);
for ( ; ; ) {
if (tmp_30_alt_flag_0 == ALT_MAYBE) {
current_location.update_lineno(261);
#line 261 "SocketCANtest.ttcn"
tmp_30_alt_flag_0 = PTC_component_pt__socketCAN.receive(SocketCAN__Templates::a__SocketCAN__connect__result(SocketCAN__Templates::a__result(SocketCAN__Types::SocketCAN__Result__code::SocketCAN__SUCCESS)), &(v__result), any_compref, NULL, NULL, NULL);
if (tmp_30_alt_flag_0 == ALT_YES) {
current_location.update_lineno(262);
#line 262 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("Connecting socket");
p__socket__id.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
break;
}
}
if (tmp_30_alt_flag_1 == ALT_MAYBE) {
current_location.update_lineno(263);
#line 263 "SocketCANtest.ttcn"
tmp_30_alt_flag_1 = PTC_component_pt__socketCAN.receive(SocketCAN__Templates::a__SocketCAN__connect__result(SocketCAN__Templates::a__result(SocketCAN__Types::SocketCAN__Result__code::SocketCAN__ERROR)), NULL, any_compref, NULL, NULL, NULL);
if (tmp_30_alt_flag_1 == ALT_YES) {
current_location.update_lineno(264);
#line 264 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("Connecting socket failed.");
p__socket__id.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(264);
#line 264 "SocketCANtest.ttcn"
TTCN_Runtime::setverdict(FAIL);
break;
}
}
if (tmp_30_alt_flag_2 == ALT_MAYBE) {
current_location.update_lineno(265);
#line 265 "SocketCANtest.ttcn"
tmp_30_alt_flag_2 = t__guard.timeout(NULL);
if (tmp_30_alt_flag_2 == ALT_YES) {
current_location.update_lineno(266);
#line 266 "SocketCANtest.ttcn"
TTCN_Logger::log_str(TTCN_USER, "timeout!");
current_location.update_lineno(267);
#line 267 "SocketCANtest.ttcn"
TTCN_Runtime::setverdict(FAIL);
break;
}
}
if (tmp_30_default_flag == ALT_MAYBE) {
tmp_30_default_flag = TTCN_Default::try_altsteps();
if (tmp_30_default_flag == ALT_YES || tmp_30_default_flag == ALT_BREAK) break;
else if (tmp_30_default_flag == ALT_REPEAT) goto tmp_30;
}
current_location.update_lineno(260);
#line 260 "SocketCANtest.ttcn"
if (tmp_30_alt_flag_0 == ALT_NO && tmp_30_alt_flag_1 == ALT_NO && tmp_30_alt_flag_2 == ALT_NO && tmp_30_default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in the alt statement in file SocketCANtest.ttcn between lines 260 and 268.");
TTCN_Snapshot::take_new(TRUE);
}
}
current_location.update_lineno(269);
#line 269 "SocketCANtest.ttcn"
return v__result;
}
void start_f__connect(const COMPONENT& component_reference, const INTEGER& p__socket__id, const INTEGER& p__if__index)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_connect(");
p__socket__id.log();
TTCN_Logger::log_event_str(", ");
p__if__index.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "SocketCANtest", "f_connect", text_buf);
p__socket__id.encode_text(text_buf);
p__if__index.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}
SocketCAN__Types::SocketCAN__bind__result f__bind(const INTEGER& p__socket__id, const INTEGER& p__if__index)
{
TTCN_Location current_location("SocketCANtest.ttcn", 272, TTCN_Location::LOCATION_FUNCTION, "f_bind");
current_location.update_lineno(276);
#line 276 "SocketCANtest.ttcn"
SocketCAN__Types::SocketCAN__bind__result v__result;
current_location.update_lineno(277);
#line 277 "SocketCANtest.ttcn"
TIMER t__guard("t_guard");
current_location.update_lineno(278);
#line 278 "SocketCANtest.ttcn"
t__guard.start(1.0e1);
current_location.update_lineno(279);
#line 279 "SocketCANtest.ttcn"
{
SocketCAN__Types::SocketCAN__bind_template tmp_31;
tmp_31.id() = p__socket__id;
tmp_31.bindu().raw().if__index() = p__if__index;
PTC_component_pt__socketCAN.send(tmp_31, NULL);
}
current_location.update_lineno(280);
#line 280 "SocketCANtest.ttcn"
{
tmp_32:
alt_status tmp_32_alt_flag_0 = ALT_MAYBE;
alt_status tmp_32_alt_flag_1 = ALT_MAYBE;
alt_status tmp_32_alt_flag_2 = ALT_MAYBE;
alt_status tmp_32_default_flag = ALT_MAYBE;
TTCN_Snapshot::take_new(FALSE);
for ( ; ; ) {
if (tmp_32_alt_flag_0 == ALT_MAYBE) {
current_location.update_lineno(281);
#line 281 "SocketCANtest.ttcn"
tmp_32_alt_flag_0 = PTC_component_pt__socketCAN.receive(SocketCAN__Templates::a__SocketCAN__bind__result(SocketCAN__Templates::a__result(SocketCAN__Types::SocketCAN__Result__code::SocketCAN__SUCCESS)), &(v__result), any_compref, NULL, NULL, NULL);
if (tmp_32_alt_flag_0 == ALT_YES) {
current_location.update_lineno(282);
#line 282 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("Binding socket");
p__socket__id.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
break;
}
}
if (tmp_32_alt_flag_1 == ALT_MAYBE) {
current_location.update_lineno(283);
#line 283 "SocketCANtest.ttcn"
tmp_32_alt_flag_1 = PTC_component_pt__socketCAN.receive(SocketCAN__Templates::a__SocketCAN__bind__result(SocketCAN__Templates::a__result(SocketCAN__Types::SocketCAN__Result__code::SocketCAN__ERROR)), NULL, any_compref, NULL, NULL, NULL);
if (tmp_32_alt_flag_1 == ALT_YES) break;
}
if (tmp_32_alt_flag_2 == ALT_MAYBE) {
current_location.update_lineno(284);
#line 284 "SocketCANtest.ttcn"
tmp_32_alt_flag_2 = t__guard.timeout(NULL);
if (tmp_32_alt_flag_2 == ALT_YES) {
current_location.update_lineno(285);
#line 285 "SocketCANtest.ttcn"
TTCN_Logger::log_str(TTCN_USER, "timeout!");
current_location.update_lineno(286);
#line 286 "SocketCANtest.ttcn"
TTCN_Runtime::setverdict(FAIL);
break;
}
}
if (tmp_32_default_flag == ALT_MAYBE) {
tmp_32_default_flag = TTCN_Default::try_altsteps();
if (tmp_32_default_flag == ALT_YES || tmp_32_default_flag == ALT_BREAK) break;
else if (tmp_32_default_flag == ALT_REPEAT) goto tmp_32;
}
current_location.update_lineno(280);
#line 280 "SocketCANtest.ttcn"
if (tmp_32_alt_flag_0 == ALT_NO && tmp_32_alt_flag_1 == ALT_NO && tmp_32_alt_flag_2 == ALT_NO && tmp_32_default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in the alt statement in file SocketCANtest.ttcn between lines 280 and 288.");
TTCN_Snapshot::take_new(TRUE);
}
}
current_location.update_lineno(289);
#line 289 "SocketCANtest.ttcn"
return v__result;
}
void start_f__bind(const COMPONENT& component_reference, const INTEGER& p__socket__id, const INTEGER& p__if__index)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_bind(");
p__socket__id.log();
TTCN_Logger::log_event_str(", ");
p__if__index.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "SocketCANtest", "f_bind", text_buf);
p__socket__id.encode_text(text_buf);
p__if__index.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}
SocketCAN__Types::SocketCAN__send__data__result f__send__data(const INTEGER& p__socket__id, const SocketCAN__Types::SocketCAN__send__data__ifu& p__ifu, const SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame& p__CAN__or__CAN__FD__frame)
{
TTCN_Location current_location("SocketCANtest.ttcn", 292, TTCN_Location::LOCATION_FUNCTION, "f_send_data");
current_location.update_lineno(297);
#line 297 "SocketCANtest.ttcn"
SocketCAN__Types::SocketCAN__send__data__result v__result;
current_location.update_lineno(299);
#line 299 "SocketCANtest.ttcn"
TIMER t__guard("t_guard");
current_location.update_lineno(300);
#line 300 "SocketCANtest.ttcn"
t__guard.start(1.0e1);
current_location.update_lineno(303);
#line 303 "SocketCANtest.ttcn"
{
SocketCAN__Types::SocketCAN__send__data_template tmp_33;
tmp_33.id() = p__socket__id;
tmp_33.ifu() = p__ifu;
tmp_33.frame() = p__CAN__or__CAN__FD__frame;
PTC_component_pt__socketCAN.send(tmp_33, NULL);
}
current_location.update_lineno(305);
#line 305 "SocketCANtest.ttcn"
{
tmp_34:
alt_status tmp_34_alt_flag_0 = ALT_MAYBE;
alt_status tmp_34_alt_flag_1 = ALT_MAYBE;
alt_status tmp_34_alt_flag_2 = ALT_MAYBE;
alt_status tmp_34_default_flag = ALT_MAYBE;
TTCN_Snapshot::take_new(FALSE);
for ( ; ; ) {
if (tmp_34_alt_flag_0 == ALT_MAYBE) {
current_location.update_lineno(306);
#line 306 "SocketCANtest.ttcn"
tmp_34_alt_flag_0 = PTC_component_pt__socketCAN.receive(SocketCAN__Templates::a__SocketCAN__send__data__result(SocketCAN__Templates::a__result(SocketCAN__Types::SocketCAN__Result__code::SocketCAN__SUCCESS)), &(v__result), any_compref, NULL, NULL, NULL);
if (tmp_34_alt_flag_0 == ALT_YES) {
current_location.update_lineno(307);
#line 307 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("Sending data");
p__socket__id.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
break;
}
}
if (tmp_34_alt_flag_1 == ALT_MAYBE) {
current_location.update_lineno(308);
#line 308 "SocketCANtest.ttcn"
tmp_34_alt_flag_1 = PTC_component_pt__socketCAN.receive(SocketCAN__Templates::a__SocketCAN__send__data__result(SocketCAN__Templates::a__result(SocketCAN__Types::SocketCAN__Result__code::SocketCAN__ERROR)), NULL, any_compref, NULL, NULL, NULL);
if (tmp_34_alt_flag_1 == ALT_YES) {
current_location.update_lineno(309);
#line 309 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("Sending data failed");
p__socket__id.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(309);
#line 309 "SocketCANtest.ttcn"
TTCN_Runtime::setverdict(FAIL);
break;
}
}
if (tmp_34_alt_flag_2 == ALT_MAYBE) {
current_location.update_lineno(310);
#line 310 "SocketCANtest.ttcn"
tmp_34_alt_flag_2 = t__guard.timeout(NULL);
if (tmp_34_alt_flag_2 == ALT_YES) {
current_location.update_lineno(311);
#line 311 "SocketCANtest.ttcn"
TTCN_Logger::log_str(TTCN_USER, "timeout!");
current_location.update_lineno(312);
#line 312 "SocketCANtest.ttcn"
TTCN_Runtime::setverdict(FAIL);
break;
}
}
if (tmp_34_default_flag == ALT_MAYBE) {
tmp_34_default_flag = TTCN_Default::try_altsteps();
if (tmp_34_default_flag == ALT_YES || tmp_34_default_flag == ALT_BREAK) break;
else if (tmp_34_default_flag == ALT_REPEAT) goto tmp_34;
}
current_location.update_lineno(305);
#line 305 "SocketCANtest.ttcn"
if (tmp_34_alt_flag_0 == ALT_NO && tmp_34_alt_flag_1 == ALT_NO && tmp_34_alt_flag_2 == ALT_NO && tmp_34_default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in the alt statement in file SocketCANtest.ttcn between lines 305 and 314.");
TTCN_Snapshot::take_new(TRUE);
}
}
current_location.update_lineno(315);
#line 315 "SocketCANtest.ttcn"
return v__result;
}
void start_f__send__data(const COMPONENT& component_reference, const INTEGER& p__socket__id, const SocketCAN__Types::SocketCAN__send__data__ifu& p__ifu, const SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame& p__CAN__or__CAN__FD__frame)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_send_data(");
p__socket__id.log();
TTCN_Logger::log_event_str(", ");
p__ifu.log();
TTCN_Logger::log_event_str(", ");
p__CAN__or__CAN__FD__frame.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "SocketCANtest", "f_send_data", text_buf);
p__socket__id.encode_text(text_buf);
p__ifu.encode_text(text_buf);
p__CAN__or__CAN__FD__frame.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}
void f__receive__data(const INTEGER& p__socket__id, const SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame_template& p__frame__expected)
{
TTCN_Location current_location("SocketCANtest.ttcn", 319, TTCN_Location::LOCATION_FUNCTION, "f_receive_data");
current_location.update_lineno(321);
#line 321 "SocketCANtest.ttcn"
SocketCAN__Types::SocketCAN__receive__CAN__or__CAN__FD__frame v__result;
current_location.update_lineno(323);
#line 323 "SocketCANtest.ttcn"
TIMER t__guard("t_guard");
current_location.update_lineno(324);
#line 324 "SocketCANtest.ttcn"
t__guard.start(1.0e1);
current_location.update_lineno(327);
#line 327 "SocketCANtest.ttcn"
{
tmp_35:
alt_status tmp_35_alt_flag_0 = ALT_MAYBE;
alt_status tmp_35_alt_flag_1 = ALT_MAYBE;
alt_status tmp_35_alt_flag_2 = ALT_MAYBE;
alt_status tmp_35_default_flag = ALT_MAYBE;
TTCN_Snapshot::take_new(FALSE);
for ( ; ; ) {
if (tmp_35_alt_flag_0 == ALT_MAYBE) {
current_location.update_lineno(329);
#line 329 "SocketCANtest.ttcn"
tmp_35_alt_flag_0 = PTC_component_pt__socketCAN.receive(SocketCAN__Templates::a__SocketCAN__receive__CAN__or__CAN__FD__frame(INTEGER_template(p__socket__id), p__frame__expected), &(v__result), any_compref, NULL, NULL, NULL);
if (tmp_35_alt_flag_0 == ALT_YES) {
current_location.update_lineno(330);
#line 330 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("SocketCan:Expected frame received");
v__result.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
break;
}
}
if (tmp_35_alt_flag_1 == ALT_MAYBE) {
current_location.update_lineno(331);
#line 331 "SocketCANtest.ttcn"
tmp_35_alt_flag_1 = PTC_component_pt__socketCAN.receive(SocketCAN__Types::SocketCAN__receive__CAN__or__CAN__FD__frame_template(ANY_VALUE), &(v__result), any_compref, NULL, NULL, NULL);
if (tmp_35_alt_flag_1 == ALT_YES) {
current_location.update_lineno(332);
#line 332 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("SocketCan:Unexpected frame received!");
v__result.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(333);
#line 333 "SocketCANtest.ttcn"
TTCN_Runtime::setverdict(FAIL);
break;
}
}
if (tmp_35_alt_flag_2 == ALT_MAYBE) {
current_location.update_lineno(334);
#line 334 "SocketCANtest.ttcn"
tmp_35_alt_flag_2 = t__guard.timeout(NULL);
if (tmp_35_alt_flag_2 == ALT_YES) {
current_location.update_lineno(335);
#line 335 "SocketCANtest.ttcn"
TTCN_Logger::log_str(TTCN_USER, "timeout!");
current_location.update_lineno(336);
#line 336 "SocketCANtest.ttcn"
TTCN_Runtime::setverdict(FAIL);
break;
}
}
if (tmp_35_default_flag == ALT_MAYBE) {
tmp_35_default_flag = TTCN_Default::try_altsteps();
if (tmp_35_default_flag == ALT_YES || tmp_35_default_flag == ALT_BREAK) break;
else if (tmp_35_default_flag == ALT_REPEAT) goto tmp_35;
}
current_location.update_lineno(327);
#line 327 "SocketCANtest.ttcn"
if (tmp_35_alt_flag_0 == ALT_NO && tmp_35_alt_flag_1 == ALT_NO && tmp_35_alt_flag_2 == ALT_NO && tmp_35_default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in the alt statement in file SocketCANtest.ttcn between lines 327 and 337.");
TTCN_Snapshot::take_new(TRUE);
}
}
}
void start_f__receive__data(const COMPONENT& component_reference, const INTEGER& p__socket__id, const SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame_template& p__frame__expected)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_receive_data(");
p__socket__id.log();
TTCN_Logger::log_event_str(", ");
p__frame__expected.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "SocketCANtest", "f_receive_data", text_buf);
p__socket__id.encode_text(text_buf);
p__frame__expected.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}
void f__receive__no__data__but__timeout(const INTEGER& p__socket__id, const FLOAT& p__timeout__period)
{
TTCN_Location current_location("SocketCANtest.ttcn", 340, TTCN_Location::LOCATION_FUNCTION, "f_receive_no_data_but_timeout");
current_location.update_lineno(342);
#line 342 "SocketCANtest.ttcn"
SocketCAN__Types::SocketCAN__receive__CAN__or__CAN__FD__frame v__result;
current_location.update_lineno(344);
#line 344 "SocketCANtest.ttcn"
TIMER t__guard("t_guard");
current_location.update_lineno(345);
#line 345 "SocketCANtest.ttcn"
t__guard.start(p__timeout__period);
current_location.update_lineno(348);
#line 348 "SocketCANtest.ttcn"
{
tmp_36:
alt_status tmp_36_alt_flag_0 = ALT_MAYBE;
alt_status tmp_36_alt_flag_1 = ALT_MAYBE;
alt_status tmp_36_default_flag = ALT_MAYBE;
TTCN_Snapshot::take_new(FALSE);
for ( ; ; ) {
if (tmp_36_alt_flag_0 == ALT_MAYBE) {
current_location.update_lineno(349);
#line 349 "SocketCANtest.ttcn"
tmp_36_alt_flag_0 = PTC_component_pt__socketCAN.receive(SocketCAN__Templates::a__SocketCAN__receive__CAN__or__CAN__FD__frame(INTEGER_template(p__socket__id), SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame_template(ANY_VALUE)), &(v__result), any_compref, NULL, NULL, NULL);
if (tmp_36_alt_flag_0 == ALT_YES) {
current_location.update_lineno(350);
#line 350 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("SocketCan:Unexpected frame received!");
v__result.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(351);
#line 351 "SocketCANtest.ttcn"
TTCN_Runtime::setverdict(FAIL);
break;
}
}
if (tmp_36_alt_flag_1 == ALT_MAYBE) {
current_location.update_lineno(353);
#line 353 "SocketCANtest.ttcn"
tmp_36_alt_flag_1 = t__guard.timeout(NULL);
if (tmp_36_alt_flag_1 == ALT_YES) {
current_location.update_lineno(354);
#line 354 "SocketCANtest.ttcn"
TTCN_Logger::log_str(TTCN_USER, "Expected timeout!");
break;
}
}
if (tmp_36_default_flag == ALT_MAYBE) {
tmp_36_default_flag = TTCN_Default::try_altsteps();
if (tmp_36_default_flag == ALT_YES || tmp_36_default_flag == ALT_BREAK) break;
else if (tmp_36_default_flag == ALT_REPEAT) goto tmp_36;
}
current_location.update_lineno(348);
#line 348 "SocketCANtest.ttcn"
if (tmp_36_alt_flag_0 == ALT_NO && tmp_36_alt_flag_1 == ALT_NO && tmp_36_default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in the alt statement in file SocketCANtest.ttcn between lines 348 and 355.");
TTCN_Snapshot::take_new(TRUE);
}
}
}
void start_f__receive__no__data__but__timeout(const COMPONENT& component_reference, const INTEGER& p__socket__id, const FLOAT& p__timeout__period)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_receive_no_data_but_timeout(");
p__socket__id.log();
TTCN_Logger::log_event_str(", ");
p__timeout__period.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "SocketCANtest", "f_receive_no_data_but_timeout", text_buf);
p__socket__id.encode_text(text_buf);
p__timeout__period.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}
void f__write__data(const INTEGER& p__socket__id, const Bcm::SocketCAN__bcm__frame& p__bcm__frame)
{
TTCN_Location current_location("SocketCANtest.ttcn", 358, TTCN_Location::LOCATION_FUNCTION, "f_write_data");
current_location.update_lineno(362);
#line 362 "SocketCANtest.ttcn"
SocketCAN__Types::SocketCAN__write__data__result v__result;
current_location.update_lineno(364);
#line 364 "SocketCANtest.ttcn"
TIMER t__guard("t_guard");
current_location.update_lineno(365);
#line 365 "SocketCANtest.ttcn"
t__guard.start(1.0e1);
current_location.update_lineno(366);
#line 366 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("BCM frame: SocketCAN_write_data:{id}:");
p__socket__id.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(367);
#line 367 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("BCM frame: SocketCAN_write_data:{bcm_tx_msg}:");
p__bcm__frame.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(369);
#line 369 "SocketCANtest.ttcn"
{
SocketCAN__Types::SocketCAN__write__data_template tmp_37;
tmp_37.id() = p__socket__id;
tmp_37.bcm__tx__msg() = p__bcm__frame;
PTC_component_pt__socketCAN.send(tmp_37, NULL);
}
current_location.update_lineno(370);
#line 370 "SocketCANtest.ttcn"
{
tmp_38:
alt_status tmp_38_alt_flag_0 = ALT_MAYBE;
alt_status tmp_38_alt_flag_1 = ALT_MAYBE;
alt_status tmp_38_alt_flag_2 = ALT_MAYBE;
alt_status tmp_38_default_flag = ALT_MAYBE;
TTCN_Snapshot::take_new(FALSE);
for ( ; ; ) {
if (tmp_38_alt_flag_0 == ALT_MAYBE) {
current_location.update_lineno(371);
#line 371 "SocketCANtest.ttcn"
tmp_38_alt_flag_0 = PTC_component_pt__socketCAN.receive(SocketCAN__Templates::a__SocketCAN__write__data__result(SocketCAN__Templates::a__result(SocketCAN__Types::SocketCAN__Result__code::SocketCAN__SUCCESS)), &(v__result), any_compref, NULL, NULL, NULL);
if (tmp_38_alt_flag_0 == ALT_YES) {
current_location.update_lineno(372);
#line 372 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("Writing data on BCM socket: ");
p__socket__id.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
break;
}
}
if (tmp_38_alt_flag_1 == ALT_MAYBE) {
current_location.update_lineno(373);
#line 373 "SocketCANtest.ttcn"
tmp_38_alt_flag_1 = PTC_component_pt__socketCAN.receive(SocketCAN__Templates::a__SocketCAN__write__data__result(SocketCAN__Templates::a__result(SocketCAN__Types::SocketCAN__Result__code::SocketCAN__ERROR)), NULL, any_compref, NULL, NULL, NULL);
if (tmp_38_alt_flag_1 == ALT_YES) {
current_location.update_lineno(374);
#line 374 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("Writing data on BCM socket failed");
p__socket__id.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(375);
#line 375 "SocketCANtest.ttcn"
TTCN_Runtime::setverdict(FAIL);
break;
}
}
if (tmp_38_alt_flag_2 == ALT_MAYBE) {
current_location.update_lineno(376);
#line 376 "SocketCANtest.ttcn"
tmp_38_alt_flag_2 = t__guard.timeout(NULL);
if (tmp_38_alt_flag_2 == ALT_YES) {
current_location.update_lineno(377);
#line 377 "SocketCANtest.ttcn"
TTCN_Logger::log_str(TTCN_USER, "timeout!");
current_location.update_lineno(378);
#line 378 "SocketCANtest.ttcn"
TTCN_Runtime::setverdict(FAIL);
break;
}
}
if (tmp_38_default_flag == ALT_MAYBE) {
tmp_38_default_flag = TTCN_Default::try_altsteps();
if (tmp_38_default_flag == ALT_YES || tmp_38_default_flag == ALT_BREAK) break;
else if (tmp_38_default_flag == ALT_REPEAT) goto tmp_38;
}
current_location.update_lineno(370);
#line 370 "SocketCANtest.ttcn"
if (tmp_38_alt_flag_0 == ALT_NO && tmp_38_alt_flag_1 == ALT_NO && tmp_38_alt_flag_2 == ALT_NO && tmp_38_default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in the alt statement in file SocketCANtest.ttcn between lines 370 and 379.");
TTCN_Snapshot::take_new(TRUE);
}
}
}
void start_f__write__data(const COMPONENT& component_reference, const INTEGER& p__socket__id, const Bcm::SocketCAN__bcm__frame& p__bcm__frame)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_write_data(");
p__socket__id.log();
TTCN_Logger::log_event_str(", ");
p__bcm__frame.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "SocketCANtest", "f_write_data", text_buf);
p__socket__id.encode_text(text_buf);
p__bcm__frame.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}
void f__receive__BCM__message(const INTEGER_template& p__socket__id, const Bcm::SocketCAN__bcm__frame_template& p__BCM__message__expected)
{
TTCN_Location current_location("SocketCANtest.ttcn", 382, TTCN_Location::LOCATION_FUNCTION, "f_receive_BCM_message");
current_location.update_lineno(384);
#line 384 "SocketCANtest.ttcn"
SocketCAN__Types::SocketCAN__receive__BCM__message v__result;
current_location.update_lineno(386);
#line 386 "SocketCANtest.ttcn"
TIMER t__guard("t_guard");
current_location.update_lineno(387);
#line 387 "SocketCANtest.ttcn"
t__guard.start(1.0e1);
current_location.update_lineno(390);
#line 390 "SocketCANtest.ttcn"
{
tmp_39:
alt_status tmp_39_alt_flag_0 = ALT_MAYBE;
alt_status tmp_39_alt_flag_1 = ALT_MAYBE;
alt_status tmp_39_alt_flag_2 = ALT_MAYBE;
alt_status tmp_39_default_flag = ALT_MAYBE;
TTCN_Snapshot::take_new(FALSE);
for ( ; ; ) {
if (tmp_39_alt_flag_0 == ALT_MAYBE) {
current_location.update_lineno(391);
#line 391 "SocketCANtest.ttcn"
tmp_39_alt_flag_0 = PTC_component_pt__socketCAN.receive(SocketCAN__Templates::a__SocketCAN__receive__BCM__message(p__socket__id, p__BCM__message__expected), &(v__result), any_compref, NULL, NULL, NULL);
if (tmp_39_alt_flag_0 == ALT_YES) {
current_location.update_lineno(392);
#line 392 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("SocketCan:Expected frame received");
v__result.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
break;
}
}
if (tmp_39_alt_flag_1 == ALT_MAYBE) {
current_location.update_lineno(393);
#line 393 "SocketCANtest.ttcn"
tmp_39_alt_flag_1 = PTC_component_pt__socketCAN.receive(SocketCAN__Types::SocketCAN__receive__BCM__message_template(ANY_VALUE), &(v__result), any_compref, NULL, NULL, NULL);
if (tmp_39_alt_flag_1 == ALT_YES) {
current_location.update_lineno(394);
#line 394 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("SocketCan:Unexpected frame received!");
v__result.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(395);
#line 395 "SocketCANtest.ttcn"
TTCN_Runtime::setverdict(FAIL);
break;
}
}
if (tmp_39_alt_flag_2 == ALT_MAYBE) {
current_location.update_lineno(396);
#line 396 "SocketCANtest.ttcn"
tmp_39_alt_flag_2 = t__guard.timeout(NULL);
if (tmp_39_alt_flag_2 == ALT_YES) {
current_location.update_lineno(397);
#line 397 "SocketCANtest.ttcn"
TTCN_Logger::log_str(TTCN_USER, "timeout!");
current_location.update_lineno(398);
#line 398 "SocketCANtest.ttcn"
TTCN_Runtime::setverdict(FAIL);
break;
}
}
if (tmp_39_default_flag == ALT_MAYBE) {
tmp_39_default_flag = TTCN_Default::try_altsteps();
if (tmp_39_default_flag == ALT_YES || tmp_39_default_flag == ALT_BREAK) break;
else if (tmp_39_default_flag == ALT_REPEAT) goto tmp_39;
}
current_location.update_lineno(390);
#line 390 "SocketCANtest.ttcn"
if (tmp_39_alt_flag_0 == ALT_NO && tmp_39_alt_flag_1 == ALT_NO && tmp_39_alt_flag_2 == ALT_NO && tmp_39_default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in the alt statement in file SocketCANtest.ttcn between lines 390 and 399.");
TTCN_Snapshot::take_new(TRUE);
}
}
}
void start_f__receive__BCM__message(const COMPONENT& component_reference, const INTEGER_template& p__socket__id, const Bcm::SocketCAN__bcm__frame_template& p__BCM__message__expected)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_receive_BCM_message(");
p__socket__id.log();
TTCN_Logger::log_event_str(", ");
p__BCM__message__expected.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "SocketCANtest", "f_receive_BCM_message", text_buf);
p__socket__id.encode_text(text_buf);
p__BCM__message__expected.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}
SocketCAN__Types::SocketCAN__setsockopt__result f__setsockopt(const INTEGER& p__socket__id, const SocketCAN__Types::SocketCAN__setsockopt__commandu& p__command)
{
TTCN_Location current_location("SocketCANtest.ttcn", 402, TTCN_Location::LOCATION_FUNCTION, "f_setsockopt");
current_location.update_lineno(406);
#line 406 "SocketCANtest.ttcn"
SocketCAN__Types::SocketCAN__setsockopt__result v__result;
current_location.update_lineno(408);
#line 408 "SocketCANtest.ttcn"
TIMER t__guard("t_guard");
current_location.update_lineno(409);
#line 409 "SocketCANtest.ttcn"
t__guard.start(1.0e1);
current_location.update_lineno(411);
#line 411 "SocketCANtest.ttcn"
{
SocketCAN__Types::SocketCAN__setsockopt_template tmp_40;
tmp_40.id() = p__socket__id;
tmp_40.command() = p__command;
PTC_component_pt__socketCAN.send(tmp_40, NULL);
}
current_location.update_lineno(412);
#line 412 "SocketCANtest.ttcn"
{
tmp_41:
alt_status tmp_41_alt_flag_0 = ALT_MAYBE;
alt_status tmp_41_alt_flag_1 = ALT_MAYBE;
alt_status tmp_41_alt_flag_2 = ALT_MAYBE;
alt_status tmp_41_default_flag = ALT_MAYBE;
TTCN_Snapshot::take_new(FALSE);
for ( ; ; ) {
if (tmp_41_alt_flag_0 == ALT_MAYBE) {
current_location.update_lineno(413);
#line 413 "SocketCANtest.ttcn"
tmp_41_alt_flag_0 = PTC_component_pt__socketCAN.receive(SocketCAN__Templates::a__SocketCAN__setsockopt__result(SocketCAN__Templates::a__result(SocketCAN__Types::SocketCAN__Result__code::SocketCAN__SUCCESS)), &(v__result), any_compref, NULL, NULL, NULL);
if (tmp_41_alt_flag_0 == ALT_YES) {
current_location.update_lineno(414);
#line 414 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("Writing data");
p__socket__id.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
break;
}
}
if (tmp_41_alt_flag_1 == ALT_MAYBE) {
current_location.update_lineno(415);
#line 415 "SocketCANtest.ttcn"
tmp_41_alt_flag_1 = PTC_component_pt__socketCAN.receive(SocketCAN__Templates::a__SocketCAN__setsockopt__result(SocketCAN__Templates::a__result(SocketCAN__Types::SocketCAN__Result__code::SocketCAN__ERROR)), NULL, any_compref, NULL, NULL, NULL);
if (tmp_41_alt_flag_1 == ALT_YES) {
current_location.update_lineno(416);
#line 416 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("Writing data failed");
p__socket__id.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(416);
#line 416 "SocketCANtest.ttcn"
TTCN_Runtime::setverdict(FAIL);
break;
}
}
if (tmp_41_alt_flag_2 == ALT_MAYBE) {
current_location.update_lineno(417);
#line 417 "SocketCANtest.ttcn"
tmp_41_alt_flag_2 = t__guard.timeout(NULL);
if (tmp_41_alt_flag_2 == ALT_YES) {
current_location.update_lineno(418);
#line 418 "SocketCANtest.ttcn"
TTCN_Logger::log_str(TTCN_USER, "timeout!");
current_location.update_lineno(419);
#line 419 "SocketCANtest.ttcn"
TTCN_Runtime::setverdict(FAIL);
break;
}
}
if (tmp_41_default_flag == ALT_MAYBE) {
tmp_41_default_flag = TTCN_Default::try_altsteps();
if (tmp_41_default_flag == ALT_YES || tmp_41_default_flag == ALT_BREAK) break;
else if (tmp_41_default_flag == ALT_REPEAT) goto tmp_41;
}
current_location.update_lineno(412);
#line 412 "SocketCANtest.ttcn"
if (tmp_41_alt_flag_0 == ALT_NO && tmp_41_alt_flag_1 == ALT_NO && tmp_41_alt_flag_2 == ALT_NO && tmp_41_default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in the alt statement in file SocketCANtest.ttcn between lines 412 and 421.");
TTCN_Snapshot::take_new(TRUE);
}
}
current_location.update_lineno(422);
#line 422 "SocketCANtest.ttcn"
return v__result;
}
void start_f__setsockopt(const COMPONENT& component_reference, const INTEGER& p__socket__id, const SocketCAN__Types::SocketCAN__setsockopt__commandu& p__command)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_setsockopt(");
p__socket__id.log();
TTCN_Logger::log_event_str(", ");
p__command.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "SocketCANtest", "f_setsockopt", text_buf);
p__socket__id.encode_text(text_buf);
p__command.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}
void f__close__socket(const INTEGER& p__socket__id)
{
TTCN_Location current_location("SocketCANtest.ttcn", 425, TTCN_Location::LOCATION_FUNCTION, "f_close_socket");
current_location.update_lineno(427);
#line 427 "SocketCANtest.ttcn"
{
SocketCAN__Types::SocketCAN__close_template tmp_42;
tmp_42.id() = p__socket__id;
PTC_component_pt__socketCAN.send(tmp_42, NULL);
}
}
void start_f__close__socket(const COMPONENT& component_reference, const INTEGER& p__socket__id)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_close_socket(");
p__socket__id.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "SocketCANtest", "f_close_socket", text_buf);
p__socket__id.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}
SocketCAN__open__raw__result f__open__raw()
{
TTCN_Location current_location("SocketCANtest.ttcn", 430, TTCN_Location::LOCATION_FUNCTION, "f_open_raw");
current_location.update_lineno(433);
#line 433 "SocketCANtest.ttcn"
INTEGER v__socket__id;
current_location.update_lineno(434);
#line 434 "SocketCANtest.ttcn"
v__socket__id = f__open__socket(SocketCAN__open__socket__type::OPEN__CAN__RAW).id();
current_location.update_lineno(435);
#line 435 "SocketCANtest.ttcn"
SocketCAN__Types::SocketCAN__ifr v__ifr;
current_location.update_lineno(436);
#line 436 "SocketCANtest.ttcn"
v__ifr = f__ioctl__get__if__index(v__socket__id).ifr();
current_location.update_lineno(437);
#line 437 "SocketCANtest.ttcn"
SocketCAN__Types::SocketCAN__bind__result v__bind__result;
current_location.update_lineno(438);
#line 438 "SocketCANtest.ttcn"
v__bind__result = f__bind(v__socket__id, const_cast< const SocketCAN__Types::SocketCAN__ifr&>(v__ifr).if__index());
current_location.update_lineno(440);
#line 440 "SocketCANtest.ttcn"
SocketCAN__open__raw__result v__result;
current_location.update_lineno(441);
#line 441 "SocketCANtest.ttcn"
v__result.ifr() = v__ifr;
v__result.socket__id() = v__socket__id;
current_location.update_lineno(443);
#line 443 "SocketCANtest.ttcn"
return v__result;
}
void start_f__open__raw(const COMPONENT& component_reference)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_open_raw(");
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "SocketCANtest", "f_open_raw", text_buf);
TTCN_Runtime::send_start_component(text_buf);
}
INTEGER f__open__bcm()
{
TTCN_Location current_location("SocketCANtest.ttcn", 446, TTCN_Location::LOCATION_FUNCTION, "f_open_bcm");
current_location.update_lineno(449);
#line 449 "SocketCANtest.ttcn"
INTEGER v__socket__id;
current_location.update_lineno(450);
#line 450 "SocketCANtest.ttcn"
v__socket__id = f__open__socket(SocketCAN__open__socket__type::OPEN__CAN__BCM).id();
current_location.update_lineno(451);
#line 451 "SocketCANtest.ttcn"
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("Opening BCM socket_id");
v__socket__id.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(452);
#line 452 "SocketCANtest.ttcn"
SocketCAN__Types::SocketCAN__ifr v__ifr;
current_location.update_lineno(453);
#line 453 "SocketCANtest.ttcn"
v__ifr = f__ioctl__get__if__index(v__socket__id).ifr();
current_location.update_lineno(454);
#line 454 "SocketCANtest.ttcn"
SocketCAN__Types::SocketCAN__connect__result v__connect__result;
current_location.update_lineno(455);
#line 455 "SocketCANtest.ttcn"
v__connect__result = f__connect(v__socket__id, const_cast< const SocketCAN__Types::SocketCAN__ifr&>(v__ifr).if__index());
current_location.update_lineno(457);
#line 457 "SocketCANtest.ttcn"
return v__socket__id;
}
void start_f__open__bcm(const COMPONENT& component_reference)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_open_bcm(");
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "SocketCANtest", "f_open_bcm", text_buf);
TTCN_Runtime::send_start_component(text_buf);
}
void f__ptc__RawSendInitiator(const e__Phase& p__phase, const SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame& v__frame__send)
{
TTCN_Location current_location("SocketCANtest.ttcn", 460, TTCN_Location::LOCATION_FUNCTION, "f_ptc_RawSendInitiator");
current_location.update_lineno(462);
#line 462 "SocketCANtest.ttcn"
{
Map_Params tmp_50(0);
TTCN_Runtime::map_port(self, PTC_component_pt__socketCAN.get_name(), SYSTEM_COMPREF, "pt_socketCAN", tmp_50);
}
current_location.update_lineno(463);
#line 463 "SocketCANtest.ttcn"
INTEGER v__socket__id;
current_location.update_lineno(464);
#line 464 "SocketCANtest.ttcn"
SocketCAN__Types::SocketCAN__ifr v__ifr;
current_location.update_lineno(465);
#line 465 "SocketCANtest.ttcn"
SocketCAN__Types::SocketCAN__send__data__ifu v__ifu;
current_location.update_lineno(467);
#line 467 "SocketCANtest.ttcn"
alt__awaitPhaseStartReq(e__Phase::e__open__socket);
current_location.update_lineno(468);
#line 468 "SocketCANtest.ttcn"
SocketCAN__open__raw__result res;
current_location.update_lineno(469);
#line 469 "SocketCANtest.ttcn"
res = f__open__raw();
current_location.update_lineno(470);
#line 470 "SocketCANtest.ttcn"
v__socket__id = const_cast< const SocketCAN__open__raw__result&>(res).socket__id();
current_location.update_lineno(471);
#line 471 "SocketCANtest.ttcn"
v__ifr = const_cast< const SocketCAN__open__raw__result&>(res).ifr();
current_location.update_lineno(472);
#line 472 "SocketCANtest.ttcn"
v__ifu.if__name() = const_cast< const SocketCAN__Types::SocketCAN__ifr&>(v__ifr).if__name();
current_location.update_lineno(473);
#line 473 "SocketCANtest.ttcn"
f__sendPhaseEndInd();
current_location.update_lineno(475);
#line 475 "SocketCANtest.ttcn"
alt__awaitPhaseStartReq(p__phase);
current_location.update_lineno(476);
#line 476 "SocketCANtest.ttcn"
SocketCAN__Types::SocketCAN__send__data__result send__data__result;
current_location.update_lineno(477);
#line 477 "SocketCANtest.ttcn"
send__data__result = f__send__data(v__socket__id, v__ifu, v__frame__send);
current_location.update_lineno(480);
#line 480 "SocketCANtest.ttcn"
f__sendPhaseEndInd();
current_location.update_lineno(482);
#line 482 "SocketCANtest.ttcn"
alt__awaitPhaseStartReq(e__Phase::e__close__socket);
current_location.update_lineno(483);
#line 483 "SocketCANtest.ttcn"
f__close__socket(v__socket__id);
current_location.update_lineno(484);
#line 484 "SocketCANtest.ttcn"
{
Map_Params tmp_56(0);
TTCN_Runtime::unmap_port(self, PTC_component_pt__socketCAN.get_name(), SYSTEM_COMPREF, "pt_socketCAN", tmp_56);
}
current_location.update_lineno(485);
#line 485 "SocketCANtest.ttcn"
TTCN_Runtime::setverdict(PASS);
current_location.update_lineno(486);
#line 486 "SocketCANtest.ttcn"
f__sendPhaseEndInd();
}
void start_f__ptc__RawSendInitiator(const COMPONENT& component_reference, const e__Phase& p__phase, const SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame& v__frame__send)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_ptc_RawSendInitiator(");
p__phase.log();
TTCN_Logger::log_event_str(", ");
v__frame__send.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "SocketCANtest", "f_ptc_RawSendInitiator", text_buf);
p__phase.encode_text(text_buf);
v__frame__send.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}
void f__ptc__RawFrameReceiver(const e__Phase& p__phase, const SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame_template& p__frame__expected)
{
TTCN_Location current_location("SocketCANtest.ttcn", 489, TTCN_Location::LOCATION_FUNCTION, "f_ptc_RawFrameReceiver");
current_location.update_lineno(491);
#line 491 "SocketCANtest.ttcn"
{
Map_Params tmp_57(0);
TTCN_Runtime::map_port(self, PTC_component_pt__socketCAN.get_name(), SYSTEM_COMPREF, "pt_socketCAN", tmp_57);
}
current_location.update_lineno(492);
#line 492 "SocketCANtest.ttcn"
INTEGER v__socket__raw__id;
current_location.update_lineno(493);
#line 493 "SocketCANtest.ttcn"
SocketCAN__Types::SocketCAN__ifr v__ifr;
current_location.update_lineno(494);
#line 494 "SocketCANtest.ttcn"
SocketCAN__Types::SocketCAN__send__data__ifu v__ifu;
current_location.update_lineno(496);
#line 496 "SocketCANtest.ttcn"
alt__awaitPhaseStartReq(e__Phase::e__open__socket);
current_location.update_lineno(497);
#line 497 "SocketCANtest.ttcn"
SocketCAN__open__raw__result res;
current_location.update_lineno(498);
#line 498 "SocketCANtest.ttcn"
res = f__open__raw();
current_location.update_lineno(499);
#line 499 "SocketCANtest.ttcn"
v__socket__raw__id = const_cast< const SocketCAN__open__raw__result&>(res).socket__id();
current_location.update_lineno(500);
#line 500 "SocketCANtest.ttcn"
v__ifr = const_cast< const SocketCAN__open__raw__result&>(res).ifr();
current_location.update_lineno(501);
#line 501 "SocketCANtest.ttcn"
v__ifu.if__name() = const_cast< const SocketCAN__Types::SocketCAN__ifr&>(v__ifr).if__name();
current_location.update_lineno(502);
#line 502 "SocketCANtest.ttcn"
f__sendPhaseEndInd();
current_location.update_lineno(504);
#line 504 "SocketCANtest.ttcn"
alt__awaitPhaseStartReq(p__phase);
current_location.update_lineno(505);
#line 505 "SocketCANtest.ttcn"
f__receive__data(v__socket__raw__id, p__frame__expected);
current_location.update_lineno(506);
#line 506 "SocketCANtest.ttcn"
f__sendPhaseEndInd();
current_location.update_lineno(508);
#line 508 "SocketCANtest.ttcn"
alt__awaitPhaseStartReq(e__Phase::e__close__socket);
current_location.update_lineno(509);
#line 509 "SocketCANtest.ttcn"
f__close__socket(v__socket__raw__id);
current_location.update_lineno(510);
#line 510 "SocketCANtest.ttcn"
{
Map_Params tmp_62(0);
TTCN_Runtime::unmap_port(self, PTC_component_pt__socketCAN.get_name(), SYSTEM_COMPREF, "pt_socketCAN", tmp_62);
}
current_location.update_lineno(511);
#line 511 "SocketCANtest.ttcn"
TTCN_Runtime::setverdict(PASS);
current_location.update_lineno(512);
#line 512 "SocketCANtest.ttcn"
f__sendPhaseEndInd();
}
void start_f__ptc__RawFrameReceiver(const COMPONENT& component_reference, const e__Phase& p__phase, const SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame_template& p__frame__expected)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_ptc_RawFrameReceiver(");
p__phase.log();
TTCN_Logger::log_event_str(", ");
p__frame__expected.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "SocketCANtest", "f_ptc_RawFrameReceiver", text_buf);
p__phase.encode_text(text_buf);
p__frame__expected.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}
void f__ptc__RawFrameSequenceReceiver(const e__Phase& p__sequence__expected__phase, const SocketCAN__CAN__or__CAN__FD__frames_template& p__frame__sequence__expected, const e__Phase& p__no__further__frames__expected__phase, const FLOAT& p__timeout__period)
{
TTCN_Location current_location("SocketCANtest.ttcn", 515, TTCN_Location::LOCATION_FUNCTION, "f_ptc_RawFrameSequenceReceiver");
current_location.update_lineno(520);
#line 520 "SocketCANtest.ttcn"
{
Map_Params tmp_63(0);
TTCN_Runtime::map_port(self, PTC_component_pt__socketCAN.get_name(), SYSTEM_COMPREF, "pt_socketCAN", tmp_63);
}
current_location.update_lineno(521);
#line 521 "SocketCANtest.ttcn"
INTEGER v__socket__raw__id;
current_location.update_lineno(522);
#line 522 "SocketCANtest.ttcn"
SocketCAN__Types::SocketCAN__ifr v__ifr;
current_location.update_lineno(523);
#line 523 "SocketCANtest.ttcn"
SocketCAN__Types::SocketCAN__send__data__ifu v__ifu;
current_location.update_lineno(525);
#line 525 "SocketCANtest.ttcn"
alt__awaitPhaseStartReq(e__Phase::e__open__socket);
current_location.update_lineno(526);
#line 526 "SocketCANtest.ttcn"
SocketCAN__open__raw__result res;
current_location.update_lineno(527);
#line 527 "SocketCANtest.ttcn"
res = f__open__raw();
current_location.update_lineno(528);
#line 528 "SocketCANtest.ttcn"
v__socket__raw__id = const_cast< const SocketCAN__open__raw__result&>(res).socket__id();
current_location.update_lineno(529);
#line 529 "SocketCANtest.ttcn"
v__ifr = const_cast< const SocketCAN__open__raw__result&>(res).ifr();
current_location.update_lineno(530);
#line 530 "SocketCANtest.ttcn"
v__ifu.if__name() = const_cast< const SocketCAN__Types::SocketCAN__ifr&>(v__ifr).if__name();
current_location.update_lineno(531);
#line 531 "SocketCANtest.ttcn"
f__sendPhaseEndInd();
current_location.update_lineno(533);
#line 533 "SocketCANtest.ttcn"
alt__awaitPhaseStartReq(p__sequence__expected__phase);
current_location.update_lineno(534);
#line 534 "SocketCANtest.ttcn"
INTEGER v__i;
current_location.update_lineno(535);
#line 535 "SocketCANtest.ttcn"
v__i = 0;
current_location.update_lineno(535);
#line 535 "SocketCANtest.ttcn"
for ( ; ; ) {
current_location.update_lineno(535);
#line 535 "SocketCANtest.ttcn"
if (!(v__i < p__frame__sequence__expected.lengthof())) break;
current_location.update_lineno(536);
#line 536 "SocketCANtest.ttcn"
f__receive__data(v__socket__raw__id, p__frame__sequence__expected[v__i]);
current_location.update_lineno(535);
#line 535 "SocketCANtest.ttcn"
{
INTEGER tmp_69;
++v__i;
}
}
current_location.update_lineno(538);
#line 538 "SocketCANtest.ttcn"
f__sendPhaseEndInd();
current_location.update_lineno(540);
#line 540 "SocketCANtest.ttcn"
alt__awaitPhaseStartReq(p__no__further__frames__expected__phase);
current_location.update_lineno(541);
#line 541 "SocketCANtest.ttcn"
f__receive__no__data__but__timeout(v__socket__raw__id, p__timeout__period);
current_location.update_lineno(542);
#line 542 "SocketCANtest.ttcn"
f__sendPhaseEndInd();
current_location.update_lineno(544);
#line 544 "SocketCANtest.ttcn"
alt__awaitPhaseStartReq(e__Phase::e__close__socket);
current_location.update_lineno(545);
#line 545 "SocketCANtest.ttcn"
f__close__socket(v__socket__raw__id);
current_location.update_lineno(546);
#line 546 "SocketCANtest.ttcn"
{
Map_Params tmp_70(0);
TTCN_Runtime::unmap_port(self, PTC_component_pt__socketCAN.get_name(), SYSTEM_COMPREF, "pt_socketCAN", tmp_70);
}
current_location.update_lineno(547);
#line 547 "SocketCANtest.ttcn"
TTCN_Runtime::setverdict(PASS);
current_location.update_lineno(548);
#line 548 "SocketCANtest.ttcn"
f__sendPhaseEndInd();
}
void start_f__ptc__RawFrameSequenceReceiver(const COMPONENT& component_reference, const e__Phase& p__sequence__expected__phase, const SocketCAN__CAN__or__CAN__FD__frames_template& p__frame__sequence__expected, const e__Phase& p__no__further__frames__expected__phase, const FLOAT& p__timeout__period)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_ptc_RawFrameSequenceReceiver(");
p__sequence__expected__phase.log();
TTCN_Logger::log_event_str(", ");
p__frame__sequence__expected.log();
TTCN_Logger::log_event_str(", ");
p__no__further__frames__expected__phase.log();
TTCN_Logger::log_event_str(", ");
p__timeout__period.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "SocketCANtest", "f_ptc_RawFrameSequenceReceiver", text_buf);
p__sequence__expected__phase.encode_text(text_buf);
p__frame__sequence__expected.encode_text(text_buf);
p__no__further__frames__expected__phase.encode_text(text_buf);
p__timeout__period.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}
void f__ptc__bcmComandSendInitiator(const BCM__cmds& p__cmd__list)
{
TTCN_Location current_location("SocketCANtest.ttcn", 551, TTCN_Location::LOCATION_FUNCTION, "f_ptc_bcmComandSendInitiator");
current_location.update_lineno(552);
#line 552 "SocketCANtest.ttcn"
{
Map_Params tmp_71(0);
TTCN_Runtime::map_port(self, PTC_component_pt__socketCAN.get_name(), SYSTEM_COMPREF, "pt_socketCAN", tmp_71);
}
current_location.update_lineno(553);
#line 553 "SocketCANtest.ttcn"
INTEGER v__socket__bcm__id;
current_location.update_lineno(555);
#line 555 "SocketCANtest.ttcn"
alt__awaitPhaseStartReq(e__Phase::e__open__socket);
current_location.update_lineno(556);
#line 556 "SocketCANtest.ttcn"
v__socket__bcm__id = f__open__bcm();
current_location.update_lineno(557);
#line 557 "SocketCANtest.ttcn"
f__sendPhaseEndInd();
current_location.update_lineno(558);
#line 558 "SocketCANtest.ttcn"
INTEGER v__i;
current_location.update_lineno(559);
#line 559 "SocketCANtest.ttcn"
v__i = 0;
current_location.update_lineno(559);
#line 559 "SocketCANtest.ttcn"
for ( ; ; ) {
current_location.update_lineno(559);
#line 559 "SocketCANtest.ttcn"
if (!(v__i < p__cmd__list.lengthof())) break;
current_location.update_lineno(560);
#line 560 "SocketCANtest.ttcn"
alt__awaitPhaseStartReq(const_cast< const BCM__cmds&>(p__cmd__list)[v__i].phase());
current_location.update_lineno(562);
#line 562 "SocketCANtest.ttcn"
f__write__data(v__socket__bcm__id, const_cast< const BCM__cmds&>(p__cmd__list)[v__i].bcm__frame());
current_location.update_lineno(563);
#line 563 "SocketCANtest.ttcn"
f__sendPhaseEndInd();
current_location.update_lineno(559);
#line 559 "SocketCANtest.ttcn"
{
INTEGER tmp_74;
++v__i;
}
}
current_location.update_lineno(566);
#line 566 "SocketCANtest.ttcn"
alt__awaitPhaseStartReq(e__Phase::e__close__socket);
current_location.update_lineno(567);
#line 567 "SocketCANtest.ttcn"
f__close__socket(v__socket__bcm__id);
current_location.update_lineno(568);
#line 568 "SocketCANtest.ttcn"
{
Map_Params tmp_75(0);
TTCN_Runtime::unmap_port(self, PTC_component_pt__socketCAN.get_name(), SYSTEM_COMPREF, "pt_socketCAN", tmp_75);
}
current_location.update_lineno(569);
#line 569 "SocketCANtest.ttcn"
TTCN_Runtime::setverdict(PASS);
current_location.update_lineno(570);
#line 570 "SocketCANtest.ttcn"
f__sendPhaseEndInd();
}
void start_f__ptc__bcmComandSendInitiator(const COMPONENT& component_reference, const BCM__cmds& p__cmd__list)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_ptc_bcmComandSendInitiator(");
p__cmd__list.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "SocketCANtest", "f_ptc_bcmComandSendInitiator", text_buf);
p__cmd__list.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}
void f__ptc__bcmComandSendReceiveInitiator(const BCM__cmds& p__cmd__list)
{
TTCN_Location current_location("SocketCANtest.ttcn", 574, TTCN_Location::LOCATION_FUNCTION, "f_ptc_bcmComandSendReceiveInitiator");
current_location.update_lineno(575);
#line 575 "SocketCANtest.ttcn"
{
Map_Params tmp_76(0);
TTCN_Runtime::map_port(self, PTC_component_pt__socketCAN.get_name(), SYSTEM_COMPREF, "pt_socketCAN", tmp_76);
}
current_location.update_lineno(576);
#line 576 "SocketCANtest.ttcn"
INTEGER v__socket__bcm__id;
current_location.update_lineno(578);
#line 578 "SocketCANtest.ttcn"
alt__awaitPhaseStartReq(e__Phase::e__open__socket);
current_location.update_lineno(579);
#line 579 "SocketCANtest.ttcn"
v__socket__bcm__id = f__open__bcm();
current_location.update_lineno(580);
#line 580 "SocketCANtest.ttcn"
f__sendPhaseEndInd();
current_location.update_lineno(581);
#line 581 "SocketCANtest.ttcn"
INTEGER v__i;
current_location.update_lineno(582);
#line 582 "SocketCANtest.ttcn"
v__i = 0;
current_location.update_lineno(582);
#line 582 "SocketCANtest.ttcn"
for ( ; ; ) {
current_location.update_lineno(582);
#line 582 "SocketCANtest.ttcn"
if (!(v__i < p__cmd__list.lengthof())) break;
current_location.update_lineno(583);
#line 583 "SocketCANtest.ttcn"
alt__awaitPhaseStartReq(const_cast< const BCM__cmds&>(p__cmd__list)[v__i].phase());
current_location.update_lineno(585);
#line 585 "SocketCANtest.ttcn"
f__write__data(v__socket__bcm__id, const_cast< const BCM__cmds&>(p__cmd__list)[v__i].bcm__frame());
current_location.update_lineno(586);
#line 586 "SocketCANtest.ttcn"
f__receive__BCM__message(INTEGER_template(v__socket__bcm__id), Bcm::SocketCAN__bcm__frame_template(ANY_VALUE));
current_location.update_lineno(587);
#line 587 "SocketCANtest.ttcn"
f__sendPhaseEndInd();
current_location.update_lineno(582);
#line 582 "SocketCANtest.ttcn"
{
INTEGER tmp_79;
++v__i;
}
}
current_location.update_lineno(590);
#line 590 "SocketCANtest.ttcn"
alt__awaitPhaseStartReq(e__Phase::e__close__socket);
current_location.update_lineno(591);
#line 591 "SocketCANtest.ttcn"
f__close__socket(v__socket__bcm__id);
current_location.update_lineno(592);
#line 592 "SocketCANtest.ttcn"
{
Map_Params tmp_80(0);
TTCN_Runtime::unmap_port(self, PTC_component_pt__socketCAN.get_name(), SYSTEM_COMPREF, "pt_socketCAN", tmp_80);
}
current_location.update_lineno(593);
#line 593 "SocketCANtest.ttcn"
TTCN_Runtime::setverdict(PASS);
current_location.update_lineno(594);
#line 594 "SocketCANtest.ttcn"
f__sendPhaseEndInd();
}
void start_f__ptc__bcmComandSendReceiveInitiator(const COMPONENT& component_reference, const BCM__cmds& p__cmd__list)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_ptc_bcmComandSendReceiveInitiator(");
p__cmd__list.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "SocketCANtest", "f_ptc_bcmComandSendReceiveInitiator", text_buf);
p__cmd__list.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}
void f__ptc__bcmSendInitiator(const e__Phase& p__phase, const Bcm::SocketCAN__bcm__frame& p__bcm__frame)
{
TTCN_Location current_location("SocketCANtest.ttcn", 597, TTCN_Location::LOCATION_FUNCTION, "f_ptc_bcmSendInitiator");
current_location.update_lineno(599);
#line 599 "SocketCANtest.ttcn"
{
Map_Params tmp_81(0);
TTCN_Runtime::map_port(self, PTC_component_pt__socketCAN.get_name(), SYSTEM_COMPREF, "pt_socketCAN", tmp_81);
}
current_location.update_lineno(600);
#line 600 "SocketCANtest.ttcn"
INTEGER v__socket__bcm__id;
current_location.update_lineno(602);
#line 602 "SocketCANtest.ttcn"
alt__awaitPhaseStartReq(e__Phase::e__open__socket);
current_location.update_lineno(603);
#line 603 "SocketCANtest.ttcn"
v__socket__bcm__id = f__open__bcm();
current_location.update_lineno(604);
#line 604 "SocketCANtest.ttcn"
f__sendPhaseEndInd();
current_location.update_lineno(606);
#line 606 "SocketCANtest.ttcn"
alt__awaitPhaseStartReq(p__phase);
current_location.update_lineno(608);
#line 608 "SocketCANtest.ttcn"
f__write__data(v__socket__bcm__id, p__bcm__frame);
current_location.update_lineno(609);
#line 609 "SocketCANtest.ttcn"
f__sendPhaseEndInd();
current_location.update_lineno(611);
#line 611 "SocketCANtest.ttcn"
alt__awaitPhaseStartReq(e__Phase::e__close__socket);
current_location.update_lineno(612);
#line 612 "SocketCANtest.ttcn"
f__close__socket(v__socket__bcm__id);
current_location.update_lineno(613);
#line 613 "SocketCANtest.ttcn"
{
Map_Params tmp_83(0);
TTCN_Runtime::unmap_port(self, PTC_component_pt__socketCAN.get_name(), SYSTEM_COMPREF, "pt_socketCAN", tmp_83);
}
current_location.update_lineno(614);
#line 614 "SocketCANtest.ttcn"
TTCN_Runtime::setverdict(PASS);
current_location.update_lineno(615);
#line 615 "SocketCANtest.ttcn"
f__sendPhaseEndInd();
}
void start_f__ptc__bcmSendInitiator(const COMPONENT& component_reference, const e__Phase& p__phase, const Bcm::SocketCAN__bcm__frame& p__bcm__frame)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_ptc_bcmSendInitiator(");
p__phase.log();
TTCN_Logger::log_event_str(", ");
p__bcm__frame.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "SocketCANtest", "f_ptc_bcmSendInitiator", text_buf);
p__phase.encode_text(text_buf);
p__bcm__frame.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}
void f__raw__setsockopt(const e__Phase& p__phase, const SocketCAN__Types::SocketCAN__setsockopt__commandu& p__setsockopt__command)
{
TTCN_Location current_location("SocketCANtest.ttcn", 618, TTCN_Location::LOCATION_FUNCTION, "f_raw_setsockopt");
current_location.update_lineno(620);
#line 620 "SocketCANtest.ttcn"
{
Map_Params tmp_84(0);
TTCN_Runtime::map_port(self, PTC_component_pt__socketCAN.get_name(), SYSTEM_COMPREF, "pt_socketCAN", tmp_84);
}
current_location.update_lineno(621);
#line 621 "SocketCANtest.ttcn"
INTEGER v__socket__id;
current_location.update_lineno(622);
#line 622 "SocketCANtest.ttcn"
SocketCAN__Types::SocketCAN__ifr v__ifr;
current_location.update_lineno(623);
#line 623 "SocketCANtest.ttcn"
SocketCAN__Types::SocketCAN__send__data__ifu v__ifu;
current_location.update_lineno(625);
#line 625 "SocketCANtest.ttcn"
alt__awaitPhaseStartReq(e__Phase::e__open__socket);
current_location.update_lineno(626);
#line 626 "SocketCANtest.ttcn"
SocketCAN__open__raw__result res;
current_location.update_lineno(627);
#line 627 "SocketCANtest.ttcn"
res = f__open__raw();
current_location.update_lineno(628);
#line 628 "SocketCANtest.ttcn"
v__socket__id = const_cast< const SocketCAN__open__raw__result&>(res).socket__id();
current_location.update_lineno(629);
#line 629 "SocketCANtest.ttcn"
v__ifr = const_cast< const SocketCAN__open__raw__result&>(res).ifr();
current_location.update_lineno(630);
#line 630 "SocketCANtest.ttcn"
v__ifu.if__name() = const_cast< const SocketCAN__Types::SocketCAN__ifr&>(v__ifr).if__name();
current_location.update_lineno(631);
#line 631 "SocketCANtest.ttcn"
f__sendPhaseEndInd();
current_location.update_lineno(633);
#line 633 "SocketCANtest.ttcn"
alt__awaitPhaseStartReq(p__phase);
current_location.update_lineno(635);
#line 635 "SocketCANtest.ttcn"
SocketCAN__Types::SocketCAN__setsockopt__result v__setsockopt__result;
current_location.update_lineno(638);
#line 638 "SocketCANtest.ttcn"
v__setsockopt__result = f__setsockopt(v__socket__id, p__setsockopt__command);
current_location.update_lineno(639);
#line 639 "SocketCANtest.ttcn"
f__sendPhaseEndInd();
current_location.update_lineno(641);
#line 641 "SocketCANtest.ttcn"
alt__awaitPhaseStartReq(e__Phase::e__close__socket);
current_location.update_lineno(642);
#line 642 "SocketCANtest.ttcn"
f__close__socket(v__socket__id);
current_location.update_lineno(643);
#line 643 "SocketCANtest.ttcn"
{
Map_Params tmp_90(0);
TTCN_Runtime::unmap_port(self, PTC_component_pt__socketCAN.get_name(), SYSTEM_COMPREF, "pt_socketCAN", tmp_90);
}
current_location.update_lineno(644);
#line 644 "SocketCANtest.ttcn"
TTCN_Runtime::setverdict(PASS);
current_location.update_lineno(645);
#line 645 "SocketCANtest.ttcn"
f__sendPhaseEndInd();
}
void start_f__raw__setsockopt(const COMPONENT& component_reference, const e__Phase& p__phase, const SocketCAN__Types::SocketCAN__setsockopt__commandu& p__setsockopt__command)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_raw_setsockopt(");
p__phase.log();
TTCN_Logger::log_event_str(", ");
p__setsockopt__command.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "SocketCANtest", "f_raw_setsockopt", text_buf);
p__phase.encode_text(text_buf);
p__setsockopt__command.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}
/* Bodies of static functions */
static void pre_init_module()
{
TTCN_Location current_location("SocketCANtest.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "SocketCANtest");
SocketCAN__PortType::module_object.pre_init_module();
SocketCAN__Templates::module_object.pre_init_module();
current_location.update_lineno(23);
#line 23 "SocketCANtest.ttcn"
const_c__guard = 1.0e1;
current_location.update_lineno(61);
#line 61 "SocketCANtest.ttcn"
const_c__firstPhase = e__Phase::e__open__socket;
current_location.update_lineno(62);
#line 62 "SocketCANtest.ttcn"
const_c__testcase__complete = e__Phase::e__testcase__complete;
module_object.add_altstep("alt_awaitPhaseStartReq", (genericfunc_t)&alt__awaitPhaseStartReq_instance, (genericfunc_t )&activate_alt__awaitPhaseStartReq, (genericfunc_t )&alt__awaitPhaseStartReq);
module_object.add_function("f_startPhase", (genericfunc_t)&f__startPhase, (genericfunc_t)&start_f__startPhase);
module_object.add_function("f_incPTCPhase", (genericfunc_t)&f__incPTCPhase, (genericfunc_t)&start_f__incPTCPhase);
module_object.add_function("f_sendPhaseEndInd", (genericfunc_t)&f__sendPhaseEndInd, (genericfunc_t)&start_f__sendPhaseEndInd);
module_object.add_function("f_addSyncSlaveSet", (genericfunc_t)&f__addSyncSlaveSet, NULL);
module_object.add_function("f_incMTCPhase", (genericfunc_t)&f__incMTCPhase, (genericfunc_t)&start_f__incMTCPhase);
module_object.add_function("f_awaitEndPhase", (genericfunc_t)&f__awaitEndPhase, (genericfunc_t)&start_f__awaitEndPhase);
module_object.add_function("f_open_socket", (genericfunc_t)&f__open__socket, (genericfunc_t)&start_f__open__socket);
module_object.add_function("f_ioctl_get_if_index", (genericfunc_t)&f__ioctl__get__if__index, (genericfunc_t)&start_f__ioctl__get__if__index);
module_object.add_function("f_connect", (genericfunc_t)&f__connect, (genericfunc_t)&start_f__connect);
module_object.add_function("f_bind", (genericfunc_t)&f__bind, (genericfunc_t)&start_f__bind);
module_object.add_function("f_send_data", (genericfunc_t)&f__send__data, (genericfunc_t)&start_f__send__data);
module_object.add_function("f_receive_data", (genericfunc_t)&f__receive__data, (genericfunc_t)&start_f__receive__data);
module_object.add_function("f_receive_no_data_but_timeout", (genericfunc_t)&f__receive__no__data__but__timeout, (genericfunc_t)&start_f__receive__no__data__but__timeout);
module_object.add_function("f_write_data", (genericfunc_t)&f__write__data, (genericfunc_t)&start_f__write__data);
module_object.add_function("f_receive_BCM_message", (genericfunc_t)&f__receive__BCM__message, (genericfunc_t)&start_f__receive__BCM__message);
module_object.add_function("f_setsockopt", (genericfunc_t)&f__setsockopt, (genericfunc_t)&start_f__setsockopt);
module_object.add_function("f_close_socket", (genericfunc_t)&f__close__socket, (genericfunc_t)&start_f__close__socket);
module_object.add_function("f_open_raw", (genericfunc_t)&f__open__raw, (genericfunc_t)&start_f__open__raw);
module_object.add_function("f_open_bcm", (genericfunc_t)&f__open__bcm, (genericfunc_t)&start_f__open__bcm);
module_object.add_function("f_ptc_RawSendInitiator", (genericfunc_t)&f__ptc__RawSendInitiator, (genericfunc_t)&start_f__ptc__RawSendInitiator);
module_object.add_function("f_ptc_RawFrameReceiver", (genericfunc_t)&f__ptc__RawFrameReceiver, (genericfunc_t)&start_f__ptc__RawFrameReceiver);
module_object.add_function("f_ptc_RawFrameSequenceReceiver", (genericfunc_t)&f__ptc__RawFrameSequenceReceiver, (genericfunc_t)&start_f__ptc__RawFrameSequenceReceiver);
module_object.add_function("f_ptc_bcmComandSendInitiator", (genericfunc_t)&f__ptc__bcmComandSendInitiator, (genericfunc_t)&start_f__ptc__bcmComandSendInitiator);
module_object.add_function("f_ptc_bcmComandSendReceiveInitiator", (genericfunc_t)&f__ptc__bcmComandSendReceiveInitiator, (genericfunc_t)&start_f__ptc__bcmComandSendReceiveInitiator);
module_object.add_function("f_ptc_bcmSendInitiator", (genericfunc_t)&f__ptc__bcmSendInitiator, (genericfunc_t)&start_f__ptc__bcmSendInitiator);
module_object.add_function("f_raw_setsockopt", (genericfunc_t)&f__raw__setsockopt, (genericfunc_t)&start_f__raw__setsockopt);
}
static void post_init_module()
{
TTCN_Location current_location("SocketCANtest.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "SocketCANtest");
SocketCAN__PortType::module_object.post_init_module();
SocketCAN__Templates::module_object.post_init_module();
}
static boolean init_comp_type(const char *component_type, boolean init_base_comps)
{
(void)init_base_comps;
if (!strcmp(component_type, "PTC")) {
PTC_component_pt__sync.activate_port();
PTC_component_pt__socketCAN.activate_port();
PTC_component_v__phase = e__Phase::e__open__socket;
return TRUE;
} else if (!strcmp(component_type, "MTC")) {
MTC_component_pt__sync.activate_port();
MTC_component_v__PTCSet = NULL_VALUE;
return TRUE;
} else return FALSE;
}
static boolean init_system_port(const char* component_type, const char* port_name)
{
if (!strcmp(component_type, "PTC")) {
if (!strcmp(port_name, "pt_socketCAN")) {
PTC_component_pt__socketCAN.safe_start();
return TRUE;
}
if (!strcmp(port_name, "pt_sync")) {
PTC_component_pt__sync.safe_start();
return TRUE;
}
}
else if (!strcmp(component_type, "MTC")) {
if (!strcmp(port_name, "pt_sync")) {
MTC_component_pt__sync.safe_start();
return TRUE;
}
}
return FALSE;
}
static boolean start_ptc_function(const char *function_name, Text_Buf& function_arguments)
{
if (!strcmp(function_name, "f_startPhase")) {
e__Phase p__phase;
p__phase.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_startPhase(");
p__phase.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__startPhase(p__phase);
TTCN_Runtime::function_finished("f_startPhase");
return TRUE;
} else if (!strcmp(function_name, "f_incPTCPhase")) {
e__Phase p__currentPhase;
p__currentPhase.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_incPTCPhase(");
p__currentPhase.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__incPTCPhase(p__currentPhase);
TTCN_Runtime::function_finished("f_incPTCPhase");
return TRUE;
} else if (!strcmp(function_name, "f_sendPhaseEndInd")) {
TTCN_Logger::log_str(TTCN_Logger::PARALLEL_PTC, "Starting function f_sendPhaseEndInd().");
TTCN_Runtime::function_started(function_arguments);
f__sendPhaseEndInd();
TTCN_Runtime::function_finished("f_sendPhaseEndInd");
return TRUE;
} else if (!strcmp(function_name, "f_incMTCPhase")) {
e__Phase p__currentPhase;
p__currentPhase.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_incMTCPhase(");
p__currentPhase.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__incMTCPhase(p__currentPhase);
TTCN_Runtime::function_finished("f_incMTCPhase");
return TRUE;
} else if (!strcmp(function_name, "f_awaitEndPhase")) {
e__Phase p__phase;
p__phase.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_awaitEndPhase(");
p__phase.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__awaitEndPhase(p__phase);
TTCN_Runtime::function_finished("f_awaitEndPhase");
return TRUE;
} else if (!strcmp(function_name, "f_open_socket")) {
SocketCAN__open__socket__type v__socket__type;
v__socket__type.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_open_socket(");
v__socket__type.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__open__socket(v__socket__type);
TTCN_Runtime::function_finished("f_open_socket");
return TRUE;
} else if (!strcmp(function_name, "f_ioctl_get_if_index")) {
INTEGER p__socket__id;
p__socket__id.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_ioctl_get_if_index(");
p__socket__id.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__ioctl__get__if__index(p__socket__id);
TTCN_Runtime::function_finished("f_ioctl_get_if_index");
return TRUE;
} else if (!strcmp(function_name, "f_connect")) {
INTEGER p__socket__id;
INTEGER p__if__index;
p__socket__id.decode_text(function_arguments);
p__if__index.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_connect(");
p__socket__id.log();
TTCN_Logger::log_event_str(", ");
p__if__index.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__connect(p__socket__id, p__if__index);
TTCN_Runtime::function_finished("f_connect");
return TRUE;
} else if (!strcmp(function_name, "f_bind")) {
INTEGER p__socket__id;
INTEGER p__if__index;
p__socket__id.decode_text(function_arguments);
p__if__index.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_bind(");
p__socket__id.log();
TTCN_Logger::log_event_str(", ");
p__if__index.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__bind(p__socket__id, p__if__index);
TTCN_Runtime::function_finished("f_bind");
return TRUE;
} else if (!strcmp(function_name, "f_send_data")) {
INTEGER p__socket__id;
SocketCAN__Types::SocketCAN__send__data__ifu p__ifu;
SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame p__CAN__or__CAN__FD__frame;
p__socket__id.decode_text(function_arguments);
p__ifu.decode_text(function_arguments);
p__CAN__or__CAN__FD__frame.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_send_data(");
p__socket__id.log();
TTCN_Logger::log_event_str(", ");
p__ifu.log();
TTCN_Logger::log_event_str(", ");
p__CAN__or__CAN__FD__frame.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__send__data(p__socket__id, p__ifu, p__CAN__or__CAN__FD__frame);
TTCN_Runtime::function_finished("f_send_data");
return TRUE;
} else if (!strcmp(function_name, "f_receive_data")) {
INTEGER p__socket__id;
SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame_template p__frame__expected;
p__socket__id.decode_text(function_arguments);
p__frame__expected.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_receive_data(");
p__socket__id.log();
TTCN_Logger::log_event_str(", ");
p__frame__expected.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__receive__data(p__socket__id, p__frame__expected);
TTCN_Runtime::function_finished("f_receive_data");
return TRUE;
} else if (!strcmp(function_name, "f_receive_no_data_but_timeout")) {
INTEGER p__socket__id;
FLOAT p__timeout__period;
p__socket__id.decode_text(function_arguments);
p__timeout__period.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_receive_no_data_but_timeout(");
p__socket__id.log();
TTCN_Logger::log_event_str(", ");
p__timeout__period.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__receive__no__data__but__timeout(p__socket__id, p__timeout__period);
TTCN_Runtime::function_finished("f_receive_no_data_but_timeout");
return TRUE;
} else if (!strcmp(function_name, "f_write_data")) {
INTEGER p__socket__id;
Bcm::SocketCAN__bcm__frame p__bcm__frame;
p__socket__id.decode_text(function_arguments);
p__bcm__frame.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_write_data(");
p__socket__id.log();
TTCN_Logger::log_event_str(", ");
p__bcm__frame.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__write__data(p__socket__id, p__bcm__frame);
TTCN_Runtime::function_finished("f_write_data");
return TRUE;
} else if (!strcmp(function_name, "f_receive_BCM_message")) {
INTEGER_template p__socket__id;
Bcm::SocketCAN__bcm__frame_template p__BCM__message__expected;
p__socket__id.decode_text(function_arguments);
p__BCM__message__expected.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_receive_BCM_message(");
p__socket__id.log();
TTCN_Logger::log_event_str(", ");
p__BCM__message__expected.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__receive__BCM__message(p__socket__id, p__BCM__message__expected);
TTCN_Runtime::function_finished("f_receive_BCM_message");
return TRUE;
} else if (!strcmp(function_name, "f_setsockopt")) {
INTEGER p__socket__id;
SocketCAN__Types::SocketCAN__setsockopt__commandu p__command;
p__socket__id.decode_text(function_arguments);
p__command.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_setsockopt(");
p__socket__id.log();
TTCN_Logger::log_event_str(", ");
p__command.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__setsockopt(p__socket__id, p__command);
TTCN_Runtime::function_finished("f_setsockopt");
return TRUE;
} else if (!strcmp(function_name, "f_close_socket")) {
INTEGER p__socket__id;
p__socket__id.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_close_socket(");
p__socket__id.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__close__socket(p__socket__id);
TTCN_Runtime::function_finished("f_close_socket");
return TRUE;
} else if (!strcmp(function_name, "f_open_raw")) {
TTCN_Logger::log_str(TTCN_Logger::PARALLEL_PTC, "Starting function f_open_raw().");
TTCN_Runtime::function_started(function_arguments);
f__open__raw();
TTCN_Runtime::function_finished("f_open_raw");
return TRUE;
} else if (!strcmp(function_name, "f_open_bcm")) {
TTCN_Logger::log_str(TTCN_Logger::PARALLEL_PTC, "Starting function f_open_bcm().");
TTCN_Runtime::function_started(function_arguments);
f__open__bcm();
TTCN_Runtime::function_finished("f_open_bcm");
return TRUE;
} else if (!strcmp(function_name, "f_ptc_RawSendInitiator")) {
e__Phase p__phase;
SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame v__frame__send;
p__phase.decode_text(function_arguments);
v__frame__send.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_ptc_RawSendInitiator(");
p__phase.log();
TTCN_Logger::log_event_str(", ");
v__frame__send.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__ptc__RawSendInitiator(p__phase, v__frame__send);
TTCN_Runtime::function_finished("f_ptc_RawSendInitiator");
return TRUE;
} else if (!strcmp(function_name, "f_ptc_RawFrameReceiver")) {
e__Phase p__phase;
SocketCAN__Types::SocketCAN__CAN__or__CAN__FD__frame_template p__frame__expected;
p__phase.decode_text(function_arguments);
p__frame__expected.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_ptc_RawFrameReceiver(");
p__phase.log();
TTCN_Logger::log_event_str(", ");
p__frame__expected.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__ptc__RawFrameReceiver(p__phase, p__frame__expected);
TTCN_Runtime::function_finished("f_ptc_RawFrameReceiver");
return TRUE;
} else if (!strcmp(function_name, "f_ptc_RawFrameSequenceReceiver")) {
e__Phase p__sequence__expected__phase;
SocketCAN__CAN__or__CAN__FD__frames_template p__frame__sequence__expected;
e__Phase p__no__further__frames__expected__phase;
FLOAT p__timeout__period;
p__sequence__expected__phase.decode_text(function_arguments);
p__frame__sequence__expected.decode_text(function_arguments);
p__no__further__frames__expected__phase.decode_text(function_arguments);
p__timeout__period.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_ptc_RawFrameSequenceReceiver(");
p__sequence__expected__phase.log();
TTCN_Logger::log_event_str(", ");
p__frame__sequence__expected.log();
TTCN_Logger::log_event_str(", ");
p__no__further__frames__expected__phase.log();
TTCN_Logger::log_event_str(", ");
p__timeout__period.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__ptc__RawFrameSequenceReceiver(p__sequence__expected__phase, p__frame__sequence__expected, p__no__further__frames__expected__phase, p__timeout__period);
TTCN_Runtime::function_finished("f_ptc_RawFrameSequenceReceiver");
return TRUE;
} else if (!strcmp(function_name, "f_ptc_bcmComandSendInitiator")) {
BCM__cmds p__cmd__list;
p__cmd__list.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_ptc_bcmComandSendInitiator(");
p__cmd__list.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__ptc__bcmComandSendInitiator(p__cmd__list);
TTCN_Runtime::function_finished("f_ptc_bcmComandSendInitiator");
return TRUE;
} else if (!strcmp(function_name, "f_ptc_bcmComandSendReceiveInitiator")) {
BCM__cmds p__cmd__list;
p__cmd__list.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_ptc_bcmComandSendReceiveInitiator(");
p__cmd__list.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__ptc__bcmComandSendReceiveInitiator(p__cmd__list);
TTCN_Runtime::function_finished("f_ptc_bcmComandSendReceiveInitiator");
return TRUE;
} else if (!strcmp(function_name, "f_ptc_bcmSendInitiator")) {
e__Phase p__phase;
Bcm::SocketCAN__bcm__frame p__bcm__frame;
p__phase.decode_text(function_arguments);
p__bcm__frame.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_ptc_bcmSendInitiator(");
p__phase.log();
TTCN_Logger::log_event_str(", ");
p__bcm__frame.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__ptc__bcmSendInitiator(p__phase, p__bcm__frame);
TTCN_Runtime::function_finished("f_ptc_bcmSendInitiator");
return TRUE;
} else if (!strcmp(function_name, "f_raw_setsockopt")) {
e__Phase p__phase;
SocketCAN__Types::SocketCAN__setsockopt__commandu p__setsockopt__command;
p__phase.decode_text(function_arguments);
p__setsockopt__command.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_raw_setsockopt(");
p__phase.log();
TTCN_Logger::log_event_str(", ");
p__setsockopt__command.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__raw__setsockopt(p__phase, p__setsockopt__command);
TTCN_Runtime::function_finished("f_raw_setsockopt");
return TRUE;
} else return FALSE;
}
} /* end of namespace */