Commit 510c4ed1 authored by garciay's avatar garciay
Browse files

Layers ongoing

parent c86e2332
#include "LibItsBtp_EncdecDeclarations.hh"
#include "BTPCodec.hh"
#include "loggers.hh"
namespace LibItsBtp__EncdecDeclarations {
/****************************************************
* @desc External function to encode a BtpPayload type
* @param value to encode
* @return encoded value
****************************************************/
BITSTRING fx__enc__BtpPayload(const LibItsBtp__TypesAndValues::BtpPayload& p)
{
return int2bit(0,8);
}
/****************************************************
* @desc External function to decode a BtpPayload type
* @param value to encode
* @return encoded value
****************************************************/
/* TODO RGy function not implemented! (decvalue() not used by test suite @29-06-2016)
INTEGER fx__dec__BtpPayload(BITSTRING& b, LibItsBtp__TypesAndValues::BtpPayload& p)
{
return -1;
}
*/
/*BITSTRING fx__enc__BtpReq(LibItsBtp__TestSystem::BtpReq const&)
{
return int2bit(0,8);
}
INTEGER fx__dec__BtpInd(BITSTRING&, LibItsBtp__TestSystem::BtpInd&)
{
return 0;
}*/
/****************************************************
* @desc External function to encode a BtpPayload type
* @param value to encode
* @return encoded value
****************************************************/
BITSTRING fx__enc__BtpPayload(const LibItsBtp__TypesAndValues::BtpPayload& p)
{
return int2bit(0,8);
}
/****************************************************
* @desc External function to decode a BtpPayload type
* @param value to encode
* @return encoded value
****************************************************/
/* TODO RGy function not implemented! (decvalue() not used by test suite @29-06-2016)
INTEGER fx__dec__BtpPayload(BITSTRING& b, LibItsBtp__TypesAndValues::BtpPayload& p)
{
return -1;
}
*/
/****************************************************
* @desc External function to encode a BtpReq type
* @param value to encode
* @return encoded value
****************************************************/
BITSTRING fx__enc__BtpReq(LibItsBtp__TestSystem::BtpReq const& p_btpReq)
{
loggers::get_instance().log_msg(">>> fx__enc__BtpReq: ", p_btpReq);
BTPCodec codec;
OCTETSTRING os;
if (codec.encode(p_btpReq.msgOut(), os) == -1) {
loggers::get_instance().warning("fx__enc__BtpReq: -1 result code was returned");
return int2bit(0, 1);
}
return oct2bit(os);
}
/****************************************************
* @desc External function to decode a BtpReq type
* @param value to encode
* @return encoded value
****************************************************/
INTEGER fx__dec__BtpReq(BITSTRING& b, LibItsBtp__TestSystem::BtpReq& p)
{
loggers::get_instance().log(">>> fx__dec__BtpReq");
BTPCodec codec;
LibItsBtp__TypesAndValues::BtpPacket pdu;
OCTETSTRING is = bit2oct(b);
if (codec.decode(is, pdu) == -1) {
loggers::get_instance().warning("fx__dec__BtpReq: -1 result code was returned");
return -1;
}
p.msgOut() = pdu;
return 0;
}
/****************************************************
* @desc External function to encode a BtpInd type
* @param value to encode
* @return encoded value
****************************************************/
BITSTRING fx__enc__BtpInd(LibItsBtp__TestSystem::BtpInd const& p_btpInd)
{
loggers::get_instance().log_msg(">>> fx__enc__BtpInd: ", p_btpInd);
BTPCodec codec;
OCTETSTRING os;
if (codec.encode(p_btpInd.msgIn(), os) == -1) {
loggers::get_instance().warning("fx__enc__BtpInd: -1 result code was returned");
return int2bit(0, 1);
}
return oct2bit(os);
}
/****************************************************
* @desc External function to decode a BtpInd type
* @param value to encode
* @return encoded value
****************************************************/
INTEGER fx__dec__BtpInd(BITSTRING& b, LibItsBtp__TestSystem::BtpInd& p_btpInd)
{
loggers::get_instance().log(">>> fx__dec__BtpInd");
BTPCodec codec;
LibItsBtp__TypesAndValues::BtpPacket pdu;
OCTETSTRING is = bit2oct(b);
// Calculate the size of the lower layers information
if (codec.decode(is, pdu) == -1) {
loggers::get_instance().warning("fx__dec__BtpInd: -1 result code was returned");
return -1;
}
p_btpInd.msgIn() = pdu;
loggers::get_instance().log_msg("<<< fx__dec__BtpInd: ", p_btpInd);
return 0;
}
/****************************************************
* @desc External function to encode a BtpPacket type
* @param value to encode
* @return encoded value
****************************************************/
BITSTRING fx__enc__BtpPacket(LibItsBtp__TypesAndValues::BtpPacket const& p_btpPacket)
{
loggers::get_instance().log_msg(">>> fx__enc__BtpPacket: ", p_btpPacket);
BTPCodec codec;
OCTETSTRING os;
codec.encode(p_btpPacket, os);
return oct2bit(os);
}
/****************************************************
* @desc External function to decode a BtpPacket type
* @param value to encode
* @return encoded value
****************************************************/
INTEGER fx__dec__BtpPacket(BITSTRING& b, LibItsBtp__TypesAndValues::BtpPacket& p_btpPacket)
{
loggers::get_instance().log(">>> fx__dec__BtpPacket");
BTPCodec codec;
OCTETSTRING is = bit2oct(b);
if (codec.decode(is, p_btpPacket) == -1) {
loggers::get_instance().warning("fx__dec__BtpPacket: -1 result code was returned");
return -1;
}
return 0;
}
} //end namespace
......@@ -4,134 +4,229 @@
#include "loggers.hh"
namespace LibItsGeoNetworking__EncdecDeclarations {
/****************************************************
* @desc External function to encode a GeoNetworkingReq type
* @param value to encode
* @return encoded value
****************************************************/
BITSTRING fx__enc__GeoNetworkingReq(LibItsGeoNetworking__TestSystem::GeoNetworkingReq const& p_geoNetworkingReq)
{
loggers::loggers::log("fx__enc__GeoNetworkingReq");
/****************************************************
* @desc External function to encode a GeoNetworkingReq type
* @param value to encode
* @return encoded value
****************************************************/
BITSTRING fx__enc__GeoNetworkingReq(LibItsGeoNetworking__TestSystem::GeoNetworkingReq const& p_geoNetworkingReq)
{
loggers::get_instance().log_msg(">>> fx__enc__GeoNetworkingReq: ", p_geoNetworkingReq);
GeoNetworkingCodec codec;
const LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu & pdu = p_geoNetworkingReq.msgOut();
OCTETSTRING os;
codec.encode(pdu, os);
const unsigned char mac_address[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
os += OCTETSTRING(sizeof(mac_address), static_cast<const unsigned char *>(mac_address));
if (codec.encode(p_geoNetworkingReq.msgOut(), os) == -1) {
loggers::get_instance().warning("fx__enc__GeoNetworkingReq: -1 result code was returned");
return int2bit(0, 1);
}
TTCN_Buffer encoding_buffer(os);
for (int i = 1; i < p_geoNetworkingReq.get_count(); i++) {
loggers::get_instance().log("fx__enc__GeoNetworkingReq: processing %s/%s/%s - %d - %d", p_geoNetworkingReq.fld_name(i), p_geoNetworkingReq.fld_descr(i)->name, p_geoNetworkingReq.get_at(i)->get_descriptor()->name, p_geoNetworkingReq.get_at(i)->is_optional(), p_geoNetworkingReq.get_at(i)->is_present());
if (p_geoNetworkingReq.get_at(i)->is_optional() && p_geoNetworkingReq.get_at(i)->is_present()) {
p_geoNetworkingReq.get_at(i)->get_opt_value()->encode(*p_geoNetworkingReq.fld_descr(i), encoding_buffer, TTCN_EncDec::CT_RAW);
} else {
p_geoNetworkingReq.get_at(i)->encode(*p_geoNetworkingReq.fld_descr(i), encoding_buffer, TTCN_EncDec::CT_RAW);
}
} // End of 'for' statement
return oct2bit(OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()));
}
/****************************************************
* @desc External function to decode a GeoNetworkingReq type
* @param value to encode
* @return encoded value
****************************************************/
INTEGER fx__dec__GeoNetworkingReq(BITSTRING& b, LibItsGeoNetworking__TestSystem::GeoNetworkingReq& p)
{
loggers::get_instance().log(">>> fx__dec__GeoNetworkingReq");
GeoNetworkingCodec codec;
LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu pdu;
OCTETSTRING is = bit2oct(b);
// Calculate the size of the lower layers information
int s = (LibItsGeoNetworking__TestSystem::GeoNetworkingInd_macDestinationAddress_raw_.fieldlength + LibItsGeoNetworking__TestSystem::GeoNetworkingInd_its__aid_raw_.fieldlength) / 8;
if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast<const unsigned char *>(is)), pdu) == -1) {
loggers::get_instance().warning("fx__dec__GeoNetworkingReq: -1 result code was returned");
return -1;
}
p.msgOut() = pdu;
TTCN_Buffer decoding_buffer(OCTETSTRING(is.lengthof() - s, static_cast<const unsigned char *>(is) + is.lengthof() - s));
for (int i = 1; i < p.get_count(); i++) {
p.get_at(i)->decode(*p.fld_descr(i), decoding_buffer, TTCN_EncDec::CT_RAW);
} // End of 'for' statement
return 0;
}
/****************************************************
* @desc External function to encode a GeoNetworkingInd type
* @param value to encode
* @return encoded value
****************************************************/
BITSTRING fx__enc__GeoNetworkingInd(LibItsGeoNetworking__TestSystem::GeoNetworkingInd const& p_geoNetworkingInd)
{
loggers::get_instance().log_msg(">>> fx__enc__GeoNetworkingInd: ", p_geoNetworkingInd);
GeoNetworkingCodec codec;
OCTETSTRING os;
if (codec.encode(p_geoNetworkingInd.msgIn(), os) == -1) {
loggers::get_instance().warning("fx__enc__GeoNetworkingInd: -1 result code was returned");
return int2bit(0, 1);
}
TTCN_Buffer encoding_buffer(os);
for (int i = 1; i < p_geoNetworkingInd.get_count(); i++) {
loggers::get_instance().log("fx__enc__GeoNetworkingInd: processing %s/%s/%s - %d - %d", p_geoNetworkingInd.fld_name(i), p_geoNetworkingInd.fld_descr(i)->name, p_geoNetworkingInd.get_at(i)->get_descriptor()->name, p_geoNetworkingInd.get_at(i)->is_optional(), p_geoNetworkingInd.get_at(i)->is_present());
if (p_geoNetworkingInd.get_at(i)->is_optional() && p_geoNetworkingInd.get_at(i)->is_present()) {
p_geoNetworkingInd.get_at(i)->get_opt_value()->encode(*p_geoNetworkingInd.fld_descr(i), encoding_buffer, TTCN_EncDec::CT_RAW);
} else {
p_geoNetworkingInd.get_at(i)->encode(*p_geoNetworkingInd.fld_descr(i), encoding_buffer, TTCN_EncDec::CT_RAW);
}
} // End of 'for' statement
return oct2bit(OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()));
}
/****************************************************
* @desc External function to decode a GeoNetworkingInd type
* @param value to encode
* @return encoded value
****************************************************/
INTEGER fx__dec__GeoNetworkingInd(BITSTRING& b, LibItsGeoNetworking__TestSystem::GeoNetworkingInd& p_geoNetworkingInd)
{
loggers::get_instance().log(">>> fx__dec__GeoNetworkingInd");
GeoNetworkingCodec codec;
LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu pdu;
OCTETSTRING is = bit2oct(b);
// Calculate the size of the lower layers information
int s = (LibItsGeoNetworking__TestSystem::GeoNetworkingInd_macDestinationAddress_raw_.fieldlength + LibItsGeoNetworking__TestSystem::GeoNetworkingInd_ssp_raw_.fieldlength + LibItsGeoNetworking__TestSystem::GeoNetworkingInd_its__aid_raw_.fieldlength) / 8;
if (codec.decode(OCTETSTRING(is.lengthof() - s, static_cast<const unsigned char *>(is)), pdu) == -1) {
loggers::get_instance().warning("fx__dec__GeoNetworkingInd: -1 result code was returned");
return -1;
}
p_geoNetworkingInd.msgIn() = pdu;
TTCN_Buffer decoding_buffer(OCTETSTRING(is.lengthof() - s, static_cast<const unsigned char *>(is) + is.lengthof() - s));
for (int i = 1; i < p_geoNetworkingInd.get_count(); i++) {
loggers::get_instance().log("fx__dec__GeoNetworkingInd: processing %s/%s/%s - %d - %d", p_geoNetworkingInd.fld_name(i), p_geoNetworkingInd.fld_descr(i)->name, p_geoNetworkingInd.get_at(i)->get_descriptor()->name, p_geoNetworkingInd.get_at(i)->is_optional(), p_geoNetworkingInd.get_at(i)->is_present());
if (p_geoNetworkingInd.get_at(i)->is_optional()) {
loggers::get_instance().log("fx__dec__GeoNetworkingInd: Bytes remaining: %d - ssp lenth: %d", decoding_buffer.get_len() - decoding_buffer.get_pos(), p_geoNetworkingInd.fld_descr(i)->raw->fieldlength / 8);
if (std::string(p_geoNetworkingInd.fld_name(i)).compare("ssp") == 0) {
if ((decoding_buffer.get_len() - decoding_buffer.get_pos()) >= p_geoNetworkingInd.fld_descr(i)->raw->fieldlength / 8) {
loggers::get_instance().log("fx__dec__GeoNetworkingInd: decoding %s", p_geoNetworkingInd.fld_descr(i)->name);
BITSTRING ssp;
ssp.decode(*p_geoNetworkingInd.fld_descr(i), decoding_buffer, TTCN_EncDec::CT_RAW);
loggers::get_instance().log_msg("fx__dec__GeoNetworkingInd: ssp=", ssp);
dynamic_cast<OPTIONAL<BITSTRING> &>(*p_geoNetworkingInd.get_at(i)) = OPTIONAL<BITSTRING>(ssp);
} else {
loggers::get_instance().log("fx__dec__GeoNetworkingInd: set %s to omit", p_geoNetworkingInd.fld_descr(i)->name);
dynamic_cast<OPTIONAL<BITSTRING> &>(*p_geoNetworkingInd.get_at(i)).set_to_omit();
}
} else if (std::string(p_geoNetworkingInd.fld_name(i)).compare("its_aid") == 0) {
loggers::get_instance().log("fx__dec__GeoNetworkingInd: Bytes remaining: %d - its_aid lenth: %d", decoding_buffer.get_len() - decoding_buffer.get_pos(), p_geoNetworkingInd.fld_descr(i)->raw->fieldlength / 8);
if ((decoding_buffer.get_len() - decoding_buffer.get_pos()) >= p_geoNetworkingInd.fld_descr(i)->raw->fieldlength / 8) {
INTEGER its_aid;
its_aid.decode(*p_geoNetworkingInd.fld_descr(i), decoding_buffer, TTCN_EncDec::CT_RAW);
loggers::get_instance().log_msg("fx__dec__GeoNetworkingInd: its_aid=", its_aid);
dynamic_cast<OPTIONAL<INTEGER> &>(*p_geoNetworkingInd.get_at(i)) = OPTIONAL<INTEGER>(its_aid);
} else {
loggers::get_instance().log("fx__dec__GeoNetworkingInd: set %s to omit", p_geoNetworkingInd.fld_descr(i)->name);
dynamic_cast<OPTIONAL<INTEGER> &>(*p_geoNetworkingInd.get_at(i)).set_to_omit();
}
} else {
loggers::get_instance().log("fx__dec__GeoNetworkingInd(1): decoding %s", p_geoNetworkingInd.fld_descr(i)->name);
p_geoNetworkingInd.get_at(i)->decode(*p_geoNetworkingInd.fld_descr(i), decoding_buffer, TTCN_EncDec::CT_RAW);
}
} else {
loggers::get_instance().log("fx__dec__GeoNetworkingInd(2): decoding %s", p_geoNetworkingInd.fld_descr(i)->name);
p_geoNetworkingInd.get_at(i)->decode(*p_geoNetworkingInd.fld_descr(i), decoding_buffer, TTCN_EncDec::CT_RAW);
}
} // End of 'for' statement
loggers::get_instance().log_msg("<<< fx__dec__GeoNetworkingInd: ", p_geoNetworkingInd);
return 0;
}
/****************************************************
* @desc External function to encode a GeoNetworkingPdu type
* @param value to encode
* @return encoded value
****************************************************/
BITSTRING fx__enc__GeoNetworkingPdu(LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu const& p_geoNetworkingPdu)
{
loggers::get_instance().log_msg(">>> fx__enc__GeoNetworkingPdu: ", p_geoNetworkingPdu);
GeoNetworkingCodec codec;
OCTETSTRING os;
codec.encode(p_geoNetworkingPdu, os);
return oct2bit(os);
}
}
/****************************************************
* @desc External function to decode a GeoNetworkingReq type
* @param value to encode
* @return encoded value
****************************************************/
/****************************************************
* @desc External function to decode a GeoNetworkingPdu type
* @param value to encode
* @return encoded value
****************************************************/
INTEGER fx__dec__GeoNetworkingReq(BITSTRING& b, LibItsGeoNetworking__TestSystem::GeoNetworkingReq& p)
{
loggers::loggers::log("fx__dec__GeoNetworkingReq");
INTEGER fx__dec__GeoNetworkingPdu(BITSTRING& b, LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu& p)
{
loggers::get_instance().log(">>> fx__dec__GeoNetworkingPdu");
GeoNetworkingCodec codec;
LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu pdu;
OCTETSTRING is = bit2oct(b);
if (codec.decode(OCTETSTRING(is.lengthof() - 6, static_cast<const unsigned char *>(is)), pdu) == -1) {
return -1;
if (codec.decode(OCTETSTRING(is.lengthof(), static_cast<const unsigned char *>(is)), p) == -1) {
loggers::get_instance().warning("fx__dec__GeoNetworkingPdu: -1 result code was returned");
return -1;
}
const unsigned char mac_address[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
p = LibItsGeoNetworking__TestSystem::GeoNetworkingReq(
pdu,
OCTETSTRING(sizeof(mac_address), static_cast<const unsigned char *>(mac_address)),
0);
return 0;
}
/****************************************************
* @desc External function to encode a GeoNetworkingInd type
* @param value to encode
* @return encoded value
****************************************************/
BITSTRING fx__enc__GeoNetworkingInd(LibItsGeoNetworking__TestSystem::GeoNetworkingInd const& p)
{
loggers::loggers::log("fx__enc__GeoNetworkingInd");
}
/****************************************************
* @desc External function to encode a Payload type
* @param value to encode
* @return encoded value
****************************************************/
BITSTRING fx__enc__Payload(const LibItsGeoNetworking__TypesAndValues::Payload& p)
{
loggers::get_instance().log("fx__enc__Payload");
return int2bit(0,8);
}
/****************************************************
* @desc External function to decode a GeoNetworkingInd type
* @param value to encode
* @return encoded value
****************************************************/
INTEGER fx__dec__GeoNetworkingInd(BITSTRING& b, LibItsGeoNetworking__TestSystem::GeoNetworkingInd& p)
{
loggers::loggers::log("fx__dec__GeoNetworkingInd");
return -1;
}
/****************************************************
* @desc External function to encode a GeoNetworkingPdu type
* @param value to encode
* @return encoded value
****************************************************/
BITSTRING fx__enc__GeoNetworkingPdu(LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu const& p)
{
loggers::loggers::log("fx__enc__GeoNetworkingPdu");
}
/****************************************************
* @desc External function to decode a Payload type
* @param value to encode
* @return encoded value
****************************************************/
INTEGER fx__dec__Payload(BITSTRING& b, LibItsGeoNetworking__TypesAndValues::Payload& p)
{
return -1;
}
/****************************************************
* @desc External function to encode a GnNonSecuredPacket type
* @param value to encode
* @return encoded value
****************************************************/
BITSTRING fx__enc__GnNonSecuredPacket(const LibItsGeoNetworking__TypesAndValues::GnNonSecuredPacket& p)
{
return int2bit(0,8);
}
/****************************************************
* @desc External function to decode a GeoNetworkingPdu type
* @param value to encode
* @return encoded value
****************************************************/
INTEGER fx__dec__GeoNetworkingPdu(BITSTRING& b, LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu& p)
{
loggers::loggers::log("fx__dec__GeoNetworkingPdu");
return -1;
}
/****************************************************
* @desc External function to encode a Payload type
* @param value to encode
* @return encoded value
****************************************************/
BITSTRING fx__enc__Payload(const LibItsGeoNetworking__TypesAndValues::Payload& p)
{
loggers::loggers::log("fx__enc__Payload");
return int2bit(0,8);
}
/****************************************************
* @desc External function to decode a Payload type
* @param value to encode
* @return encoded value
****************************************************/
INTEGER fx__dec__Payload(BITSTRING& b, LibItsGeoNetworking__TypesAndValues::Payload& p)
{
return -1;
}
/****************************************************
* @desc External function to encode a GnNonSecuredPacket type
* @param value to encode
* @return encoded value
****************************************************/
BITSTRING fx__enc__GnNonSecuredPacket(const LibItsGeoNetworking__TypesAndValues::GnNonSecuredPacket& p)
{
return int2bit(0,8);
}
/****************************************************
* @desc External function to decode a GnNonSecuredPacket type
* @param value to encode
* @return encoded value
****************************************************/
INTEGER fx__dec__GnNonSecuredPacket(BITSTRING& b, LibItsGeoNetworking__TypesAndValues::GnNonSecuredPacket& p)
{
return -1;
}
}
/****************************************************
* @desc External function to decode a GnNonSecuredPacket type
* @param value to encode
* @return encoded value
****************************************************/
INTEGER fx__dec__GnNonSecuredPacket(BITSTRING& b, LibItsGeoNetworking__TypesAndValues::GnNonSecuredPacket& p)
{
return -1;
}
} //end namespace
#include <string>
#include <typeinfo>
#include "BTPCodec.hh"
#include "BTPTypes.hh"
#include "loggers.hh"
#include "LibItsBtp_TypesAndValues.hh"
#include <TTCN3.hh>
template <typename T_type> class OPTIONAL;
class TTCN_EncDec;
int BTPCodec::encode (const LibItsBtp__TypesAndValues::BtpPacket& p, OCTETSTRING& data)
int BTPCodec::encode (const LibItsBtp__TypesAndValues::BtpPacket& msg, OCTETSTRING& data)
{
loggers::get_instance().log_msg(">>> BTPCodec::encode: ", (const Base_Type&)msg);
TTCN_EncDec::clear_error();
TTCN_Buffer encoding_buffer;
encode_(msg, LibItsBtp__TypesAndValues::BtpPacket_descr_, encoding_buffer);
data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data());
loggers::get_instance().log_msg("<<< BTPCodec::encode: data=", data);
return 0;
/*
TTCN_Buffer b;
p.header().encode(LibItsBtp__TypesAndValues::BtpHeader_descr_, b, TTCN_EncDec::CT_RAW);
b.get_string(data);
return 0;
return 0;*/
}
int BTPCodec::encode_ (const Base_Type& type, const TTCN_Typedescriptor_t& field_descriptor, TTCN_Buffer& encoding_buffer)
{
loggers::get_instance().log(">>> BTPCodec::encode_: processing %s/%s", type.get_descriptor()->name, field_descriptor.name);
loggers::get_instance().log_msg(">>> BTPCodec::encode_: ", type);
if (dynamic_cast<const Record_Type *>(&type) != NULL) {
const Record_Type& r = (const Record_Type &)type;
loggers::get_instance().log("BTPCodec::encode_: processing Record_Type %s", r.get_descriptor()->name);
for(int i = 0; i < r.get_count(); i++) {
loggers::get_instance().log("BTPCodec::encode_: processing %s/%s/%s - %d (1 ==> use dynamic_cast<const OPTIONAL<...>) - %d", r.fld_name(i), r.fld_descr(i)->name, r.get_at(i)->get_descriptor()->name, r.get_at(i)->is_optional(), r.get_at(i)->is_present());
if (r.get_at(i)->is_present()) {
if (encode_(*r.get_at(i), *r.fld_descr(i), encoding_buffer) == -1) {
loggers::get_instance().warning("BTPCodec::encode_: -1 result code returned");
return -1;
}
}
} // End of 'for' statement
} else if (std::string(type.get_descriptor()->name).compare("@LibItsBtp_TypesAndValues.BtpPayload") == 0) {
const OPTIONAL<LibItsBtp__TypesAndValues::BtpPayload> &v = dynamic_cast<const OPTIONAL<LibItsBtp__TypesAndValues::BtpPayload> &>(type);
loggers::get_instance().log("BTPCodec::encode_: Payload present: %d", v.is_present());
if (v.is_present()) {
if (encode_(static_cast<const LibItsBtp__TypesAndValues::BtpPayload &>(*v.get_opt_value()), LibItsBtp__TypesAndValues::BtpPayload_descr_, encoding_buffer) == -1) {
loggers::get_instance().warning("BTPCodec::encode_: -1 result code returned");
return -1;
}
}
} else if (std::string(type.get_descriptor()->name).compare("@LibItsBtp_TypesAndValues.DecodedBtpPayload") == 0) {
const OPTIONAL<LibItsBtp__TypesAndValues::DecodedBtpPayload> &v = dynamic_cast<const OPTIONAL<LibItsBtp__TypesAndValues::DecodedBtpPayload> &>(type);