blob: 57d2275198a88b78017fbca09a6b3819f93db077 [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 "CAN_matrix.hh"
namespace CAN__matrix {
/* Prototypes of static functions */
static void pre_init_module();
static void post_init_module();
/* Literal string constants */
static const unsigned char module_checksum[] = { 0x8e, 0x22, 0x0d, 0xe7, 0xf7, 0x4f, 0x31, 0xaa, 0xcd, 0x58, 0xc4, 0xbe, 0x36, 0x30, 0xe3, 0x71 };
/* Global variable definitions */
TTCN_Module module_object("CAN_matrix", __DATE__, __TIME__, module_checksum, pre_init_module, NULL, 0U, 4294967295U, 4294967295U, 4294967295U, NULL, 0LU, 0, post_init_module, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
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);
/* Bodies of functions, altsteps and testcases */
OCTETSTRING f__encode__can__matrix(const CAN__matrix__messages::CAN__MatrixUnion& pdu)
{
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("f_encode_can_matrix(): Encoding @CAN_matrix_messages.CAN_MatrixUnion: ");
pdu.log();
TTCN_Logger::end_event();
}
TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT);
TTCN_Buffer ttcn_buffer;
pdu.encode(CAN__matrix__messages::CAN__MatrixUnion_descr_, ttcn_buffer, TTCN_EncDec::CT_RAW, 0);
OCTETSTRING ret_val;
ttcn_buffer.get_string(ret_val);
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("f_encode_can_matrix(): Stream after encoding: ");
ret_val.log();
TTCN_Logger::end_event();
}
return ret_val;
}
CAN__matrix__messages::CAN__MatrixUnion f__decode__can__matrix(const OCTETSTRING& data)
{
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("f_decode_can_matrix(): Stream before decoding: ");
data.log();
TTCN_Logger::end_event();
}
TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT);
TTCN_EncDec::clear_error();
TTCN_Buffer ttcn_buffer(data);
CAN__matrix__messages::CAN__MatrixUnion ret_val;
ret_val.decode(CAN__matrix__messages::CAN__MatrixUnion_descr_, ttcn_buffer, TTCN_EncDec::CT_RAW);
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("f_decode_can_matrix(): Decoded @CAN_matrix_messages.CAN_MatrixUnion: ");
ret_val.log();
TTCN_Logger::end_event();
}
if (TTCN_EncDec::get_last_error_type() == TTCN_EncDec::ET_NONE) {
if (ttcn_buffer.get_pos() < ttcn_buffer.get_len()) {
ttcn_buffer.cut();
OCTETSTRING tmp_os;
ttcn_buffer.get_string(tmp_os);
TTCN_Logger::begin_event_log2str();
tmp_os.log();
CHARSTRING remaining_stream = TTCN_Logger::end_event_log2str();
TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_EXTRA_DATA, "f_decode_can_matrix(): Data remained at the end of the stream after successful decoding: %s", (const char*) remaining_stream);
}
}
return ret_val;
}
OCTETSTRING f__encode__canfd__matrix(const CANFD__matrix__messages::CANFD__MatrixUnion& pdu)
{
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("f_encode_canfd_matrix(): Encoding @CANFD_matrix_messages.CANFD_MatrixUnion: ");
pdu.log();
TTCN_Logger::end_event();
}
TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT);
TTCN_Buffer ttcn_buffer;
pdu.encode(CANFD__matrix__messages::CANFD__MatrixUnion_descr_, ttcn_buffer, TTCN_EncDec::CT_RAW, 0);
OCTETSTRING ret_val;
ttcn_buffer.get_string(ret_val);
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("f_encode_canfd_matrix(): Stream after encoding: ");
ret_val.log();
TTCN_Logger::end_event();
}
return ret_val;
}
CANFD__matrix__messages::CANFD__MatrixUnion f__decode__canfd__matrix(const OCTETSTRING& data)
{
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("f_decode_canfd_matrix(): Stream before decoding: ");
data.log();
TTCN_Logger::end_event();
}
TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT);
TTCN_EncDec::clear_error();
TTCN_Buffer ttcn_buffer(data);
CANFD__matrix__messages::CANFD__MatrixUnion ret_val;
ret_val.decode(CANFD__matrix__messages::CANFD__MatrixUnion_descr_, ttcn_buffer, TTCN_EncDec::CT_RAW);
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("f_decode_canfd_matrix(): Decoded @CANFD_matrix_messages.CANFD_MatrixUnion: ");
ret_val.log();
TTCN_Logger::end_event();
}
if (TTCN_EncDec::get_last_error_type() == TTCN_EncDec::ET_NONE) {
if (ttcn_buffer.get_pos() < ttcn_buffer.get_len()) {
ttcn_buffer.cut();
OCTETSTRING tmp_os;
ttcn_buffer.get_string(tmp_os);
TTCN_Logger::begin_event_log2str();
tmp_os.log();
CHARSTRING remaining_stream = TTCN_Logger::end_event_log2str();
TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_EXTRA_DATA, "f_decode_canfd_matrix(): Data remained at the end of the stream after successful decoding: %s", (const char*) remaining_stream);
}
}
return ret_val;
}
CAN__matrix__messages::CAN__MatrixUnion canframe2canmatrixframe(const Can::CAN__frame& p__can__frame)
{
TTCN_Location current_location("CAN_matrix.ttcn", 21, TTCN_Location::LOCATION_FUNCTION, "canframe2canmatrixframe");
current_location.update_lineno(23);
#line 23 "CAN_matrix.ttcn"
CAN__matrix__messages::CAN__MatrixUnion v__can__frame__can__matrix;
current_location.update_lineno(28);
#line 28 "CAN_matrix.ttcn"
v__can__frame__can__matrix = f__decode__can__matrix((const_cast< const Can::CAN__frame&>(p__can__frame).can__id() + const_cast< const Can::CAN__frame&>(p__can__frame).can__pdu()));
current_location.update_lineno(31);
#line 31 "CAN_matrix.ttcn"
return v__can__frame__can__matrix;
}
Can::CAN__frame canmatrixframe2can(const CAN__matrix__messages::CAN__MatrixUnion& p__can__matrix__frame)
{
TTCN_Location current_location("CAN_matrix.ttcn", 35, TTCN_Location::LOCATION_FUNCTION, "canmatrixframe2can");
current_location.update_lineno(37);
#line 37 "CAN_matrix.ttcn"
Can::CAN__frame v__can__frame;
current_location.update_lineno(39);
#line 39 "CAN_matrix.ttcn"
v__can__frame.can__id() = const_cast< const CAN__matrix__messages::CAN__MatrixUnion&>(p__can__matrix__frame).can__id();
current_location.update_lineno(40);
#line 40 "CAN_matrix.ttcn"
OCTETSTRING v__encoded;
current_location.update_lineno(41);
#line 41 "CAN_matrix.ttcn"
v__encoded = f__encode__can__matrix(p__can__matrix__frame);
current_location.update_lineno(42);
#line 42 "CAN_matrix.ttcn"
v__can__frame.can__pdu() = substr(v__encoded, 4, (v__encoded.lengthof() - 4));
current_location.update_lineno(43);
#line 43 "CAN_matrix.ttcn"
return v__can__frame;
}
CANFD__matrix__messages::CANFD__MatrixUnion canfdframe2canfdmatrixframe(const Can::CANFD__frame& p__canfd__frame)
{
TTCN_Location current_location("CAN_matrix.ttcn", 47, TTCN_Location::LOCATION_FUNCTION, "canfdframe2canfdmatrixframe");
current_location.update_lineno(49);
#line 49 "CAN_matrix.ttcn"
CANFD__matrix__messages::CANFD__MatrixUnion v__canfd__frame__canfd__matrix;
current_location.update_lineno(54);
#line 54 "CAN_matrix.ttcn"
v__canfd__frame__canfd__matrix = f__decode__canfd__matrix(((const_cast< const Can::CANFD__frame&>(p__canfd__frame).can__id() + bit2oct(const_cast< const Can::CANFD__frame&>(p__canfd__frame).can__flags())) + const_cast< const Can::CANFD__frame&>(p__canfd__frame).can__pdu()));
current_location.update_lineno(57);
#line 57 "CAN_matrix.ttcn"
return v__canfd__frame__canfd__matrix;
}
Can::CANFD__frame canfdmatrixframe2canfd(const CANFD__matrix__messages::CANFD__MatrixUnion& p__canfd__matrix__frame)
{
TTCN_Location current_location("CAN_matrix.ttcn", 61, TTCN_Location::LOCATION_FUNCTION, "canfdmatrixframe2canfd");
current_location.update_lineno(63);
#line 63 "CAN_matrix.ttcn"
Can::CANFD__frame v__canfd__frame;
current_location.update_lineno(65);
#line 65 "CAN_matrix.ttcn"
v__canfd__frame.can__id() = const_cast< const CANFD__matrix__messages::CANFD__MatrixUnion&>(p__canfd__matrix__frame).can__id();
current_location.update_lineno(66);
#line 66 "CAN_matrix.ttcn"
OCTETSTRING v__encoded;
current_location.update_lineno(67);
#line 67 "CAN_matrix.ttcn"
v__encoded = f__encode__canfd__matrix(p__canfd__matrix__frame);
current_location.update_lineno(68);
#line 68 "CAN_matrix.ttcn"
v__canfd__frame.can__pdu() = substr(v__encoded, 4, 1);
current_location.update_lineno(69);
#line 69 "CAN_matrix.ttcn"
v__canfd__frame.can__pdu() = substr(v__encoded, 5, (v__encoded.lengthof() - 5));
current_location.update_lineno(70);
#line 70 "CAN_matrix.ttcn"
return v__canfd__frame;
}
/* Bodies of static functions */
static void pre_init_module()
{
TTCN_Location current_location("CAN_matrix.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "CAN_matrix");
SocketCAN__Types::module_object.pre_init_module();
CAN__matrix__messages::module_object.pre_init_module();
CANFD__matrix__messages::module_object.pre_init_module();
module_object.add_function("f_encode_can_matrix", (genericfunc_t)&f__encode__can__matrix, NULL);
module_object.add_function("f_decode_can_matrix", (genericfunc_t)&f__decode__can__matrix, NULL);
module_object.add_function("f_encode_canfd_matrix", (genericfunc_t)&f__encode__canfd__matrix, NULL);
module_object.add_function("f_decode_canfd_matrix", (genericfunc_t)&f__decode__canfd__matrix, NULL);
module_object.add_function("canframe2canmatrixframe", (genericfunc_t)&canframe2canmatrixframe, NULL);
module_object.add_function("canmatrixframe2can", (genericfunc_t)&canmatrixframe2can, NULL);
module_object.add_function("canfdframe2canfdmatrixframe", (genericfunc_t)&canfdframe2canfdmatrixframe, NULL);
module_object.add_function("canfdmatrixframe2canfd", (genericfunc_t)&canfdmatrixframe2canfd, NULL);
}
static void post_init_module()
{
TTCN_Location current_location("CAN_matrix.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "CAN_matrix");
SocketCAN__Types::module_object.post_init_module();
CAN__matrix__messages::module_object.post_init_module();
CANFD__matrix__messages::module_object.post_init_module();
}
} /* end of namespace */