接口动态库自动生成功能已经实现

This commit is contained in:
jinchao 2025-05-26 09:04:11 +08:00
parent d2dafdbdea
commit 14d7a4b500
42 changed files with 3235 additions and 3674 deletions

View File

@ -0,0 +1,77 @@
#include "Aerodynamics_input.hpp"
namespace XNSim::C909::ATA04
{
Aerodynamics_input_Interface::Aerodynamics_input_Interface()
{
MAP_DATA_FUNC(l_04_i_aerocomac_alpha_f8);
MAP_DATA_FUNC(l_04_i_aerocomac_alpdot_f8);
MAP_DATA_FUNC(l_04_i_aerocomac_beta_f8);
MAP_DATA_FUNC(l_04_i_aerocomac_press_alt_f8);
MAP_DATA_FUNC(l_04_i_aerocomac_tas_f8);
MAP_DATA_FUNC(l_04_i_aerocomac_mach_f8);
MAP_DATA_FUNC(l_04_i_aerocomac_nx_f8);
MAP_DATA_FUNC(l_04_i_aerocomac_ny_f8);
MAP_DATA_FUNC(l_04_i_aerocomac_nz_f8);
MAP_DATA_FUNC(l_04_i_aerocomac_p_f8);
MAP_DATA_FUNC(l_04_i_aerocomac_q_f8);
MAP_DATA_FUNC(l_04_i_aerocomac_r_f8);
MAP_DATA_FUNC(l_04_i_aerocomac_qbar_f8);
MAP_DATA_FUNC(l_04_i_aerocomac_blcg_f8);
MAP_DATA_FUNC(l_04_i_aerocomac_bscg_f8);
MAP_DATA_FUNC(l_04_i_aerocomac_wlcg_f8);
MAP_DATA_FUNC(l_04_i_aerocomac_ail_f8);
MAP_DATA_FUNC(l_04_i_aerocomac_elv_f8);
MAP_DATA_FUNC(l_04_i_aerocomac_rud_f8);
MAP_DATA_FUNC(l_04_i_aerocomac_stab_f8);
MAP_DATA_FUNC(l_04_i_aerocomac_gear_f8);
MAP_DATA_FUNC(l_04_i_aerocomac_flap_f8);
MAP_DATA_FUNC(l_04_i_aerocomac_slat_f8);
MAP_DATA_FUNC(l_04_i_aerocomac_spl_f8);
MAP_DATA_FUNC(l_04_i_aerocomac_tnet_f8);
MAP_DATA_FUNC(l_04_i_aerocomac_kice_f8);
MAP_DATA_FUNC(l_04_i_aerocomac_alt_agl_f8);
this->header[0] = 0xa6; // XNSim头0xa6
this->header[1] = 0xc0; // 机型头0xc0表示C909
this->header[2] = 0x04; // 章节头0x04表示ATA04
this->header[3] = 0x01; // 模型头0x01表示GroundHandling
this->header[4] = 0x00; // 结构体头0x00表示输入结构体
this->header[5] = 0x00; // 数据方向0x00表示外部输入
this->header[6] = 0x00; // 数据大小
this->header[7] = 0x00; // 数据大小
}
Aerodynamics_input_Interface::~Aerodynamics_input_Interface()
{
}
void Aerodynamics_input_Interface::Initialize(XNFrameworkPtr framework, uint32_t modelId,uint32_t DDS_type)
{
auto ddsManager = framework->GetDDSManager();
if (!ddsManager) {
LOG_ERROR("DDSManager is nullptr");
return;
}
if (DDS_type == 0) {
dataWriter = ddsManager->RegisterPublisher<XNSim::C909::ATA04::Aerodynamics_inputPubSubType>("XNSim::C909::ATA04::Aerodynamics_input", modelId);
ddsManager->RegisterSubscriber<XNSim::C909::ATA04::Aerodynamics_inputPubSubType>("XNSim::C909::ATA04::Aerodynamics_input", modelId, std::bind(&Aerodynamics_input_Interface::inputDataListener, this, std::placeholders::_1));
}
else if (DDS_type == 1) {
ddsManager->RegisterSubscriber<XNSim::C909::ATA04::Aerodynamics_inputPubSubType>("XNSim::C909::ATA04::Aerodynamics_input", modelId, std::bind(&Aerodynamics_input_Interface::inputDataListener, this, std::placeholders::_1));
}
else if (DDS_type == 2) {
dataWriter = ddsManager->RegisterPublisher<XNSim::C909::ATA04::Aerodynamics_inputPubSubType>("XNSim::C909::ATA04::Aerodynamics_input", modelId);
}
}
void Aerodynamics_input_Interface::clearOutData()
{
this->out_data = XNSim::C909::ATA04::Aerodynamics_input();
}
void Aerodynamics_input_Interface::sendOutData()
{
if (dataWriter) {
dataWriter->write(&this->out_data);
}
}
void Aerodynamics_input_Interface::inputDataListener(const XNSim::C909::ATA04::Aerodynamics_input &input)
{
this->data = input;
}
}

View File

@ -0,0 +1,86 @@
#pragma once
#include "../C909_V1PubSubTypes.hpp"
#include "XNCore/XNDDSInterface.h"
namespace XNSim::C909::ATA04
{
class Aerodynamics_input_Interface final : public XNDDSInterface
{
public:
Aerodynamics_input_Interface();
virtual ~Aerodynamics_input_Interface();
virtual void Initialize(XNFrameworkPtr framework, uint32_t modelId, uint32_t DDS_type) override;
virtual void clearOutData() override;
virtual void sendOutData() override;
void inputDataListener(const XNSim::C909::ATA04::Aerodynamics_input &input);
template <typename T>
void getData(T *model_data)
{
if(model_data == nullptr)
return;
assign_value_get(data.l_04_i_aerocomac_alpha_f8(), model_data->l_04_i_aerocomac_alpha_f8);
assign_value_get(data.l_04_i_aerocomac_alpdot_f8(), model_data->l_04_i_aerocomac_alpdot_f8);
assign_value_get(data.l_04_i_aerocomac_beta_f8(), model_data->l_04_i_aerocomac_beta_f8);
assign_value_get(data.l_04_i_aerocomac_press_alt_f8(), model_data->l_04_i_aerocomac_press_alt_f8);
assign_value_get(data.l_04_i_aerocomac_tas_f8(), model_data->l_04_i_aerocomac_tas_f8);
assign_value_get(data.l_04_i_aerocomac_mach_f8(), model_data->l_04_i_aerocomac_mach_f8);
assign_value_get(data.l_04_i_aerocomac_nx_f8(), model_data->l_04_i_aerocomac_nx_f8);
assign_value_get(data.l_04_i_aerocomac_ny_f8(), model_data->l_04_i_aerocomac_ny_f8);
assign_value_get(data.l_04_i_aerocomac_nz_f8(), model_data->l_04_i_aerocomac_nz_f8);
assign_value_get(data.l_04_i_aerocomac_p_f8(), model_data->l_04_i_aerocomac_p_f8);
assign_value_get(data.l_04_i_aerocomac_q_f8(), model_data->l_04_i_aerocomac_q_f8);
assign_value_get(data.l_04_i_aerocomac_r_f8(), model_data->l_04_i_aerocomac_r_f8);
assign_value_get(data.l_04_i_aerocomac_qbar_f8(), model_data->l_04_i_aerocomac_qbar_f8);
assign_value_get(data.l_04_i_aerocomac_blcg_f8(), model_data->l_04_i_aerocomac_blcg_f8);
assign_value_get(data.l_04_i_aerocomac_bscg_f8(), model_data->l_04_i_aerocomac_bscg_f8);
assign_value_get(data.l_04_i_aerocomac_wlcg_f8(), model_data->l_04_i_aerocomac_wlcg_f8);
assign_value_get(data.l_04_i_aerocomac_ail_f8(), model_data->l_04_i_aerocomac_ail_f8);
assign_value_get(data.l_04_i_aerocomac_elv_f8(), model_data->l_04_i_aerocomac_elv_f8);
assign_value_get(data.l_04_i_aerocomac_rud_f8(), model_data->l_04_i_aerocomac_rud_f8);
assign_value_get(data.l_04_i_aerocomac_stab_f8(), model_data->l_04_i_aerocomac_stab_f8);
assign_value_get(data.l_04_i_aerocomac_gear_f8(), model_data->l_04_i_aerocomac_gear_f8);
assign_value_get(data.l_04_i_aerocomac_flap_f8(), model_data->l_04_i_aerocomac_flap_f8);
assign_value_get(data.l_04_i_aerocomac_slat_f8(), model_data->l_04_i_aerocomac_slat_f8);
assign_value_get(data.l_04_i_aerocomac_spl_f8(), model_data->l_04_i_aerocomac_spl_f8);
assign_value_get(data.l_04_i_aerocomac_tnet_f8(), model_data->l_04_i_aerocomac_tnet_f8);
assign_value_get(data.l_04_i_aerocomac_kice_f8(), model_data->l_04_i_aerocomac_kice_f8);
assign_value_get(data.l_04_i_aerocomac_alt_agl_f8(), model_data->l_04_i_aerocomac_alt_agl_f8);
}
template <typename T>
void setData(T *model_data)
{
if(model_data == nullptr)
return;
clearOutData();
assign_value_set(data.l_04_i_aerocomac_alpha_f8(), model_data->Aerodynamics_input);
assign_value_set(data.l_04_i_aerocomac_alpdot_f8(), model_data->Aerodynamics_input);
assign_value_set(data.l_04_i_aerocomac_beta_f8(), model_data->Aerodynamics_input);
assign_value_set(data.l_04_i_aerocomac_press_alt_f8(), model_data->Aerodynamics_input);
assign_value_set(data.l_04_i_aerocomac_tas_f8(), model_data->Aerodynamics_input);
assign_value_set(data.l_04_i_aerocomac_mach_f8(), model_data->Aerodynamics_input);
assign_value_set(data.l_04_i_aerocomac_nx_f8(), model_data->Aerodynamics_input);
assign_value_set(data.l_04_i_aerocomac_ny_f8(), model_data->Aerodynamics_input);
assign_value_set(data.l_04_i_aerocomac_nz_f8(), model_data->Aerodynamics_input);
assign_value_set(data.l_04_i_aerocomac_p_f8(), model_data->Aerodynamics_input);
assign_value_set(data.l_04_i_aerocomac_q_f8(), model_data->Aerodynamics_input);
assign_value_set(data.l_04_i_aerocomac_r_f8(), model_data->Aerodynamics_input);
assign_value_set(data.l_04_i_aerocomac_qbar_f8(), model_data->Aerodynamics_input);
assign_value_set(data.l_04_i_aerocomac_blcg_f8(), model_data->Aerodynamics_input);
assign_value_set(data.l_04_i_aerocomac_bscg_f8(), model_data->Aerodynamics_input);
assign_value_set(data.l_04_i_aerocomac_wlcg_f8(), model_data->Aerodynamics_input);
assign_value_set(data.l_04_i_aerocomac_ail_f8(), model_data->Aerodynamics_input);
assign_value_set(data.l_04_i_aerocomac_elv_f8(), model_data->Aerodynamics_input);
assign_value_set(data.l_04_i_aerocomac_rud_f8(), model_data->Aerodynamics_input);
assign_value_set(data.l_04_i_aerocomac_stab_f8(), model_data->Aerodynamics_input);
assign_value_set(data.l_04_i_aerocomac_gear_f8(), model_data->Aerodynamics_input);
assign_value_set(data.l_04_i_aerocomac_flap_f8(), model_data->Aerodynamics_input);
assign_value_set(data.l_04_i_aerocomac_slat_f8(), model_data->Aerodynamics_input);
assign_value_set(data.l_04_i_aerocomac_spl_f8(), model_data->Aerodynamics_input);
assign_value_set(data.l_04_i_aerocomac_tnet_f8(), model_data->Aerodynamics_input);
assign_value_set(data.l_04_i_aerocomac_kice_f8(), model_data->Aerodynamics_input);
assign_value_set(data.l_04_i_aerocomac_alt_agl_f8(), model_data->Aerodynamics_input);
}
private:
XNSim::C909::ATA04::Aerodynamics_input data;
XNSim::C909::ATA04::Aerodynamics_input out_data;
};
}

View File

@ -0,0 +1,63 @@
#include "Aerodynamics_output.hpp"
namespace XNSim::C909::ATA04
{
Aerodynamics_output_Interface::Aerodynamics_output_Interface()
{
MAP_DATA_FUNC(l_04_o_aerocomac_fxb_f8);
MAP_DATA_FUNC(l_04_o_aerocomac_fyb_f8);
MAP_DATA_FUNC(l_04_o_aerocomac_fzb_f8);
MAP_DATA_FUNC(l_04_o_aerocomac_mxb_f8);
MAP_DATA_FUNC(l_04_o_aerocomac_myb_f8);
MAP_DATA_FUNC(l_04_o_aerocomac_mzb_f8);
MAP_DATA_FUNC(l_04_o_aerocomac_cls_f8);
MAP_DATA_FUNC(l_04_o_aerocomac_cl_f8);
MAP_DATA_FUNC(l_04_o_aerocomac_cd_f8);
MAP_DATA_FUNC(l_04_o_aerocomac_cm_f8);
MAP_DATA_FUNC(l_04_o_aerocomac_cr_f8);
MAP_DATA_FUNC(l_04_o_aerocomac_cy_f8);
MAP_DATA_FUNC(l_04_o_aerocomac_cn_f8);
this->header[0] = 0xa6; // XNSim头0xa6
this->header[1] = 0xc0; // 机型头0xc0表示C909
this->header[2] = 0x04; // 章节头0x04表示ATA04
this->header[3] = 0x01; // 模型头0x01表示GroundHandling
this->header[4] = 0x00; // 结构体头0x00表示输入结构体
this->header[5] = 0x00; // 数据方向0x00表示外部输入
this->header[6] = 0x00; // 数据大小
this->header[7] = 0x00; // 数据大小
}
Aerodynamics_output_Interface::~Aerodynamics_output_Interface()
{
}
void Aerodynamics_output_Interface::Initialize(XNFrameworkPtr framework, uint32_t modelId,uint32_t DDS_type)
{
auto ddsManager = framework->GetDDSManager();
if (!ddsManager) {
LOG_ERROR("DDSManager is nullptr");
return;
}
if (DDS_type == 0) {
dataWriter = ddsManager->RegisterPublisher<XNSim::C909::ATA04::Aerodynamics_outputPubSubType>("XNSim::C909::ATA04::Aerodynamics_output", modelId);
ddsManager->RegisterSubscriber<XNSim::C909::ATA04::Aerodynamics_outputPubSubType>("XNSim::C909::ATA04::Aerodynamics_output", modelId, std::bind(&Aerodynamics_output_Interface::inputDataListener, this, std::placeholders::_1));
}
else if (DDS_type == 1) {
ddsManager->RegisterSubscriber<XNSim::C909::ATA04::Aerodynamics_outputPubSubType>("XNSim::C909::ATA04::Aerodynamics_output", modelId, std::bind(&Aerodynamics_output_Interface::inputDataListener, this, std::placeholders::_1));
}
else if (DDS_type == 2) {
dataWriter = ddsManager->RegisterPublisher<XNSim::C909::ATA04::Aerodynamics_outputPubSubType>("XNSim::C909::ATA04::Aerodynamics_output", modelId);
}
}
void Aerodynamics_output_Interface::clearOutData()
{
this->out_data = XNSim::C909::ATA04::Aerodynamics_output();
}
void Aerodynamics_output_Interface::sendOutData()
{
if (dataWriter) {
dataWriter->write(&this->out_data);
}
}
void Aerodynamics_output_Interface::inputDataListener(const XNSim::C909::ATA04::Aerodynamics_output &input)
{
this->data = input;
}
}

View File

@ -0,0 +1,58 @@
#pragma once
#include "../C909_V1PubSubTypes.hpp"
#include "XNCore/XNDDSInterface.h"
namespace XNSim::C909::ATA04
{
class Aerodynamics_output_Interface final : public XNDDSInterface
{
public:
Aerodynamics_output_Interface();
virtual ~Aerodynamics_output_Interface();
virtual void Initialize(XNFrameworkPtr framework, uint32_t modelId, uint32_t DDS_type) override;
virtual void clearOutData() override;
virtual void sendOutData() override;
void inputDataListener(const XNSim::C909::ATA04::Aerodynamics_output &input);
template <typename T>
void getData(T *model_data)
{
if(model_data == nullptr)
return;
assign_value_get(data.l_04_o_aerocomac_fxb_f8(), model_data->l_04_o_aerocomac_fxb_f8);
assign_value_get(data.l_04_o_aerocomac_fyb_f8(), model_data->l_04_o_aerocomac_fyb_f8);
assign_value_get(data.l_04_o_aerocomac_fzb_f8(), model_data->l_04_o_aerocomac_fzb_f8);
assign_value_get(data.l_04_o_aerocomac_mxb_f8(), model_data->l_04_o_aerocomac_mxb_f8);
assign_value_get(data.l_04_o_aerocomac_myb_f8(), model_data->l_04_o_aerocomac_myb_f8);
assign_value_get(data.l_04_o_aerocomac_mzb_f8(), model_data->l_04_o_aerocomac_mzb_f8);
assign_value_get(data.l_04_o_aerocomac_cls_f8(), model_data->l_04_o_aerocomac_cls_f8);
assign_value_get(data.l_04_o_aerocomac_cl_f8(), model_data->l_04_o_aerocomac_cl_f8);
assign_value_get(data.l_04_o_aerocomac_cd_f8(), model_data->l_04_o_aerocomac_cd_f8);
assign_value_get(data.l_04_o_aerocomac_cm_f8(), model_data->l_04_o_aerocomac_cm_f8);
assign_value_get(data.l_04_o_aerocomac_cr_f8(), model_data->l_04_o_aerocomac_cr_f8);
assign_value_get(data.l_04_o_aerocomac_cy_f8(), model_data->l_04_o_aerocomac_cy_f8);
assign_value_get(data.l_04_o_aerocomac_cn_f8(), model_data->l_04_o_aerocomac_cn_f8);
}
template <typename T>
void setData(T *model_data)
{
if(model_data == nullptr)
return;
clearOutData();
assign_value_set(data.l_04_o_aerocomac_fxb_f8(), model_data->Aerodynamics_output);
assign_value_set(data.l_04_o_aerocomac_fyb_f8(), model_data->Aerodynamics_output);
assign_value_set(data.l_04_o_aerocomac_fzb_f8(), model_data->Aerodynamics_output);
assign_value_set(data.l_04_o_aerocomac_mxb_f8(), model_data->Aerodynamics_output);
assign_value_set(data.l_04_o_aerocomac_myb_f8(), model_data->Aerodynamics_output);
assign_value_set(data.l_04_o_aerocomac_mzb_f8(), model_data->Aerodynamics_output);
assign_value_set(data.l_04_o_aerocomac_cls_f8(), model_data->Aerodynamics_output);
assign_value_set(data.l_04_o_aerocomac_cl_f8(), model_data->Aerodynamics_output);
assign_value_set(data.l_04_o_aerocomac_cd_f8(), model_data->Aerodynamics_output);
assign_value_set(data.l_04_o_aerocomac_cm_f8(), model_data->Aerodynamics_output);
assign_value_set(data.l_04_o_aerocomac_cr_f8(), model_data->Aerodynamics_output);
assign_value_set(data.l_04_o_aerocomac_cy_f8(), model_data->Aerodynamics_output);
assign_value_set(data.l_04_o_aerocomac_cn_f8(), model_data->Aerodynamics_output);
}
private:
XNSim::C909::ATA04::Aerodynamics_output data;
XNSim::C909::ATA04::Aerodynamics_output out_data;
};
}

View File

@ -1,65 +0,0 @@
#include "GroundHandling_heartbeat.hpp"
namespace XNSim::C909::ATA04
{
GroundHandling_heartbeat_Interface::GroundHandling_heartbeat_Interface()
{
MAP_DATA_FUNC(groundhandling_model_heartbeat);
this->header[0] = 0xa6; // XNSim头0xa6
this->header[1] = 0xc0; // 机型头0xc0表示C909
this->header[2] = 0x04; // 章节头0x04表示ATA04
this->header[3] = 0x01; // 模型头0x01表示GroundHandling
this->header[4] = 0x02; // 结构体头0x02表示心跳结构体
this->header[5] = 0x00; // 数据方向0x00表示外部输入
this->header[6] = 0x00; // 数据大小
this->header[7] = 0x00; // 数据大小
}
GroundHandling_heartbeat_Interface::~GroundHandling_heartbeat_Interface()
{
}
void GroundHandling_heartbeat_Interface::Initialize(XNFrameworkPtr framework, uint32_t modelId,
uint32_t DDS_type)
{
auto ddsManager = framework->GetDDSManager();
if (!ddsManager) {
LOG_ERROR("DDSManager is nullptr");
return;
}
if (DDS_type == 0) { // 读取与发送都进行
dataWriter =
ddsManager->RegisterPublisher<XNSim::C909::ATA04::GroundHandling_heartbeatPubSubType>(
"XNSim::C909::ATA04::GroundHandling_heartbeat", modelId);
ddsManager->RegisterSubscriber<XNSim::C909::ATA04::GroundHandling_heartbeatPubSubType>(
"XNSim::C909::ATA04::GroundHandling_heartbeat", modelId,
std::bind(&GroundHandling_heartbeat_Interface::heartbeatListener, this,
std::placeholders::_1));
} else if (DDS_type == 1) { // 只读取
ddsManager->RegisterSubscriber<XNSim::C909::ATA04::GroundHandling_heartbeatPubSubType>(
"XNSim::C909::ATA04::GroundHandling_heartbeat", modelId,
std::bind(&GroundHandling_heartbeat_Interface::heartbeatListener, this,
std::placeholders::_1));
} else if (DDS_type == 2) { // 只发送
dataWriter =
ddsManager->RegisterPublisher<XNSim::C909::ATA04::GroundHandling_heartbeatPubSubType>(
"XNSim::C909::ATA04::GroundHandling_heartbeat", modelId);
}
}
void GroundHandling_heartbeat_Interface::clearOutData()
{
this->out_data = XNSim::C909::ATA04::GroundHandling_heartbeat();
}
void GroundHandling_heartbeat_Interface::sendOutData()
{
dataWriter->write(&this->out_data);
}
void GroundHandling_heartbeat_Interface::heartbeatListener(
const XNSim::C909::ATA04::GroundHandling_heartbeat &heartbeat)
{
this->data = heartbeat;
}
} // namespace XNSim::C909::ATA04

View File

@ -1,39 +0,0 @@
#include "../C909_V1PubSubTypes.hpp"
#include "XNCore/XNDDSInterface.h"
namespace XNSim::C909::ATA04
{
class GroundHandling_heartbeat_Interface final : public XNDDSInterface
{
public:
GroundHandling_heartbeat_Interface();
virtual ~GroundHandling_heartbeat_Interface();
virtual void Initialize(XNFrameworkPtr framework, uint32_t modelId, uint32_t DDS_type) override;
void heartbeatListener(const XNSim::C909::ATA04::GroundHandling_heartbeat &heartbeat);
virtual void clearOutData() override;
virtual void sendOutData() override;
template <typename T>
void getData(T *model_data)
{
if (model_data == nullptr)
return;
assign_value_get(data.groundhandling_model_heartbeat(),
model_data->groundhandling_model_heartbeat);
}
template <typename T>
void setData(T *model_data)
{
if (model_data == nullptr)
return;
clearOutData();
assign_value_set(data.groundhandling_model_heartbeat(),
model_data->groundhandling_model_heartbeat);
sendOutData();
}
private:
XNSim::C909::ATA04::GroundHandling_heartbeat data;
XNSim::C909::ATA04::GroundHandling_heartbeat out_data;
};
} // namespace XNSim::C909::ATA04

View File

@ -1,5 +1,4 @@
#include "GroundHandling_input.hpp" #include "GroundHandling_input.hpp"
namespace XNSim::C909::ATA04 namespace XNSim::C909::ATA04
{ {
GroundHandling_input_Interface::GroundHandling_input_Interface() GroundHandling_input_Interface::GroundHandling_input_Interface()
@ -52,52 +51,39 @@ GroundHandling_input_Interface::GroundHandling_input_Interface()
this->header[6] = 0x00; // 数据大小 this->header[6] = 0x00; // 数据大小
this->header[7] = 0x00; // 数据大小 this->header[7] = 0x00; // 数据大小
} }
GroundHandling_input_Interface::~GroundHandling_input_Interface() GroundHandling_input_Interface::~GroundHandling_input_Interface()
{ {
} }
void GroundHandling_input_Interface::Initialize(XNFrameworkPtr framework, uint32_t modelId,uint32_t DDS_type)
void GroundHandling_input_Interface::Initialize(XNFrameworkPtr framework, uint32_t modelId,
uint32_t DDS_type)
{ {
auto ddsManager = framework->GetDDSManager(); auto ddsManager = framework->GetDDSManager();
if (!ddsManager) { if (!ddsManager) {
LOG_ERROR("DDSManager is nullptr"); LOG_ERROR("DDSManager is nullptr");
return; return;
} }
if (DDS_type == 0) { // 读取与发送都进行 if (DDS_type == 0) {
dataWriter = dataWriter = ddsManager->RegisterPublisher<XNSim::C909::ATA04::GroundHandling_inputPubSubType>("XNSim::C909::ATA04::GroundHandling_input", modelId);
ddsManager->RegisterPublisher<XNSim::C909::ATA04::GroundHandling_inputPubSubType>( ddsManager->RegisterSubscriber<XNSim::C909::ATA04::GroundHandling_inputPubSubType>("XNSim::C909::ATA04::GroundHandling_input", modelId, std::bind(&GroundHandling_input_Interface::inputDataListener, this, std::placeholders::_1));
"XNSim::C909::ATA04::GroundHandling_input", modelId); }
ddsManager->RegisterSubscriber<XNSim::C909::ATA04::GroundHandling_inputPubSubType>( else if (DDS_type == 1) {
"XNSim::C909::ATA04::GroundHandling_input", modelId, ddsManager->RegisterSubscriber<XNSim::C909::ATA04::GroundHandling_inputPubSubType>("XNSim::C909::ATA04::GroundHandling_input", modelId, std::bind(&GroundHandling_input_Interface::inputDataListener, this, std::placeholders::_1));
std::bind(&GroundHandling_input_Interface::inputDataListener, this, }
std::placeholders::_1)); else if (DDS_type == 2) {
} else if (DDS_type == 1) { // 只读取 dataWriter = ddsManager->RegisterPublisher<XNSim::C909::ATA04::GroundHandling_inputPubSubType>("XNSim::C909::ATA04::GroundHandling_input", modelId);
ddsManager->RegisterSubscriber<XNSim::C909::ATA04::GroundHandling_inputPubSubType>(
"XNSim::C909::ATA04::GroundHandling_input", modelId,
std::bind(&GroundHandling_input_Interface::inputDataListener, this,
std::placeholders::_1));
} else if (DDS_type == 2) { // 只发送
dataWriter =
ddsManager->RegisterPublisher<XNSim::C909::ATA04::GroundHandling_inputPubSubType>(
"XNSim::C909::ATA04::GroundHandling_input", modelId);
} }
} }
void GroundHandling_input_Interface::clearOutData() void GroundHandling_input_Interface::clearOutData()
{ {
this->out_data = XNSim::C909::ATA04::GroundHandling_input(); this->out_data = XNSim::C909::ATA04::GroundHandling_input();
} }
void GroundHandling_input_Interface::sendOutData() void GroundHandling_input_Interface::sendOutData()
{ {
dataWriter->write(&this->out_data); if (dataWriter) {
dataWriter->write(&this->out_data);
}
} }
void GroundHandling_input_Interface::inputDataListener(const XNSim::C909::ATA04::GroundHandling_input &input)
void GroundHandling_input_Interface::inputDataListener(
const XNSim::C909::ATA04::GroundHandling_input &input)
{ {
this->data = input; this->data = input;
} }
} // namespace XNSim::C909::ATA04 }

View File

@ -1,6 +1,6 @@
#pragma once
#include "../C909_V1PubSubTypes.hpp" #include "../C909_V1PubSubTypes.hpp"
#include "XNCore/XNDDSInterface.h" #include "XNCore/XNDDSInterface.h"
namespace XNSim::C909::ATA04 namespace XNSim::C909::ATA04
{ {
class GroundHandling_input_Interface final : public XNDDSInterface class GroundHandling_input_Interface final : public XNDDSInterface
@ -8,16 +8,14 @@ class GroundHandling_input_Interface final : public XNDDSInterface
public: public:
GroundHandling_input_Interface(); GroundHandling_input_Interface();
virtual ~GroundHandling_input_Interface(); virtual ~GroundHandling_input_Interface();
virtual void Initialize(XNFrameworkPtr framework, uint32_t modelId, uint32_t DDS_type) override; virtual void Initialize(XNFrameworkPtr framework, uint32_t modelId, uint32_t DDS_type) override;
virtual void clearOutData() override; virtual void clearOutData() override;
virtual void sendOutData() override; virtual void sendOutData() override;
void inputDataListener(const XNSim::C909::ATA04::GroundHandling_input &input); void inputDataListener(const XNSim::C909::ATA04::GroundHandling_input &input);
template <typename T> template <typename T>
void getData(T *model_data) void getData(T *model_data)
{ {
if (model_data == nullptr) if(model_data == nullptr)
return; return;
assign_value_get(data.l_04_i_gdcomac_frz_l1(), model_data->l_04_i_gdcomac_frz_l1); assign_value_get(data.l_04_i_gdcomac_frz_l1(), model_data->l_04_i_gdcomac_frz_l1);
assign_value_get(data.l_04_i_gdcomac_chocks_l1(), model_data->l_04_i_gdcomac_chocks_l1); assign_value_get(data.l_04_i_gdcomac_chocks_l1(), model_data->l_04_i_gdcomac_chocks_l1);
@ -32,110 +30,81 @@ public:
assign_value_get(data.l_04_i_gdcomac_blcg_f8(), model_data->l_04_i_gdcomac_blcg_f8); assign_value_get(data.l_04_i_gdcomac_blcg_f8(), model_data->l_04_i_gdcomac_blcg_f8);
assign_value_get(data.l_04_i_gdcomac_bscg_f8(), model_data->l_04_i_gdcomac_bscg_f8); assign_value_get(data.l_04_i_gdcomac_bscg_f8(), model_data->l_04_i_gdcomac_bscg_f8);
assign_value_get(data.l_04_i_gdcomac_wlcg_f8(), model_data->l_04_i_gdcomac_wlcg_f8); assign_value_get(data.l_04_i_gdcomac_wlcg_f8(), model_data->l_04_i_gdcomac_wlcg_f8);
assign_value_get(data.l_04_i_gdcomac_pb_active_l1(), assign_value_get(data.l_04_i_gdcomac_pb_active_l1(), model_data->l_04_i_gdcomac_pb_active_l1);
model_data->l_04_i_gdcomac_pb_active_l1); assign_value_get(data.l_04_i_gdcomac_brake_torq_f8(), model_data->l_04_i_gdcomac_brake_torq_f8);
assign_value_get(data.l_04_i_gdcomac_brake_torq_f8(),
model_data->l_04_i_gdcomac_brake_torq_f8);
assign_value_get(data.l_04_i_gdcomac_gear_f8(), model_data->l_04_i_gdcomac_gear_f8); assign_value_get(data.l_04_i_gdcomac_gear_f8(), model_data->l_04_i_gdcomac_gear_f8);
assign_value_get(data.l_04_i_gdcomac_gsteer_f8(), model_data->l_04_i_gdcomac_gsteer_f8); assign_value_get(data.l_04_i_gdcomac_gsteer_f8(), model_data->l_04_i_gdcomac_gsteer_f8);
assign_value_get(data.l_04_i_gdcomac_tire_pres_f8(), assign_value_get(data.l_04_i_gdcomac_tire_pres_f8(), model_data->l_04_i_gdcomac_tire_pres_f8);
model_data->l_04_i_gdcomac_tire_pres_f8);
assign_value_get(data.l_04_i_gdcomac_onjax_l1(), model_data->l_04_i_gdcomac_onjax_l1); assign_value_get(data.l_04_i_gdcomac_onjax_l1(), model_data->l_04_i_gdcomac_onjax_l1);
assign_value_get(data.l_04_i_gdcomac_contdep_f8(), model_data->l_04_i_gdcomac_contdep_f8); assign_value_get(data.l_04_i_gdcomac_contdep_f8(), model_data->l_04_i_gdcomac_contdep_f8);
assign_value_get(data.l_04_i_gdcomac_thetag_f8(), model_data->l_04_i_gdcomac_thetag_f8); assign_value_get(data.l_04_i_gdcomac_thetag_f8(), model_data->l_04_i_gdcomac_thetag_f8);
assign_value_get(data.l_04_i_gdcomac_phig_f8(), model_data->l_04_i_gdcomac_phig_f8); assign_value_get(data.l_04_i_gdcomac_phig_f8(), model_data->l_04_i_gdcomac_phig_f8);
assign_value_get(data.l_04_i_gdcomac_rwyrgh_i2(), model_data->l_04_i_gdcomac_rwyrgh_i2); assign_value_get(data.l_04_i_gdcomac_rwyrgh_i2(), model_data->l_04_i_gdcomac_rwyrgh_i2);
assign_value_get(data.l_04_i_gdcomac_rwyhdg_f8(), model_data->l_04_i_gdcomac_rwyhdg_f8); assign_value_get(data.l_04_i_gdcomac_rwyhdg_f8(), model_data->l_04_i_gdcomac_rwyhdg_f8);
assign_value_get(data.l_04_i_gdcomac_reset_braketemp_l1(), assign_value_get(data.l_04_i_gdcomac_reset_braketemp_l1(), model_data->l_04_i_gdcomac_reset_braketemp_l1);
model_data->l_04_i_gdcomac_reset_braketemp_l1); assign_value_get(data.l_04_i_gdcomac_reset_tirepress_l1(), model_data->l_04_i_gdcomac_reset_tirepress_l1);
assign_value_get(data.l_04_i_gdcomac_reset_tirepress_l1(),
model_data->l_04_i_gdcomac_reset_tirepress_l1);
assign_value_get(data.l_04_i_gdcomac_temp_c_f8(), model_data->l_04_i_gdcomac_temp_c_f8); assign_value_get(data.l_04_i_gdcomac_temp_c_f8(), model_data->l_04_i_gdcomac_temp_c_f8);
assign_value_get(data.l_04_i_gdcomac_brake_temp_f8(), assign_value_get(data.l_04_i_gdcomac_brake_temp_f8(), model_data->l_04_i_gdcomac_brake_temp_f8);
model_data->l_04_i_gdcomac_brake_temp_f8); assign_value_get(data.l_04_i_gdcomac_tire_tburst_l1(), model_data->l_04_i_gdcomac_tire_tburst_l1);
assign_value_get(data.l_04_i_gdcomac_tire_tburst_l1(), assign_value_get(data.l_04_i_gdcomac_tire_tflat_l1(), model_data->l_04_i_gdcomac_tire_tflat_l1);
model_data->l_04_i_gdcomac_tire_tburst_l1); assign_value_get(data.l_04_i_gdcomac_brk_reset_tpres_l1(), model_data->l_04_i_gdcomac_brk_reset_tpres_l1);
assign_value_get(data.l_04_i_gdcomac_tire_tflat_l1(),
model_data->l_04_i_gdcomac_tire_tflat_l1);
assign_value_get(data.l_04_i_gdcomac_brk_reset_tpres_l1(),
model_data->l_04_i_gdcomac_brk_reset_tpres_l1);
assign_value_get(data.l_04_i_gdcomac_rcon_ci_f8(), model_data->l_04_i_gdcomac_rcon_ci_f8); assign_value_get(data.l_04_i_gdcomac_rcon_ci_f8(), model_data->l_04_i_gdcomac_rcon_ci_f8);
assign_value_get(data.l_04_i_gdcomac_pb_towforce_f8(), assign_value_get(data.l_04_i_gdcomac_pb_towforce_f8(), model_data->l_04_i_gdcomac_pb_towforce_f8);
model_data->l_04_i_gdcomac_pb_towforce_f8); assign_value_get(data.l_04_i_gdcomac_gsteer_state_i4(), model_data->l_04_i_gdcomac_gsteer_state_i4);
assign_value_get(data.l_04_i_gdcomac_gsteer_state_i4(), assign_value_get(data.l_04_i_gdcomac_trim_active_l1(), model_data->l_04_i_gdcomac_trim_active_l1);
model_data->l_04_i_gdcomac_gsteer_state_i4);
assign_value_get(data.l_04_i_gdcomac_trim_active_l1(),
model_data->l_04_i_gdcomac_trim_active_l1);
assign_value_get(data.l_04_i_gdcomac_phi_deg_f8(), model_data->l_04_i_gdcomac_phi_deg_f8); assign_value_get(data.l_04_i_gdcomac_phi_deg_f8(), model_data->l_04_i_gdcomac_phi_deg_f8);
assign_value_get(data.l_04_i_gdcomac_theta_deg_f8(), assign_value_get(data.l_04_i_gdcomac_theta_deg_f8(), model_data->l_04_i_gdcomac_theta_deg_f8);
model_data->l_04_i_gdcomac_theta_deg_f8);
assign_value_get(data.l_04_i_gdcomac_psi_deg_f8(), model_data->l_04_i_gdcomac_psi_deg_f8); assign_value_get(data.l_04_i_gdcomac_psi_deg_f8(), model_data->l_04_i_gdcomac_psi_deg_f8);
assign_value_get(data.l_04_i_gdcomac_resetint_l1(), model_data->l_04_i_gdcomac_resetint_l1); assign_value_get(data.l_04_i_gdcomac_resetint_l1(), model_data->l_04_i_gdcomac_resetint_l1);
} }
template <typename T> template <typename T>
void setData(T *model_data) void setData(T *model_data)
{ {
if (model_data == nullptr) if(model_data == nullptr)
return; return;
clearOutData(); clearOutData();
assign_value_set(data.l_04_i_gdcomac_frz_l1(), model_data->l_04_i_gdcomac_frz_l1); assign_value_set(data.l_04_i_gdcomac_frz_l1(), model_data->GroundHandling_input);
assign_value_set(data.l_04_i_gdcomac_chocks_l1(), model_data->l_04_i_gdcomac_chocks_l1); assign_value_set(data.l_04_i_gdcomac_chocks_l1(), model_data->GroundHandling_input);
assign_value_set(data.l_04_i_gdcomac_alt_agl_f8(), model_data->l_04_i_gdcomac_alt_agl_f8); assign_value_set(data.l_04_i_gdcomac_alt_agl_f8(), model_data->GroundHandling_input);
assign_value_set(data.l_04_i_gdcomac_frzflt_l1(), model_data->l_04_i_gdcomac_frzflt_l1); assign_value_set(data.l_04_i_gdcomac_frzflt_l1(), model_data->GroundHandling_input);
assign_value_set(data.l_04_i_gdcomac_p_f8(), model_data->l_04_i_gdcomac_p_f8); assign_value_set(data.l_04_i_gdcomac_p_f8(), model_data->GroundHandling_input);
assign_value_set(data.l_04_i_gdcomac_q_f8(), model_data->l_04_i_gdcomac_q_f8); assign_value_set(data.l_04_i_gdcomac_q_f8(), model_data->GroundHandling_input);
assign_value_set(data.l_04_i_gdcomac_r_f8(), model_data->l_04_i_gdcomac_r_f8); assign_value_set(data.l_04_i_gdcomac_r_f8(), model_data->GroundHandling_input);
assign_value_set(data.l_04_i_gdcomac_ug_f8(), model_data->l_04_i_gdcomac_ug_f8); assign_value_set(data.l_04_i_gdcomac_ug_f8(), model_data->GroundHandling_input);
assign_value_set(data.l_04_i_gdcomac_vg_f8(), model_data->l_04_i_gdcomac_vg_f8); assign_value_set(data.l_04_i_gdcomac_vg_f8(), model_data->GroundHandling_input);
assign_value_set(data.l_04_i_gdcomac_wg_f8(), model_data->l_04_i_gdcomac_wg_f8); assign_value_set(data.l_04_i_gdcomac_wg_f8(), model_data->GroundHandling_input);
assign_value_set(data.l_04_i_gdcomac_blcg_f8(), model_data->l_04_i_gdcomac_blcg_f8); assign_value_set(data.l_04_i_gdcomac_blcg_f8(), model_data->GroundHandling_input);
assign_value_set(data.l_04_i_gdcomac_bscg_f8(), model_data->l_04_i_gdcomac_bscg_f8); assign_value_set(data.l_04_i_gdcomac_bscg_f8(), model_data->GroundHandling_input);
assign_value_set(data.l_04_i_gdcomac_wlcg_f8(), model_data->l_04_i_gdcomac_wlcg_f8); assign_value_set(data.l_04_i_gdcomac_wlcg_f8(), model_data->GroundHandling_input);
assign_value_set(data.l_04_i_gdcomac_pb_active_l1(), assign_value_set(data.l_04_i_gdcomac_pb_active_l1(), model_data->GroundHandling_input);
model_data->l_04_i_gdcomac_pb_active_l1); assign_value_set(data.l_04_i_gdcomac_brake_torq_f8(), model_data->GroundHandling_input);
assign_value_set(data.l_04_i_gdcomac_brake_torq_f8(), assign_value_set(data.l_04_i_gdcomac_gear_f8(), model_data->GroundHandling_input);
model_data->l_04_i_gdcomac_brake_torq_f8); assign_value_set(data.l_04_i_gdcomac_gsteer_f8(), model_data->GroundHandling_input);
assign_value_set(data.l_04_i_gdcomac_gear_f8(), model_data->l_04_i_gdcomac_gear_f8); assign_value_set(data.l_04_i_gdcomac_tire_pres_f8(), model_data->GroundHandling_input);
assign_value_set(data.l_04_i_gdcomac_gsteer_f8(), model_data->l_04_i_gdcomac_gsteer_f8); assign_value_set(data.l_04_i_gdcomac_onjax_l1(), model_data->GroundHandling_input);
assign_value_set(data.l_04_i_gdcomac_tire_pres_f8(), assign_value_set(data.l_04_i_gdcomac_contdep_f8(), model_data->GroundHandling_input);
model_data->l_04_i_gdcomac_tire_pres_f8); assign_value_set(data.l_04_i_gdcomac_thetag_f8(), model_data->GroundHandling_input);
assign_value_set(data.l_04_i_gdcomac_onjax_l1(), model_data->l_04_i_gdcomac_onjax_l1); assign_value_set(data.l_04_i_gdcomac_phig_f8(), model_data->GroundHandling_input);
assign_value_set(data.l_04_i_gdcomac_contdep_f8(), model_data->l_04_i_gdcomac_contdep_f8); assign_value_set(data.l_04_i_gdcomac_rwyrgh_i2(), model_data->GroundHandling_input);
assign_value_set(data.l_04_i_gdcomac_thetag_f8(), model_data->l_04_i_gdcomac_thetag_f8); assign_value_set(data.l_04_i_gdcomac_rwyhdg_f8(), model_data->GroundHandling_input);
assign_value_set(data.l_04_i_gdcomac_phig_f8(), model_data->l_04_i_gdcomac_phig_f8); assign_value_set(data.l_04_i_gdcomac_reset_braketemp_l1(), model_data->GroundHandling_input);
assign_value_set(data.l_04_i_gdcomac_rwyrgh_i2(), model_data->l_04_i_gdcomac_rwyrgh_i2); assign_value_set(data.l_04_i_gdcomac_reset_tirepress_l1(), model_data->GroundHandling_input);
assign_value_set(data.l_04_i_gdcomac_rwyhdg_f8(), model_data->l_04_i_gdcomac_rwyhdg_f8); assign_value_set(data.l_04_i_gdcomac_temp_c_f8(), model_data->GroundHandling_input);
assign_value_set(data.l_04_i_gdcomac_reset_braketemp_l1(), assign_value_set(data.l_04_i_gdcomac_brake_temp_f8(), model_data->GroundHandling_input);
model_data->l_04_i_gdcomac_reset_braketemp_l1); assign_value_set(data.l_04_i_gdcomac_tire_tburst_l1(), model_data->GroundHandling_input);
assign_value_set(data.l_04_i_gdcomac_reset_tirepress_l1(), assign_value_set(data.l_04_i_gdcomac_tire_tflat_l1(), model_data->GroundHandling_input);
model_data->l_04_i_gdcomac_reset_tirepress_l1); assign_value_set(data.l_04_i_gdcomac_brk_reset_tpres_l1(), model_data->GroundHandling_input);
assign_value_set(data.l_04_i_gdcomac_temp_c_f8(), model_data->l_04_i_gdcomac_temp_c_f8); assign_value_set(data.l_04_i_gdcomac_rcon_ci_f8(), model_data->GroundHandling_input);
assign_value_set(data.l_04_i_gdcomac_brake_temp_f8(), assign_value_set(data.l_04_i_gdcomac_pb_towforce_f8(), model_data->GroundHandling_input);
model_data->l_04_i_gdcomac_brake_temp_f8); assign_value_set(data.l_04_i_gdcomac_gsteer_state_i4(), model_data->GroundHandling_input);
assign_value_set(data.l_04_i_gdcomac_tire_tburst_l1(), assign_value_set(data.l_04_i_gdcomac_trim_active_l1(), model_data->GroundHandling_input);
model_data->l_04_i_gdcomac_tire_tburst_l1); assign_value_set(data.l_04_i_gdcomac_phi_deg_f8(), model_data->GroundHandling_input);
assign_value_set(data.l_04_i_gdcomac_tire_tflat_l1(), assign_value_set(data.l_04_i_gdcomac_theta_deg_f8(), model_data->GroundHandling_input);
model_data->l_04_i_gdcomac_tire_tflat_l1); assign_value_set(data.l_04_i_gdcomac_psi_deg_f8(), model_data->GroundHandling_input);
assign_value_set(data.l_04_i_gdcomac_brk_reset_tpres_l1(), assign_value_set(data.l_04_i_gdcomac_resetint_l1(), model_data->GroundHandling_input);
model_data->l_04_i_gdcomac_brk_reset_tpres_l1);
assign_value_set(data.l_04_i_gdcomac_rcon_ci_f8(), model_data->l_04_i_gdcomac_rcon_ci_f8);
assign_value_set(data.l_04_i_gdcomac_pb_towforce_f8(),
model_data->l_04_i_gdcomac_pb_towforce_f8);
assign_value_set(data.l_04_i_gdcomac_gsteer_state_i4(),
model_data->l_04_i_gdcomac_gsteer_state_i4);
assign_value_set(data.l_04_i_gdcomac_trim_active_l1(),
model_data->l_04_i_gdcomac_trim_active_l1);
assign_value_set(data.l_04_i_gdcomac_phi_deg_f8(), model_data->l_04_i_gdcomac_phi_deg_f8);
assign_value_set(data.l_04_i_gdcomac_theta_deg_f8(),
model_data->l_04_i_gdcomac_theta_deg_f8);
assign_value_set(data.l_04_i_gdcomac_psi_deg_f8(), model_data->l_04_i_gdcomac_psi_deg_f8);
assign_value_set(data.l_04_i_gdcomac_resetint_l1(), model_data->l_04_i_gdcomac_resetint_l1);
sendOutData();
} }
private: private:
XNSim::C909::ATA04::GroundHandling_input data; XNSim::C909::ATA04::GroundHandling_input data;
XNSim::C909::ATA04::GroundHandling_input out_data; XNSim::C909::ATA04::GroundHandling_input out_data;
}; };
} // namespace XNSim::C909::ATA04 }

View File

@ -1,5 +1,4 @@
#include "GroundHandling_output.hpp" #include "GroundHandling_output.hpp"
namespace XNSim::C909::ATA04 namespace XNSim::C909::ATA04
{ {
GroundHandling_output_Interface::GroundHandling_output_Interface() GroundHandling_output_Interface::GroundHandling_output_Interface()
@ -38,62 +37,48 @@ GroundHandling_output_Interface::GroundHandling_output_Interface()
MAP_DATA_FUNC(l_04_o_gdcomac_dstruc_f8); MAP_DATA_FUNC(l_04_o_gdcomac_dstruc_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_wor_par_f8); MAP_DATA_FUNC(l_04_o_gdcomac_wor_par_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_nd_f8); MAP_DATA_FUNC(l_04_o_gdcomac_nd_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_vczt_f8);
this->header[0] = 0xa6; // XNSim头0xa6 this->header[0] = 0xa6; // XNSim头0xa6
this->header[1] = 0xc0; // 机型头0xc0表示C909 this->header[1] = 0xc0; // 机型头0xc0表示C909
this->header[2] = 0x04; // 章节头0x04表示ATA04 this->header[2] = 0x04; // 章节头0x04表示ATA04
this->header[3] = 0x01; // 模型头0x01表示GroundHandling this->header[3] = 0x01; // 模型头0x01表示GroundHandling
this->header[4] = 0x01; // 结构体头0x01表示输出结构体 this->header[4] = 0x00; // 结构体头0x00表示输入结构体
this->header[5] = 0x00; // 数据方向0x00表示外部输入 this->header[5] = 0x00; // 数据方向0x00表示外部输入
this->header[6] = 0x00; // 数据大小 this->header[6] = 0x00; // 数据大小
this->header[7] = 0x00; // 数据大小 this->header[7] = 0x00; // 数据大小
} }
GroundHandling_output_Interface::~GroundHandling_output_Interface() GroundHandling_output_Interface::~GroundHandling_output_Interface()
{ {
} }
void GroundHandling_output_Interface::Initialize(XNFrameworkPtr framework, uint32_t modelId,uint32_t DDS_type)
void GroundHandling_output_Interface::Initialize(XNFrameworkPtr framework, uint32_t modelId,
uint32_t DDS_type)
{ {
auto ddsManager = framework->GetDDSManager(); auto ddsManager = framework->GetDDSManager();
if (!ddsManager) { if (!ddsManager) {
LOG_ERROR("DDSManager is nullptr"); LOG_ERROR("DDSManager is nullptr");
return; return;
} }
if (DDS_type == 0) { // 读取与发送都进行 if (DDS_type == 0) {
dataWriter = dataWriter = ddsManager->RegisterPublisher<XNSim::C909::ATA04::GroundHandling_outputPubSubType>("XNSim::C909::ATA04::GroundHandling_output", modelId);
ddsManager->RegisterPublisher<XNSim::C909::ATA04::GroundHandling_outputPubSubType>( ddsManager->RegisterSubscriber<XNSim::C909::ATA04::GroundHandling_outputPubSubType>("XNSim::C909::ATA04::GroundHandling_output", modelId, std::bind(&GroundHandling_output_Interface::inputDataListener, this, std::placeholders::_1));
"XNSim::C909::ATA04::GroundHandling_output", modelId); }
ddsManager->RegisterSubscriber<XNSim::C909::ATA04::GroundHandling_outputPubSubType>( else if (DDS_type == 1) {
"XNSim::C909::ATA04::GroundHandling_output", modelId, ddsManager->RegisterSubscriber<XNSim::C909::ATA04::GroundHandling_outputPubSubType>("XNSim::C909::ATA04::GroundHandling_output", modelId, std::bind(&GroundHandling_output_Interface::inputDataListener, this, std::placeholders::_1));
std::bind(&GroundHandling_output_Interface::outputDataListener, this, }
std::placeholders::_1)); else if (DDS_type == 2) {
} else if (DDS_type == 1) { // 只读取 dataWriter = ddsManager->RegisterPublisher<XNSim::C909::ATA04::GroundHandling_outputPubSubType>("XNSim::C909::ATA04::GroundHandling_output", modelId);
ddsManager->RegisterSubscriber<XNSim::C909::ATA04::GroundHandling_outputPubSubType>(
"XNSim::C909::ATA04::GroundHandling_output", modelId,
std::bind(&GroundHandling_output_Interface::outputDataListener, this,
std::placeholders::_1));
} else if (DDS_type == 2) { // 只发送
dataWriter =
ddsManager->RegisterPublisher<XNSim::C909::ATA04::GroundHandling_outputPubSubType>(
"XNSim::C909::ATA04::GroundHandling_output", modelId);
} }
} }
void GroundHandling_output_Interface::clearOutData() void GroundHandling_output_Interface::clearOutData()
{ {
this->out_data = XNSim::C909::ATA04::GroundHandling_output(); this->out_data = XNSim::C909::ATA04::GroundHandling_output();
} }
void GroundHandling_output_Interface::sendOutData() void GroundHandling_output_Interface::sendOutData()
{ {
dataWriter->write(&this->out_data); if (dataWriter) {
dataWriter->write(&this->out_data);
}
} }
void GroundHandling_output_Interface::inputDataListener(const XNSim::C909::ATA04::GroundHandling_output &input)
void GroundHandling_output_Interface::outputDataListener(
const XNSim::C909::ATA04::GroundHandling_output &output)
{ {
this->data = output; this->data = input;
}
} }
} // namespace XNSim::C909::ATA04

View File

@ -1,6 +1,6 @@
#pragma once
#include "../C909_V1PubSubTypes.hpp" #include "../C909_V1PubSubTypes.hpp"
#include "XNCore/XNDDSInterface.h" #include "XNCore/XNDDSInterface.h"
namespace XNSim::C909::ATA04 namespace XNSim::C909::ATA04
{ {
class GroundHandling_output_Interface final : public XNDDSInterface class GroundHandling_output_Interface final : public XNDDSInterface
@ -9,22 +9,19 @@ public:
GroundHandling_output_Interface(); GroundHandling_output_Interface();
virtual ~GroundHandling_output_Interface(); virtual ~GroundHandling_output_Interface();
virtual void Initialize(XNFrameworkPtr framework, uint32_t modelId, uint32_t DDS_type) override; virtual void Initialize(XNFrameworkPtr framework, uint32_t modelId, uint32_t DDS_type) override;
void outputDataListener(const XNSim::C909::ATA04::GroundHandling_output &output);
virtual void clearOutData() override; virtual void clearOutData() override;
virtual void sendOutData() override; virtual void sendOutData() override;
void inputDataListener(const XNSim::C909::ATA04::GroundHandling_output &input);
template <typename T> template <typename T>
void getData(T *model_data) void getData(T *model_data)
{ {
if (model_data == nullptr) if(model_data == nullptr)
return; return;
assign_value_get(data.l_04_o_gdcomac_frz_l1(), model_data->l_04_o_gdcomac_frz_l1); assign_value_get(data.l_04_o_gdcomac_frz_l1(), model_data->l_04_o_gdcomac_frz_l1);
assign_value_get(data.l_04_o_gdcomac_ac_on_ground_l1(), assign_value_get(data.l_04_o_gdcomac_ac_on_ground_l1(), model_data->l_04_o_gdcomac_ac_on_ground_l1);
model_data->l_04_o_gdcomac_ac_on_ground_l1); assign_value_get(data.l_04_o_gdcomac_ac_stationary_f8(), model_data->l_04_o_gdcomac_ac_stationary_f8);
assign_value_get(data.l_04_o_gdcomac_ac_stationary_f8(),
model_data->l_04_o_gdcomac_ac_stationary_f8);
assign_value_get(data.l_04_o_gdcomac_alt_tire_f8(), model_data->l_04_o_gdcomac_alt_tire_f8); assign_value_get(data.l_04_o_gdcomac_alt_tire_f8(), model_data->l_04_o_gdcomac_alt_tire_f8);
assign_value_get(data.l_04_o_gdcomac_zcg_to_tire_f8(), assign_value_get(data.l_04_o_gdcomac_zcg_to_tire_f8(), model_data->l_04_o_gdcomac_zcg_to_tire_f8);
model_data->l_04_o_gdcomac_zcg_to_tire_f8);
assign_value_get(data.l_04_o_gdcomac_fxb_f8(), model_data->l_04_o_gdcomac_fxb_f8); assign_value_get(data.l_04_o_gdcomac_fxb_f8(), model_data->l_04_o_gdcomac_fxb_f8);
assign_value_get(data.l_04_o_gdcomac_fyb_f8(), model_data->l_04_o_gdcomac_fyb_f8); assign_value_get(data.l_04_o_gdcomac_fyb_f8(), model_data->l_04_o_gdcomac_fyb_f8);
assign_value_get(data.l_04_o_gdcomac_fzb_f8(), model_data->l_04_o_gdcomac_fzb_f8); assign_value_get(data.l_04_o_gdcomac_fzb_f8(), model_data->l_04_o_gdcomac_fzb_f8);
@ -41,83 +38,63 @@ public:
assign_value_get(data.l_04_o_gdcomac_xft_f8(), model_data->l_04_o_gdcomac_xft_f8); assign_value_get(data.l_04_o_gdcomac_xft_f8(), model_data->l_04_o_gdcomac_xft_f8);
assign_value_get(data.l_04_o_gdcomac_yft_f8(), model_data->l_04_o_gdcomac_yft_f8); assign_value_get(data.l_04_o_gdcomac_yft_f8(), model_data->l_04_o_gdcomac_yft_f8);
assign_value_get(data.l_04_o_gdcomac_zft_f8(), model_data->l_04_o_gdcomac_zft_f8); assign_value_get(data.l_04_o_gdcomac_zft_f8(), model_data->l_04_o_gdcomac_zft_f8);
assign_value_get(data.l_04_o_gdcomac_distngrxcg_f8(), assign_value_get(data.l_04_o_gdcomac_distngrxcg_f8(), model_data->l_04_o_gdcomac_distngrxcg_f8);
model_data->l_04_o_gdcomac_distngrxcg_f8); assign_value_get(data.l_04_o_gdcomac_distmgrxcg_f8(), model_data->l_04_o_gdcomac_distmgrxcg_f8);
assign_value_get(data.l_04_o_gdcomac_distmgrxcg_f8(), assign_value_get(data.l_04_o_gdcomac_distmgrzcg_f8(), model_data->l_04_o_gdcomac_distmgrzcg_f8);
model_data->l_04_o_gdcomac_distmgrxcg_f8);
assign_value_get(data.l_04_o_gdcomac_distmgrzcg_f8(),
model_data->l_04_o_gdcomac_distmgrzcg_f8);
assign_value_get(data.l_04_o_gdcomac_tire_vel_f8(), model_data->l_04_o_gdcomac_tire_vel_f8); assign_value_get(data.l_04_o_gdcomac_tire_vel_f8(), model_data->l_04_o_gdcomac_tire_vel_f8);
assign_value_get(data.l_04_o_gdcomac_tire_burst_l1(), assign_value_get(data.l_04_o_gdcomac_tire_burst_l1(), model_data->l_04_o_gdcomac_tire_burst_l1);
model_data->l_04_o_gdcomac_tire_burst_l1); assign_value_get(data.l_04_o_gdcomac_tire_temp_f8(), model_data->l_04_o_gdcomac_tire_temp_f8);
assign_value_get(data.l_04_o_gdcomac_tire_temp_f8(),
model_data->l_04_o_gdcomac_tire_temp_f8);
assign_value_get(data.l_04_o_gdcomac_wow_l1(), model_data->l_04_o_gdcomac_wow_l1); assign_value_get(data.l_04_o_gdcomac_wow_l1(), model_data->l_04_o_gdcomac_wow_l1);
assign_value_get(data.l_04_o_gdcomac_utirew_f8(), model_data->l_04_o_gdcomac_utirew_f8); assign_value_get(data.l_04_o_gdcomac_utirew_f8(), model_data->l_04_o_gdcomac_utirew_f8);
assign_value_get(data.l_04_o_gdcomac_vtirew_f8(), model_data->l_04_o_gdcomac_vtirew_f8); assign_value_get(data.l_04_o_gdcomac_vtirew_f8(), model_data->l_04_o_gdcomac_vtirew_f8);
assign_value_get(data.l_04_o_gdcomac_whl_omega_f8(), assign_value_get(data.l_04_o_gdcomac_whl_omega_f8(), model_data->l_04_o_gdcomac_whl_omega_f8);
model_data->l_04_o_gdcomac_whl_omega_f8);
assign_value_get(data.l_04_o_gdcomac_dstruc_f8(), model_data->l_04_o_gdcomac_dstruc_f8); assign_value_get(data.l_04_o_gdcomac_dstruc_f8(), model_data->l_04_o_gdcomac_dstruc_f8);
assign_value_get(data.l_04_o_gdcomac_wor_par_f8(), model_data->l_04_o_gdcomac_wor_par_f8); assign_value_get(data.l_04_o_gdcomac_wor_par_f8(), model_data->l_04_o_gdcomac_wor_par_f8);
assign_value_get(data.l_04_o_gdcomac_nd_f8(), model_data->l_04_o_gdcomac_nd_f8); assign_value_get(data.l_04_o_gdcomac_nd_f8(), model_data->l_04_o_gdcomac_nd_f8);
assign_value_get(data.l_04_o_gdcomac_vczt_f8(), model_data->l_04_o_gdcomac_vczt_f8);
} }
template <typename T> template <typename T>
void setData(T *model_data) void setData(T *model_data)
{ {
if (model_data == nullptr) if(model_data == nullptr)
return; return;
clearOutData(); clearOutData();
assign_value_set(data.l_04_o_gdcomac_frz_l1(), model_data->l_04_o_gdcomac_frz_l1); assign_value_set(data.l_04_o_gdcomac_frz_l1(), model_data->GroundHandling_output);
assign_value_set(data.l_04_o_gdcomac_ac_on_ground_l1(), assign_value_set(data.l_04_o_gdcomac_ac_on_ground_l1(), model_data->GroundHandling_output);
model_data->l_04_o_gdcomac_ac_on_ground_l1); assign_value_set(data.l_04_o_gdcomac_ac_stationary_f8(), model_data->GroundHandling_output);
assign_value_set(data.l_04_o_gdcomac_ac_stationary_f8(), assign_value_set(data.l_04_o_gdcomac_alt_tire_f8(), model_data->GroundHandling_output);
model_data->l_04_o_gdcomac_ac_stationary_f8); assign_value_set(data.l_04_o_gdcomac_zcg_to_tire_f8(), model_data->GroundHandling_output);
assign_value_set(data.l_04_o_gdcomac_alt_tire_f8(), model_data->l_04_o_gdcomac_alt_tire_f8); assign_value_set(data.l_04_o_gdcomac_fxb_f8(), model_data->GroundHandling_output);
assign_value_set(data.l_04_o_gdcomac_zcg_to_tire_f8(), assign_value_set(data.l_04_o_gdcomac_fyb_f8(), model_data->GroundHandling_output);
model_data->l_04_o_gdcomac_zcg_to_tire_f8); assign_value_set(data.l_04_o_gdcomac_fzb_f8(), model_data->GroundHandling_output);
assign_value_set(data.l_04_o_gdcomac_fxb_f8(), model_data->l_04_o_gdcomac_fxb_f8); assign_value_set(data.l_04_o_gdcomac_mxb_f8(), model_data->GroundHandling_output);
assign_value_set(data.l_04_o_gdcomac_fyb_f8(), model_data->l_04_o_gdcomac_fyb_f8); assign_value_set(data.l_04_o_gdcomac_myb_f8(), model_data->GroundHandling_output);
assign_value_set(data.l_04_o_gdcomac_fzb_f8(), model_data->l_04_o_gdcomac_fzb_f8); assign_value_set(data.l_04_o_gdcomac_mzb_f8(), model_data->GroundHandling_output);
assign_value_set(data.l_04_o_gdcomac_mxb_f8(), model_data->l_04_o_gdcomac_mxb_f8); assign_value_set(data.l_04_o_gdcomac_fygs_f8(), model_data->GroundHandling_output);
assign_value_set(data.l_04_o_gdcomac_myb_f8(), model_data->l_04_o_gdcomac_myb_f8); assign_value_set(data.l_04_o_gdcomac_mzgs_f8(), model_data->GroundHandling_output);
assign_value_set(data.l_04_o_gdcomac_mzb_f8(), model_data->l_04_o_gdcomac_mzb_f8); assign_value_set(data.l_04_o_gdcomac_mu_f8(), model_data->GroundHandling_output);
assign_value_set(data.l_04_o_gdcomac_fygs_f8(), model_data->l_04_o_gdcomac_fygs_f8); assign_value_set(data.l_04_o_gdcomac_dstroke_f8(), model_data->GroundHandling_output);
assign_value_set(data.l_04_o_gdcomac_mzgs_f8(), model_data->l_04_o_gdcomac_mzgs_f8); assign_value_set(data.l_04_o_gdcomac_sr_f8(), model_data->GroundHandling_output);
assign_value_set(data.l_04_o_gdcomac_mu_f8(), model_data->l_04_o_gdcomac_mu_f8); assign_value_set(data.l_04_o_gdcomac_sy_f8(), model_data->GroundHandling_output);
assign_value_set(data.l_04_o_gdcomac_dstroke_f8(), model_data->l_04_o_gdcomac_dstroke_f8); assign_value_set(data.l_04_o_gdcomac_sx_f8(), model_data->GroundHandling_output);
assign_value_set(data.l_04_o_gdcomac_sr_f8(), model_data->l_04_o_gdcomac_sr_f8); assign_value_set(data.l_04_o_gdcomac_xft_f8(), model_data->GroundHandling_output);
assign_value_set(data.l_04_o_gdcomac_sy_f8(), model_data->l_04_o_gdcomac_sy_f8); assign_value_set(data.l_04_o_gdcomac_yft_f8(), model_data->GroundHandling_output);
assign_value_set(data.l_04_o_gdcomac_sx_f8(), model_data->l_04_o_gdcomac_sx_f8); assign_value_set(data.l_04_o_gdcomac_zft_f8(), model_data->GroundHandling_output);
assign_value_set(data.l_04_o_gdcomac_xft_f8(), model_data->l_04_o_gdcomac_xft_f8); assign_value_set(data.l_04_o_gdcomac_distngrxcg_f8(), model_data->GroundHandling_output);
assign_value_set(data.l_04_o_gdcomac_yft_f8(), model_data->l_04_o_gdcomac_yft_f8); assign_value_set(data.l_04_o_gdcomac_distmgrxcg_f8(), model_data->GroundHandling_output);
assign_value_set(data.l_04_o_gdcomac_zft_f8(), model_data->l_04_o_gdcomac_zft_f8); assign_value_set(data.l_04_o_gdcomac_distmgrzcg_f8(), model_data->GroundHandling_output);
assign_value_set(data.l_04_o_gdcomac_distngrxcg_f8(), assign_value_set(data.l_04_o_gdcomac_tire_vel_f8(), model_data->GroundHandling_output);
model_data->l_04_o_gdcomac_distngrxcg_f8); assign_value_set(data.l_04_o_gdcomac_tire_burst_l1(), model_data->GroundHandling_output);
assign_value_set(data.l_04_o_gdcomac_distmgrxcg_f8(), assign_value_set(data.l_04_o_gdcomac_tire_temp_f8(), model_data->GroundHandling_output);
model_data->l_04_o_gdcomac_distmgrxcg_f8); assign_value_set(data.l_04_o_gdcomac_wow_l1(), model_data->GroundHandling_output);
assign_value_set(data.l_04_o_gdcomac_distmgrzcg_f8(), assign_value_set(data.l_04_o_gdcomac_utirew_f8(), model_data->GroundHandling_output);
model_data->l_04_o_gdcomac_distmgrzcg_f8); assign_value_set(data.l_04_o_gdcomac_vtirew_f8(), model_data->GroundHandling_output);
assign_value_set(data.l_04_o_gdcomac_tire_vel_f8(), model_data->l_04_o_gdcomac_tire_vel_f8); assign_value_set(data.l_04_o_gdcomac_whl_omega_f8(), model_data->GroundHandling_output);
assign_value_set(data.l_04_o_gdcomac_tire_burst_l1(), assign_value_set(data.l_04_o_gdcomac_dstruc_f8(), model_data->GroundHandling_output);
model_data->l_04_o_gdcomac_tire_burst_l1); assign_value_set(data.l_04_o_gdcomac_wor_par_f8(), model_data->GroundHandling_output);
assign_value_set(data.l_04_o_gdcomac_tire_temp_f8(), assign_value_set(data.l_04_o_gdcomac_nd_f8(), model_data->GroundHandling_output);
model_data->l_04_o_gdcomac_tire_temp_f8);
assign_value_set(data.l_04_o_gdcomac_wow_l1(), model_data->l_04_o_gdcomac_wow_l1);
assign_value_set(data.l_04_o_gdcomac_utirew_f8(), model_data->l_04_o_gdcomac_utirew_f8);
assign_value_set(data.l_04_o_gdcomac_vtirew_f8(), model_data->l_04_o_gdcomac_vtirew_f8);
assign_value_set(data.l_04_o_gdcomac_whl_omega_f8(),
model_data->l_04_o_gdcomac_whl_omega_f8);
assign_value_set(data.l_04_o_gdcomac_dstruc_f8(), model_data->l_04_o_gdcomac_dstruc_f8);
assign_value_set(data.l_04_o_gdcomac_wor_par_f8(), model_data->l_04_o_gdcomac_wor_par_f8);
assign_value_set(data.l_04_o_gdcomac_nd_f8(), model_data->l_04_o_gdcomac_nd_f8);
assign_value_set(data.l_04_o_gdcomac_vczt_f8(), model_data->l_04_o_gdcomac_vczt_f8);
sendOutData();
} }
private: private:
XNSim::C909::ATA04::GroundHandling_output data; XNSim::C909::ATA04::GroundHandling_output data;
XNSim::C909::ATA04::GroundHandling_output out_data; XNSim::C909::ATA04::GroundHandling_output out_data;
}; };
} // namespace XNSim::C909::ATA04 }

View File

@ -0,0 +1,73 @@
#include "WeightBalance_input.hpp"
namespace XNSim::C909::ATA04
{
WeightBalance_input_Interface::WeightBalance_input_Interface()
{
MAP_DATA_FUNC(l_04_i_wbcomac_theta_deg_f8);
MAP_DATA_FUNC(l_04_i_wbcomac_gear_mode_l1);
MAP_DATA_FUNC(l_04_i_wbcomac_acset_gw_f8);
MAP_DATA_FUNC(l_04_i_wbcomac_acset_cg_f8);
MAP_DATA_FUNC(l_04_i_wbcomac_acset_tankfuel_f4);
MAP_DATA_FUNC(l_04_i_wbcomac_acset_totfuel_f8);
MAP_DATA_FUNC(l_04_i_wbcomac_acset_zfw_f8);
MAP_DATA_FUNC(l_04_i_wbcomac_acset_zfwcg_f8);
MAP_DATA_FUNC(l_04_i_wbcomac_eng_efsep_l1);
MAP_DATA_FUNC(l_04_i_wbcomac_fuel_f8);
MAP_DATA_FUNC(l_04_i_wbcomac_gear_avg_f8);
MAP_DATA_FUNC(l_04_i_wbcomac_kice_f8);
MAP_DATA_FUNC(l_04_i_wbcomac_bycglim_l1);
MAP_DATA_FUNC(l_04_i_wbcomac_bygwlim_l1);
MAP_DATA_FUNC(l_04_i_wbcomac_frz_l1);
MAP_DATA_FUNC(l_04_i_wbcomac_zcgfrz_l1);
MAP_DATA_FUNC(l_04_i_wbcomac_zcgfrz_grfx_l1);
MAP_DATA_FUNC(l_04_i_wbcomac_ycgfrz_l1);
MAP_DATA_FUNC(l_04_i_wbcomac_inertfrz_l1);
MAP_DATA_FUNC(l_04_i_wbcomac_potreq_gw_f8);
MAP_DATA_FUNC(l_04_i_wbcomac_potreq_gwcg_f8);
MAP_DATA_FUNC(l_04_i_wbcomac_phi_deg_f8);
MAP_DATA_FUNC(l_04_i_wbcomac_psi_deg_f8);
this->header[0] = 0xa6; // XNSim头0xa6
this->header[1] = 0xc0; // 机型头0xc0表示C909
this->header[2] = 0x04; // 章节头0x04表示ATA04
this->header[3] = 0x01; // 模型头0x01表示GroundHandling
this->header[4] = 0x00; // 结构体头0x00表示输入结构体
this->header[5] = 0x00; // 数据方向0x00表示外部输入
this->header[6] = 0x00; // 数据大小
this->header[7] = 0x00; // 数据大小
}
WeightBalance_input_Interface::~WeightBalance_input_Interface()
{
}
void WeightBalance_input_Interface::Initialize(XNFrameworkPtr framework, uint32_t modelId,uint32_t DDS_type)
{
auto ddsManager = framework->GetDDSManager();
if (!ddsManager) {
LOG_ERROR("DDSManager is nullptr");
return;
}
if (DDS_type == 0) {
dataWriter = ddsManager->RegisterPublisher<XNSim::C909::ATA04::WeightBalance_inputPubSubType>("XNSim::C909::ATA04::WeightBalance_input", modelId);
ddsManager->RegisterSubscriber<XNSim::C909::ATA04::WeightBalance_inputPubSubType>("XNSim::C909::ATA04::WeightBalance_input", modelId, std::bind(&WeightBalance_input_Interface::inputDataListener, this, std::placeholders::_1));
}
else if (DDS_type == 1) {
ddsManager->RegisterSubscriber<XNSim::C909::ATA04::WeightBalance_inputPubSubType>("XNSim::C909::ATA04::WeightBalance_input", modelId, std::bind(&WeightBalance_input_Interface::inputDataListener, this, std::placeholders::_1));
}
else if (DDS_type == 2) {
dataWriter = ddsManager->RegisterPublisher<XNSim::C909::ATA04::WeightBalance_inputPubSubType>("XNSim::C909::ATA04::WeightBalance_input", modelId);
}
}
void WeightBalance_input_Interface::clearOutData()
{
this->out_data = XNSim::C909::ATA04::WeightBalance_input();
}
void WeightBalance_input_Interface::sendOutData()
{
if (dataWriter) {
dataWriter->write(&this->out_data);
}
}
void WeightBalance_input_Interface::inputDataListener(const XNSim::C909::ATA04::WeightBalance_input &input)
{
this->data = input;
}
}

View File

@ -0,0 +1,78 @@
#pragma once
#include "../C909_V1PubSubTypes.hpp"
#include "XNCore/XNDDSInterface.h"
namespace XNSim::C909::ATA04
{
class WeightBalance_input_Interface final : public XNDDSInterface
{
public:
WeightBalance_input_Interface();
virtual ~WeightBalance_input_Interface();
virtual void Initialize(XNFrameworkPtr framework, uint32_t modelId, uint32_t DDS_type) override;
virtual void clearOutData() override;
virtual void sendOutData() override;
void inputDataListener(const XNSim::C909::ATA04::WeightBalance_input &input);
template <typename T>
void getData(T *model_data)
{
if(model_data == nullptr)
return;
assign_value_get(data.l_04_i_wbcomac_theta_deg_f8(), model_data->l_04_i_wbcomac_theta_deg_f8);
assign_value_get(data.l_04_i_wbcomac_gear_mode_l1(), model_data->l_04_i_wbcomac_gear_mode_l1);
assign_value_get(data.l_04_i_wbcomac_acset_gw_f8(), model_data->l_04_i_wbcomac_acset_gw_f8);
assign_value_get(data.l_04_i_wbcomac_acset_cg_f8(), model_data->l_04_i_wbcomac_acset_cg_f8);
assign_value_get(data.l_04_i_wbcomac_acset_tankfuel_f4(), model_data->l_04_i_wbcomac_acset_tankfuel_f4);
assign_value_get(data.l_04_i_wbcomac_acset_totfuel_f8(), model_data->l_04_i_wbcomac_acset_totfuel_f8);
assign_value_get(data.l_04_i_wbcomac_acset_zfw_f8(), model_data->l_04_i_wbcomac_acset_zfw_f8);
assign_value_get(data.l_04_i_wbcomac_acset_zfwcg_f8(), model_data->l_04_i_wbcomac_acset_zfwcg_f8);
assign_value_get(data.l_04_i_wbcomac_eng_efsep_l1(), model_data->l_04_i_wbcomac_eng_efsep_l1);
assign_value_get(data.l_04_i_wbcomac_fuel_f8(), model_data->l_04_i_wbcomac_fuel_f8);
assign_value_get(data.l_04_i_wbcomac_gear_avg_f8(), model_data->l_04_i_wbcomac_gear_avg_f8);
assign_value_get(data.l_04_i_wbcomac_kice_f8(), model_data->l_04_i_wbcomac_kice_f8);
assign_value_get(data.l_04_i_wbcomac_bycglim_l1(), model_data->l_04_i_wbcomac_bycglim_l1);
assign_value_get(data.l_04_i_wbcomac_bygwlim_l1(), model_data->l_04_i_wbcomac_bygwlim_l1);
assign_value_get(data.l_04_i_wbcomac_frz_l1(), model_data->l_04_i_wbcomac_frz_l1);
assign_value_get(data.l_04_i_wbcomac_zcgfrz_l1(), model_data->l_04_i_wbcomac_zcgfrz_l1);
assign_value_get(data.l_04_i_wbcomac_zcgfrz_grfx_l1(), model_data->l_04_i_wbcomac_zcgfrz_grfx_l1);
assign_value_get(data.l_04_i_wbcomac_ycgfrz_l1(), model_data->l_04_i_wbcomac_ycgfrz_l1);
assign_value_get(data.l_04_i_wbcomac_inertfrz_l1(), model_data->l_04_i_wbcomac_inertfrz_l1);
assign_value_get(data.l_04_i_wbcomac_potreq_gw_f8(), model_data->l_04_i_wbcomac_potreq_gw_f8);
assign_value_get(data.l_04_i_wbcomac_potreq_gwcg_f8(), model_data->l_04_i_wbcomac_potreq_gwcg_f8);
assign_value_get(data.l_04_i_wbcomac_phi_deg_f8(), model_data->l_04_i_wbcomac_phi_deg_f8);
assign_value_get(data.l_04_i_wbcomac_psi_deg_f8(), model_data->l_04_i_wbcomac_psi_deg_f8);
}
template <typename T>
void setData(T *model_data)
{
if(model_data == nullptr)
return;
clearOutData();
assign_value_set(data.l_04_i_wbcomac_theta_deg_f8(), model_data->WeightBalance_input);
assign_value_set(data.l_04_i_wbcomac_gear_mode_l1(), model_data->WeightBalance_input);
assign_value_set(data.l_04_i_wbcomac_acset_gw_f8(), model_data->WeightBalance_input);
assign_value_set(data.l_04_i_wbcomac_acset_cg_f8(), model_data->WeightBalance_input);
assign_value_set(data.l_04_i_wbcomac_acset_tankfuel_f4(), model_data->WeightBalance_input);
assign_value_set(data.l_04_i_wbcomac_acset_totfuel_f8(), model_data->WeightBalance_input);
assign_value_set(data.l_04_i_wbcomac_acset_zfw_f8(), model_data->WeightBalance_input);
assign_value_set(data.l_04_i_wbcomac_acset_zfwcg_f8(), model_data->WeightBalance_input);
assign_value_set(data.l_04_i_wbcomac_eng_efsep_l1(), model_data->WeightBalance_input);
assign_value_set(data.l_04_i_wbcomac_fuel_f8(), model_data->WeightBalance_input);
assign_value_set(data.l_04_i_wbcomac_gear_avg_f8(), model_data->WeightBalance_input);
assign_value_set(data.l_04_i_wbcomac_kice_f8(), model_data->WeightBalance_input);
assign_value_set(data.l_04_i_wbcomac_bycglim_l1(), model_data->WeightBalance_input);
assign_value_set(data.l_04_i_wbcomac_bygwlim_l1(), model_data->WeightBalance_input);
assign_value_set(data.l_04_i_wbcomac_frz_l1(), model_data->WeightBalance_input);
assign_value_set(data.l_04_i_wbcomac_zcgfrz_l1(), model_data->WeightBalance_input);
assign_value_set(data.l_04_i_wbcomac_zcgfrz_grfx_l1(), model_data->WeightBalance_input);
assign_value_set(data.l_04_i_wbcomac_ycgfrz_l1(), model_data->WeightBalance_input);
assign_value_set(data.l_04_i_wbcomac_inertfrz_l1(), model_data->WeightBalance_input);
assign_value_set(data.l_04_i_wbcomac_potreq_gw_f8(), model_data->WeightBalance_input);
assign_value_set(data.l_04_i_wbcomac_potreq_gwcg_f8(), model_data->WeightBalance_input);
assign_value_set(data.l_04_i_wbcomac_phi_deg_f8(), model_data->WeightBalance_input);
assign_value_set(data.l_04_i_wbcomac_psi_deg_f8(), model_data->WeightBalance_input);
}
private:
XNSim::C909::ATA04::WeightBalance_input data;
XNSim::C909::ATA04::WeightBalance_input out_data;
};
}

View File

@ -0,0 +1,106 @@
#include "WeightBalance_output.hpp"
namespace XNSim::C909::ATA04
{
WeightBalance_output_Interface::WeightBalance_output_Interface()
{
MAP_DATA_FUNC(l_04_o_wbcomac_frz_l1);
MAP_DATA_FUNC(l_04_o_wbcomac_zcgfrz_l1);
MAP_DATA_FUNC(l_04_o_wbcomac_zcgfrz_grfx_l1);
MAP_DATA_FUNC(l_04_o_wbcomac_ycgfrz_l1);
MAP_DATA_FUNC(l_04_o_wbcomac_inertfrz_l1);
MAP_DATA_FUNC(l_04_o_wbcomac_gw_f4);
MAP_DATA_FUNC(l_04_o_wbcomac_cg_f4);
MAP_DATA_FUNC(l_04_o_wbcomac_blcg_f8);
MAP_DATA_FUNC(l_04_o_wbcomac_bscg_f8);
MAP_DATA_FUNC(l_04_o_wbcomac_wlcg_f8);
MAP_DATA_FUNC(l_04_o_wbcomac_xcg_f8);
MAP_DATA_FUNC(l_04_o_wbcomac_ixx_f8);
MAP_DATA_FUNC(l_04_o_wbcomac_ixy_f8);
MAP_DATA_FUNC(l_04_o_wbcomac_ixz_f8);
MAP_DATA_FUNC(l_04_o_wbcomac_iyy_f8);
MAP_DATA_FUNC(l_04_o_wbcomac_iyz_f8);
MAP_DATA_FUNC(l_04_o_wbcomac_izz_f8);
MAP_DATA_FUNC(l_04_o_wbcomac_zfw_f4);
MAP_DATA_FUNC(l_04_o_wbcomac_zfwcg_f4);
MAP_DATA_FUNC(l_04_o_wbcomac_zfw_blcg_f4);
MAP_DATA_FUNC(l_04_o_wbcomac_zfw_wlcg_f4);
MAP_DATA_FUNC(l_04_o_wbcomac_fuel_cmd_f8);
MAP_DATA_FUNC(l_04_o_wbcomac_fuel_mode_i4);
MAP_DATA_FUNC(l_04_o_wbcomac_fuel_ixx_f8);
MAP_DATA_FUNC(l_04_o_wbcomac_fuel_ixy_f8);
MAP_DATA_FUNC(l_04_o_wbcomac_fuel_ixz_f8);
MAP_DATA_FUNC(l_04_o_wbcomac_fuel_iyy_f8);
MAP_DATA_FUNC(l_04_o_wbcomac_fuel_iyz_f8);
MAP_DATA_FUNC(l_04_o_wbcomac_fuel_izz_f8);
MAP_DATA_FUNC(l_04_o_wbcomac_l_wt_fuel_f8);
MAP_DATA_FUNC(l_04_o_wbcomac_ice_airframe_total_f8);
MAP_DATA_FUNC(l_04_o_wbcomac_ice_eng_f8);
MAP_DATA_FUNC(l_04_o_wbcomac_ice_eng_total_f8);
MAP_DATA_FUNC(l_04_o_wbcomac_ice_fuselage_f8);
MAP_DATA_FUNC(l_04_o_wbcomac_ice_stab_left_f8);
MAP_DATA_FUNC(l_04_o_wbcomac_ice_stab_right_f8);
MAP_DATA_FUNC(l_04_o_wbcomac_ice_stab_total_f8);
MAP_DATA_FUNC(l_04_o_wbcomac_ice_total_f8);
MAP_DATA_FUNC(l_04_o_wbcomac_ice_total_frac_f8);
MAP_DATA_FUNC(l_04_o_wbcomac_ice_vert_tail_f8);
MAP_DATA_FUNC(l_04_o_wbcomac_ice_wing_left_f8);
MAP_DATA_FUNC(l_04_o_wbcomac_ice_wing_right_f8);
MAP_DATA_FUNC(l_04_o_wbcomac_ice_wing_total_f8);
MAP_DATA_FUNC(l_04_o_wbcomac_init_l1);
MAP_DATA_FUNC(l_04_o_wbcomac_potmin_gw_f8);
MAP_DATA_FUNC(l_04_o_wbcomac_potmax_gw_f8);
MAP_DATA_FUNC(l_04_o_wbcomac_potmin_gwcg_f8);
MAP_DATA_FUNC(l_04_o_wbcomac_potmax_gwcg_f8);
MAP_DATA_FUNC(l_04_o_wbcomac_min_cg_f4);
MAP_DATA_FUNC(l_04_o_wbcomac_min_gw_f4);
MAP_DATA_FUNC(l_04_o_wbcomac_min_zfw_f4);
MAP_DATA_FUNC(l_04_o_wbcomac_min_zfwcg_f4);
MAP_DATA_FUNC(l_04_o_wbcomac_max_cg_f4);
MAP_DATA_FUNC(l_04_o_wbcomac_max_gw_f4);
MAP_DATA_FUNC(l_04_o_wbcomac_max_zfw_f4);
MAP_DATA_FUNC(l_04_o_wbcomac_max_zfwcg_f4);
this->header[0] = 0xa6; // XNSim头0xa6
this->header[1] = 0xc0; // 机型头0xc0表示C909
this->header[2] = 0x04; // 章节头0x04表示ATA04
this->header[3] = 0x01; // 模型头0x01表示GroundHandling
this->header[4] = 0x00; // 结构体头0x00表示输入结构体
this->header[5] = 0x00; // 数据方向0x00表示外部输入
this->header[6] = 0x00; // 数据大小
this->header[7] = 0x00; // 数据大小
}
WeightBalance_output_Interface::~WeightBalance_output_Interface()
{
}
void WeightBalance_output_Interface::Initialize(XNFrameworkPtr framework, uint32_t modelId,uint32_t DDS_type)
{
auto ddsManager = framework->GetDDSManager();
if (!ddsManager) {
LOG_ERROR("DDSManager is nullptr");
return;
}
if (DDS_type == 0) {
dataWriter = ddsManager->RegisterPublisher<XNSim::C909::ATA04::WeightBalance_outputPubSubType>("XNSim::C909::ATA04::WeightBalance_output", modelId);
ddsManager->RegisterSubscriber<XNSim::C909::ATA04::WeightBalance_outputPubSubType>("XNSim::C909::ATA04::WeightBalance_output", modelId, std::bind(&WeightBalance_output_Interface::inputDataListener, this, std::placeholders::_1));
}
else if (DDS_type == 1) {
ddsManager->RegisterSubscriber<XNSim::C909::ATA04::WeightBalance_outputPubSubType>("XNSim::C909::ATA04::WeightBalance_output", modelId, std::bind(&WeightBalance_output_Interface::inputDataListener, this, std::placeholders::_1));
}
else if (DDS_type == 2) {
dataWriter = ddsManager->RegisterPublisher<XNSim::C909::ATA04::WeightBalance_outputPubSubType>("XNSim::C909::ATA04::WeightBalance_output", modelId);
}
}
void WeightBalance_output_Interface::clearOutData()
{
this->out_data = XNSim::C909::ATA04::WeightBalance_output();
}
void WeightBalance_output_Interface::sendOutData()
{
if (dataWriter) {
dataWriter->write(&this->out_data);
}
}
void WeightBalance_output_Interface::inputDataListener(const XNSim::C909::ATA04::WeightBalance_output &input)
{
this->data = input;
}
}

View File

@ -0,0 +1,144 @@
#pragma once
#include "../C909_V1PubSubTypes.hpp"
#include "XNCore/XNDDSInterface.h"
namespace XNSim::C909::ATA04
{
class WeightBalance_output_Interface final : public XNDDSInterface
{
public:
WeightBalance_output_Interface();
virtual ~WeightBalance_output_Interface();
virtual void Initialize(XNFrameworkPtr framework, uint32_t modelId, uint32_t DDS_type) override;
virtual void clearOutData() override;
virtual void sendOutData() override;
void inputDataListener(const XNSim::C909::ATA04::WeightBalance_output &input);
template <typename T>
void getData(T *model_data)
{
if(model_data == nullptr)
return;
assign_value_get(data.l_04_o_wbcomac_frz_l1(), model_data->l_04_o_wbcomac_frz_l1);
assign_value_get(data.l_04_o_wbcomac_zcgfrz_l1(), model_data->l_04_o_wbcomac_zcgfrz_l1);
assign_value_get(data.l_04_o_wbcomac_zcgfrz_grfx_l1(), model_data->l_04_o_wbcomac_zcgfrz_grfx_l1);
assign_value_get(data.l_04_o_wbcomac_ycgfrz_l1(), model_data->l_04_o_wbcomac_ycgfrz_l1);
assign_value_get(data.l_04_o_wbcomac_inertfrz_l1(), model_data->l_04_o_wbcomac_inertfrz_l1);
assign_value_get(data.l_04_o_wbcomac_gw_f4(), model_data->l_04_o_wbcomac_gw_f4);
assign_value_get(data.l_04_o_wbcomac_cg_f4(), model_data->l_04_o_wbcomac_cg_f4);
assign_value_get(data.l_04_o_wbcomac_blcg_f8(), model_data->l_04_o_wbcomac_blcg_f8);
assign_value_get(data.l_04_o_wbcomac_bscg_f8(), model_data->l_04_o_wbcomac_bscg_f8);
assign_value_get(data.l_04_o_wbcomac_wlcg_f8(), model_data->l_04_o_wbcomac_wlcg_f8);
assign_value_get(data.l_04_o_wbcomac_xcg_f8(), model_data->l_04_o_wbcomac_xcg_f8);
assign_value_get(data.l_04_o_wbcomac_ixx_f8(), model_data->l_04_o_wbcomac_ixx_f8);
assign_value_get(data.l_04_o_wbcomac_ixy_f8(), model_data->l_04_o_wbcomac_ixy_f8);
assign_value_get(data.l_04_o_wbcomac_ixz_f8(), model_data->l_04_o_wbcomac_ixz_f8);
assign_value_get(data.l_04_o_wbcomac_iyy_f8(), model_data->l_04_o_wbcomac_iyy_f8);
assign_value_get(data.l_04_o_wbcomac_iyz_f8(), model_data->l_04_o_wbcomac_iyz_f8);
assign_value_get(data.l_04_o_wbcomac_izz_f8(), model_data->l_04_o_wbcomac_izz_f8);
assign_value_get(data.l_04_o_wbcomac_zfw_f4(), model_data->l_04_o_wbcomac_zfw_f4);
assign_value_get(data.l_04_o_wbcomac_zfwcg_f4(), model_data->l_04_o_wbcomac_zfwcg_f4);
assign_value_get(data.l_04_o_wbcomac_zfw_blcg_f4(), model_data->l_04_o_wbcomac_zfw_blcg_f4);
assign_value_get(data.l_04_o_wbcomac_zfw_wlcg_f4(), model_data->l_04_o_wbcomac_zfw_wlcg_f4);
assign_value_get(data.l_04_o_wbcomac_fuel_cmd_f8(), model_data->l_04_o_wbcomac_fuel_cmd_f8);
assign_value_get(data.l_04_o_wbcomac_fuel_mode_i4(), model_data->l_04_o_wbcomac_fuel_mode_i4);
assign_value_get(data.l_04_o_wbcomac_fuel_ixx_f8(), model_data->l_04_o_wbcomac_fuel_ixx_f8);
assign_value_get(data.l_04_o_wbcomac_fuel_ixy_f8(), model_data->l_04_o_wbcomac_fuel_ixy_f8);
assign_value_get(data.l_04_o_wbcomac_fuel_ixz_f8(), model_data->l_04_o_wbcomac_fuel_ixz_f8);
assign_value_get(data.l_04_o_wbcomac_fuel_iyy_f8(), model_data->l_04_o_wbcomac_fuel_iyy_f8);
assign_value_get(data.l_04_o_wbcomac_fuel_iyz_f8(), model_data->l_04_o_wbcomac_fuel_iyz_f8);
assign_value_get(data.l_04_o_wbcomac_fuel_izz_f8(), model_data->l_04_o_wbcomac_fuel_izz_f8);
assign_value_get(data.l_04_o_wbcomac_l_wt_fuel_f8(), model_data->l_04_o_wbcomac_l_wt_fuel_f8);
assign_value_get(data.l_04_o_wbcomac_ice_airframe_total_f8(), model_data->l_04_o_wbcomac_ice_airframe_total_f8);
assign_value_get(data.l_04_o_wbcomac_ice_eng_f8(), model_data->l_04_o_wbcomac_ice_eng_f8);
assign_value_get(data.l_04_o_wbcomac_ice_eng_total_f8(), model_data->l_04_o_wbcomac_ice_eng_total_f8);
assign_value_get(data.l_04_o_wbcomac_ice_fuselage_f8(), model_data->l_04_o_wbcomac_ice_fuselage_f8);
assign_value_get(data.l_04_o_wbcomac_ice_stab_left_f8(), model_data->l_04_o_wbcomac_ice_stab_left_f8);
assign_value_get(data.l_04_o_wbcomac_ice_stab_right_f8(), model_data->l_04_o_wbcomac_ice_stab_right_f8);
assign_value_get(data.l_04_o_wbcomac_ice_stab_total_f8(), model_data->l_04_o_wbcomac_ice_stab_total_f8);
assign_value_get(data.l_04_o_wbcomac_ice_total_f8(), model_data->l_04_o_wbcomac_ice_total_f8);
assign_value_get(data.l_04_o_wbcomac_ice_total_frac_f8(), model_data->l_04_o_wbcomac_ice_total_frac_f8);
assign_value_get(data.l_04_o_wbcomac_ice_vert_tail_f8(), model_data->l_04_o_wbcomac_ice_vert_tail_f8);
assign_value_get(data.l_04_o_wbcomac_ice_wing_left_f8(), model_data->l_04_o_wbcomac_ice_wing_left_f8);
assign_value_get(data.l_04_o_wbcomac_ice_wing_right_f8(), model_data->l_04_o_wbcomac_ice_wing_right_f8);
assign_value_get(data.l_04_o_wbcomac_ice_wing_total_f8(), model_data->l_04_o_wbcomac_ice_wing_total_f8);
assign_value_get(data.l_04_o_wbcomac_init_l1(), model_data->l_04_o_wbcomac_init_l1);
assign_value_get(data.l_04_o_wbcomac_potmin_gw_f8(), model_data->l_04_o_wbcomac_potmin_gw_f8);
assign_value_get(data.l_04_o_wbcomac_potmax_gw_f8(), model_data->l_04_o_wbcomac_potmax_gw_f8);
assign_value_get(data.l_04_o_wbcomac_potmin_gwcg_f8(), model_data->l_04_o_wbcomac_potmin_gwcg_f8);
assign_value_get(data.l_04_o_wbcomac_potmax_gwcg_f8(), model_data->l_04_o_wbcomac_potmax_gwcg_f8);
assign_value_get(data.l_04_o_wbcomac_min_cg_f4(), model_data->l_04_o_wbcomac_min_cg_f4);
assign_value_get(data.l_04_o_wbcomac_min_gw_f4(), model_data->l_04_o_wbcomac_min_gw_f4);
assign_value_get(data.l_04_o_wbcomac_min_zfw_f4(), model_data->l_04_o_wbcomac_min_zfw_f4);
assign_value_get(data.l_04_o_wbcomac_min_zfwcg_f4(), model_data->l_04_o_wbcomac_min_zfwcg_f4);
assign_value_get(data.l_04_o_wbcomac_max_cg_f4(), model_data->l_04_o_wbcomac_max_cg_f4);
assign_value_get(data.l_04_o_wbcomac_max_gw_f4(), model_data->l_04_o_wbcomac_max_gw_f4);
assign_value_get(data.l_04_o_wbcomac_max_zfw_f4(), model_data->l_04_o_wbcomac_max_zfw_f4);
assign_value_get(data.l_04_o_wbcomac_max_zfwcg_f4(), model_data->l_04_o_wbcomac_max_zfwcg_f4);
}
template <typename T>
void setData(T *model_data)
{
if(model_data == nullptr)
return;
clearOutData();
assign_value_set(data.l_04_o_wbcomac_frz_l1(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_zcgfrz_l1(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_zcgfrz_grfx_l1(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_ycgfrz_l1(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_inertfrz_l1(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_gw_f4(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_cg_f4(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_blcg_f8(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_bscg_f8(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_wlcg_f8(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_xcg_f8(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_ixx_f8(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_ixy_f8(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_ixz_f8(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_iyy_f8(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_iyz_f8(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_izz_f8(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_zfw_f4(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_zfwcg_f4(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_zfw_blcg_f4(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_zfw_wlcg_f4(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_fuel_cmd_f8(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_fuel_mode_i4(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_fuel_ixx_f8(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_fuel_ixy_f8(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_fuel_ixz_f8(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_fuel_iyy_f8(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_fuel_iyz_f8(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_fuel_izz_f8(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_l_wt_fuel_f8(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_ice_airframe_total_f8(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_ice_eng_f8(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_ice_eng_total_f8(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_ice_fuselage_f8(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_ice_stab_left_f8(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_ice_stab_right_f8(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_ice_stab_total_f8(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_ice_total_f8(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_ice_total_frac_f8(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_ice_vert_tail_f8(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_ice_wing_left_f8(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_ice_wing_right_f8(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_ice_wing_total_f8(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_init_l1(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_potmin_gw_f8(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_potmax_gw_f8(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_potmin_gwcg_f8(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_potmax_gwcg_f8(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_min_cg_f4(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_min_gw_f4(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_min_zfw_f4(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_min_zfwcg_f4(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_max_cg_f4(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_max_gw_f4(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_max_zfw_f4(), model_data->WeightBalance_output);
assign_value_set(data.l_04_o_wbcomac_max_zfwcg_f4(), model_data->WeightBalance_output);
}
private:
XNSim::C909::ATA04::WeightBalance_output data;
XNSim::C909::ATA04::WeightBalance_output out_data;
};
}

File diff suppressed because it is too large Load Diff

View File

@ -34,26 +34,6 @@ module XNSim
@optional double l_04_i_aerocomac_kice_f8[20]; @optional double l_04_i_aerocomac_kice_f8[20];
@optional double l_04_i_aerocomac_alt_agl_f8; @optional double l_04_i_aerocomac_alt_agl_f8;
}; };
struct Aerodynamics_output
{
@optional double l_04_o_aerocomac_fxb_f8;
@optional double l_04_o_aerocomac_fyb_f8;
@optional double l_04_o_aerocomac_fzb_f8;
@optional double l_04_o_aerocomac_mxb_f8;
@optional double l_04_o_aerocomac_myb_f8;
@optional double l_04_o_aerocomac_mzb_f8;
@optional double l_04_o_aerocomac_cls_f8;
@optional double l_04_o_aerocomac_cl_f8;
@optional double l_04_o_aerocomac_cd_f8;
@optional double l_04_o_aerocomac_cm_f8;
@optional double l_04_o_aerocomac_cr_f8;
@optional double l_04_o_aerocomac_cy_f8;
@optional double l_04_o_aerocomac_cn_f8;
};
struct Aerodynamics_heartbeat
{
@optional long aero_model_heartbeat;
};
struct GroundHandling_input struct GroundHandling_input
{ {
@optional char l_04_i_gdcomac_frz_l1; @optional char l_04_i_gdcomac_frz_l1;
@ -72,7 +52,7 @@ module XNSim
@optional char l_04_i_gdcomac_pb_active_l1; @optional char l_04_i_gdcomac_pb_active_l1;
@optional double l_04_i_gdcomac_brake_torq_f8[3][2]; @optional double l_04_i_gdcomac_brake_torq_f8[3][2];
@optional double l_04_i_gdcomac_gear_f8[3]; @optional double l_04_i_gdcomac_gear_f8[3];
@optional double l_04_i_gdcomac_gsteer_f8[10]; @optional double l_04_i_gdcomac_gsteer_f8;
@optional double l_04_i_gdcomac_tire_pres_f8[3][2]; @optional double l_04_i_gdcomac_tire_pres_f8[3][2];
@optional char l_04_i_gdcomac_onjax_l1; @optional char l_04_i_gdcomac_onjax_l1;
@optional double l_04_i_gdcomac_contdep_f8[7]; @optional double l_04_i_gdcomac_contdep_f8[7];
@ -132,11 +112,22 @@ module XNSim
@optional double l_04_o_gdcomac_dstruc_f8[6]; @optional double l_04_o_gdcomac_dstruc_f8[6];
@optional double l_04_o_gdcomac_wor_par_f8[3]; @optional double l_04_o_gdcomac_wor_par_f8[3];
@optional double l_04_o_gdcomac_nd_f8[3]; @optional double l_04_o_gdcomac_nd_f8[3];
@optional double l_04_o_gdcomac_vczt_f8[3][2];
}; };
struct GroundHandling_heartbeat struct Aerodynamics_output
{ {
@optional long groundhandling_model_heartbeat; @optional double l_04_o_aerocomac_fxb_f8;
@optional double l_04_o_aerocomac_fyb_f8;
@optional double l_04_o_aerocomac_fzb_f8;
@optional double l_04_o_aerocomac_mxb_f8;
@optional double l_04_o_aerocomac_myb_f8;
@optional double l_04_o_aerocomac_mzb_f8;
@optional double l_04_o_aerocomac_cls_f8;
@optional double l_04_o_aerocomac_cl_f8;
@optional double l_04_o_aerocomac_cd_f8;
@optional double l_04_o_aerocomac_cm_f8;
@optional double l_04_o_aerocomac_cr_f8;
@optional double l_04_o_aerocomac_cy_f8;
@optional double l_04_o_aerocomac_cn_f8;
}; };
struct WeightBalance_input struct WeightBalance_input
{ {
@ -223,10 +214,6 @@ module XNSim
@optional float l_04_o_wbcomac_max_zfw_f4; @optional float l_04_o_wbcomac_max_zfw_f4;
@optional float l_04_o_wbcomac_max_zfwcg_f4; @optional float l_04_o_wbcomac_max_zfwcg_f4;
}; };
struct WeightBalance_heartbeat
{
@optional long weightbody_model_heartbeat;
};
}; };
}; };
}; };

View File

@ -24,22 +24,16 @@
#include "C909_V1.hpp" #include "C909_V1.hpp"
constexpr uint32_t XNSim_C909_ATA04_GroundHandling_input_max_cdr_typesize {1093UL}; constexpr uint32_t XNSim_C909_ATA04_GroundHandling_input_max_cdr_typesize {1021UL};
constexpr uint32_t XNSim_C909_ATA04_GroundHandling_input_max_key_cdr_typesize {0UL}; constexpr uint32_t XNSim_C909_ATA04_GroundHandling_input_max_key_cdr_typesize {0UL};
constexpr uint32_t XNSim_C909_ATA04_GroundHandling_heartbeat_max_cdr_typesize {12UL};
constexpr uint32_t XNSim_C909_ATA04_GroundHandling_heartbeat_max_key_cdr_typesize {0UL};
constexpr uint32_t XNSim_C909_ATA04_Aerodynamics_output_max_cdr_typesize {312UL}; constexpr uint32_t XNSim_C909_ATA04_Aerodynamics_output_max_cdr_typesize {312UL};
constexpr uint32_t XNSim_C909_ATA04_Aerodynamics_output_max_key_cdr_typesize {0UL}; constexpr uint32_t XNSim_C909_ATA04_Aerodynamics_output_max_key_cdr_typesize {0UL};
constexpr uint32_t XNSim_C909_ATA04_WeightBalance_output_max_cdr_typesize {1184UL}; constexpr uint32_t XNSim_C909_ATA04_WeightBalance_output_max_cdr_typesize {1184UL};
constexpr uint32_t XNSim_C909_ATA04_WeightBalance_output_max_key_cdr_typesize {0UL}; constexpr uint32_t XNSim_C909_ATA04_WeightBalance_output_max_key_cdr_typesize {0UL};
constexpr uint32_t XNSim_C909_ATA04_WeightBalance_heartbeat_max_cdr_typesize {12UL}; constexpr uint32_t XNSim_C909_ATA04_GroundHandling_output_max_cdr_typesize {1264UL};
constexpr uint32_t XNSim_C909_ATA04_WeightBalance_heartbeat_max_key_cdr_typesize {0UL};
constexpr uint32_t XNSim_C909_ATA04_GroundHandling_output_max_cdr_typesize {1328UL};
constexpr uint32_t XNSim_C909_ATA04_GroundHandling_output_max_key_cdr_typesize {0UL}; constexpr uint32_t XNSim_C909_ATA04_GroundHandling_output_max_key_cdr_typesize {0UL};
constexpr uint32_t XNSim_C909_ATA04_WeightBalance_input_max_cdr_typesize {784UL}; constexpr uint32_t XNSim_C909_ATA04_WeightBalance_input_max_cdr_typesize {784UL};
@ -48,9 +42,6 @@ constexpr uint32_t XNSim_C909_ATA04_WeightBalance_input_max_key_cdr_typesize {0U
constexpr uint32_t XNSim_C909_ATA04_Aerodynamics_input_max_cdr_typesize {1352UL}; constexpr uint32_t XNSim_C909_ATA04_Aerodynamics_input_max_cdr_typesize {1352UL};
constexpr uint32_t XNSim_C909_ATA04_Aerodynamics_input_max_key_cdr_typesize {0UL}; constexpr uint32_t XNSim_C909_ATA04_Aerodynamics_input_max_key_cdr_typesize {0UL};
constexpr uint32_t XNSim_C909_ATA04_Aerodynamics_heartbeat_max_cdr_typesize {12UL};
constexpr uint32_t XNSim_C909_ATA04_Aerodynamics_heartbeat_max_key_cdr_typesize {0UL};
namespace eprosima { namespace eprosima {
namespace fastcdr { namespace fastcdr {
@ -62,14 +53,6 @@ eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr, eprosima::fastcdr::Cdr& scdr,
const XNSim::C909::ATA04::Aerodynamics_input& data); const XNSim::C909::ATA04::Aerodynamics_input& data);
eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const XNSim::C909::ATA04::Aerodynamics_output& data);
eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const XNSim::C909::ATA04::Aerodynamics_heartbeat& data);
eProsima_user_DllExport void serialize_key( eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr, eprosima::fastcdr::Cdr& scdr,
const XNSim::C909::ATA04::GroundHandling_input& data); const XNSim::C909::ATA04::GroundHandling_input& data);
@ -80,7 +63,7 @@ eProsima_user_DllExport void serialize_key(
eProsima_user_DllExport void serialize_key( eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr, eprosima::fastcdr::Cdr& scdr,
const XNSim::C909::ATA04::GroundHandling_heartbeat& data); const XNSim::C909::ATA04::Aerodynamics_output& data);
eProsima_user_DllExport void serialize_key( eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr, eprosima::fastcdr::Cdr& scdr,
@ -90,10 +73,6 @@ eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr, eprosima::fastcdr::Cdr& scdr,
const XNSim::C909::ATA04::WeightBalance_output& data); const XNSim::C909::ATA04::WeightBalance_output& data);
eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const XNSim::C909::ATA04::WeightBalance_heartbeat& data);
} // namespace fastcdr } // namespace fastcdr
} // namespace eprosima } // namespace eprosima

View File

@ -461,340 +461,6 @@ void serialize_key(
} }
template<>
eProsima_user_DllExport size_t calculate_serialized_size(
eprosima::fastcdr::CdrSizeCalculator& calculator,
const XNSim::C909::ATA04::Aerodynamics_output& data,
size_t& current_alignment)
{
using namespace XNSim::C909::ATA04;
static_cast<void>(data);
eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding();
size_t calculated_size {calculator.begin_calculate_type_serialized_size(
eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ?
eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 :
eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR,
current_alignment)};
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0),
data.l_04_o_aerocomac_fxb_f8(), current_alignment);
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1),
data.l_04_o_aerocomac_fyb_f8(), current_alignment);
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(2),
data.l_04_o_aerocomac_fzb_f8(), current_alignment);
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(3),
data.l_04_o_aerocomac_mxb_f8(), current_alignment);
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(4),
data.l_04_o_aerocomac_myb_f8(), current_alignment);
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(5),
data.l_04_o_aerocomac_mzb_f8(), current_alignment);
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(6),
data.l_04_o_aerocomac_cls_f8(), current_alignment);
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(7),
data.l_04_o_aerocomac_cl_f8(), current_alignment);
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(8),
data.l_04_o_aerocomac_cd_f8(), current_alignment);
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(9),
data.l_04_o_aerocomac_cm_f8(), current_alignment);
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(10),
data.l_04_o_aerocomac_cr_f8(), current_alignment);
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(11),
data.l_04_o_aerocomac_cy_f8(), current_alignment);
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(12),
data.l_04_o_aerocomac_cn_f8(), current_alignment);
calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment);
return calculated_size;
}
template<>
eProsima_user_DllExport void serialize(
eprosima::fastcdr::Cdr& scdr,
const XNSim::C909::ATA04::Aerodynamics_output& data)
{
using namespace XNSim::C909::ATA04;
eprosima::fastcdr::Cdr::state current_state(scdr);
scdr.begin_serialize_type(current_state,
eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ?
eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 :
eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR);
scdr
<< eprosima::fastcdr::MemberId(0) << data.l_04_o_aerocomac_fxb_f8()
<< eprosima::fastcdr::MemberId(1) << data.l_04_o_aerocomac_fyb_f8()
<< eprosima::fastcdr::MemberId(2) << data.l_04_o_aerocomac_fzb_f8()
<< eprosima::fastcdr::MemberId(3) << data.l_04_o_aerocomac_mxb_f8()
<< eprosima::fastcdr::MemberId(4) << data.l_04_o_aerocomac_myb_f8()
<< eprosima::fastcdr::MemberId(5) << data.l_04_o_aerocomac_mzb_f8()
<< eprosima::fastcdr::MemberId(6) << data.l_04_o_aerocomac_cls_f8()
<< eprosima::fastcdr::MemberId(7) << data.l_04_o_aerocomac_cl_f8()
<< eprosima::fastcdr::MemberId(8) << data.l_04_o_aerocomac_cd_f8()
<< eprosima::fastcdr::MemberId(9) << data.l_04_o_aerocomac_cm_f8()
<< eprosima::fastcdr::MemberId(10) << data.l_04_o_aerocomac_cr_f8()
<< eprosima::fastcdr::MemberId(11) << data.l_04_o_aerocomac_cy_f8()
<< eprosima::fastcdr::MemberId(12) << data.l_04_o_aerocomac_cn_f8()
;
scdr.end_serialize_type(current_state);
}
template<>
eProsima_user_DllExport void deserialize(
eprosima::fastcdr::Cdr& cdr,
XNSim::C909::ATA04::Aerodynamics_output& data)
{
using namespace XNSim::C909::ATA04;
cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ?
eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 :
eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR,
[&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool
{
bool ret_value = true;
switch (mid.id)
{
case 0:
dcdr >> data.l_04_o_aerocomac_fxb_f8();
break;
case 1:
dcdr >> data.l_04_o_aerocomac_fyb_f8();
break;
case 2:
dcdr >> data.l_04_o_aerocomac_fzb_f8();
break;
case 3:
dcdr >> data.l_04_o_aerocomac_mxb_f8();
break;
case 4:
dcdr >> data.l_04_o_aerocomac_myb_f8();
break;
case 5:
dcdr >> data.l_04_o_aerocomac_mzb_f8();
break;
case 6:
dcdr >> data.l_04_o_aerocomac_cls_f8();
break;
case 7:
dcdr >> data.l_04_o_aerocomac_cl_f8();
break;
case 8:
dcdr >> data.l_04_o_aerocomac_cd_f8();
break;
case 9:
dcdr >> data.l_04_o_aerocomac_cm_f8();
break;
case 10:
dcdr >> data.l_04_o_aerocomac_cr_f8();
break;
case 11:
dcdr >> data.l_04_o_aerocomac_cy_f8();
break;
case 12:
dcdr >> data.l_04_o_aerocomac_cn_f8();
break;
default:
ret_value = false;
break;
}
return ret_value;
});
}
void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const XNSim::C909::ATA04::Aerodynamics_output& data)
{
using namespace XNSim::C909::ATA04;
static_cast<void>(scdr);
static_cast<void>(data);
if (data.l_04_o_aerocomac_fxb_f8().has_value())
{
scdr << data.l_04_o_aerocomac_fxb_f8().value();
}
if (data.l_04_o_aerocomac_fyb_f8().has_value())
{
scdr << data.l_04_o_aerocomac_fyb_f8().value();
}
if (data.l_04_o_aerocomac_fzb_f8().has_value())
{
scdr << data.l_04_o_aerocomac_fzb_f8().value();
}
if (data.l_04_o_aerocomac_mxb_f8().has_value())
{
scdr << data.l_04_o_aerocomac_mxb_f8().value();
}
if (data.l_04_o_aerocomac_myb_f8().has_value())
{
scdr << data.l_04_o_aerocomac_myb_f8().value();
}
if (data.l_04_o_aerocomac_mzb_f8().has_value())
{
scdr << data.l_04_o_aerocomac_mzb_f8().value();
}
if (data.l_04_o_aerocomac_cls_f8().has_value())
{
scdr << data.l_04_o_aerocomac_cls_f8().value();
}
if (data.l_04_o_aerocomac_cl_f8().has_value())
{
scdr << data.l_04_o_aerocomac_cl_f8().value();
}
if (data.l_04_o_aerocomac_cd_f8().has_value())
{
scdr << data.l_04_o_aerocomac_cd_f8().value();
}
if (data.l_04_o_aerocomac_cm_f8().has_value())
{
scdr << data.l_04_o_aerocomac_cm_f8().value();
}
if (data.l_04_o_aerocomac_cr_f8().has_value())
{
scdr << data.l_04_o_aerocomac_cr_f8().value();
}
if (data.l_04_o_aerocomac_cy_f8().has_value())
{
scdr << data.l_04_o_aerocomac_cy_f8().value();
}
if (data.l_04_o_aerocomac_cn_f8().has_value())
{
scdr << data.l_04_o_aerocomac_cn_f8().value();
}
}
template<>
eProsima_user_DllExport size_t calculate_serialized_size(
eprosima::fastcdr::CdrSizeCalculator& calculator,
const XNSim::C909::ATA04::Aerodynamics_heartbeat& data,
size_t& current_alignment)
{
using namespace XNSim::C909::ATA04;
static_cast<void>(data);
eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding();
size_t calculated_size {calculator.begin_calculate_type_serialized_size(
eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ?
eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 :
eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR,
current_alignment)};
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0),
data.aero_model_heartbeat(), current_alignment);
calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment);
return calculated_size;
}
template<>
eProsima_user_DllExport void serialize(
eprosima::fastcdr::Cdr& scdr,
const XNSim::C909::ATA04::Aerodynamics_heartbeat& data)
{
using namespace XNSim::C909::ATA04;
eprosima::fastcdr::Cdr::state current_state(scdr);
scdr.begin_serialize_type(current_state,
eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ?
eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 :
eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR);
scdr
<< eprosima::fastcdr::MemberId(0) << data.aero_model_heartbeat()
;
scdr.end_serialize_type(current_state);
}
template<>
eProsima_user_DllExport void deserialize(
eprosima::fastcdr::Cdr& cdr,
XNSim::C909::ATA04::Aerodynamics_heartbeat& data)
{
using namespace XNSim::C909::ATA04;
cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ?
eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 :
eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR,
[&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool
{
bool ret_value = true;
switch (mid.id)
{
case 0:
dcdr >> data.aero_model_heartbeat();
break;
default:
ret_value = false;
break;
}
return ret_value;
});
}
void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const XNSim::C909::ATA04::Aerodynamics_heartbeat& data)
{
using namespace XNSim::C909::ATA04;
static_cast<void>(scdr);
static_cast<void>(data);
if (data.aero_model_heartbeat().has_value())
{
scdr << data.aero_model_heartbeat().value();
}
}
template<> template<>
eProsima_user_DllExport size_t calculate_serialized_size( eProsima_user_DllExport size_t calculate_serialized_size(
eprosima::fastcdr::CdrSizeCalculator& calculator, eprosima::fastcdr::CdrSizeCalculator& calculator,
@ -1498,9 +1164,6 @@ eProsima_user_DllExport size_t calculate_serialized_size(
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(33), calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(33),
data.l_04_o_gdcomac_nd_f8(), current_alignment); data.l_04_o_gdcomac_nd_f8(), current_alignment);
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(34),
data.l_04_o_gdcomac_vczt_f8(), current_alignment);
calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment); calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment);
@ -1555,7 +1218,6 @@ eProsima_user_DllExport void serialize(
<< eprosima::fastcdr::MemberId(31) << data.l_04_o_gdcomac_dstruc_f8() << eprosima::fastcdr::MemberId(31) << data.l_04_o_gdcomac_dstruc_f8()
<< eprosima::fastcdr::MemberId(32) << data.l_04_o_gdcomac_wor_par_f8() << eprosima::fastcdr::MemberId(32) << data.l_04_o_gdcomac_wor_par_f8()
<< eprosima::fastcdr::MemberId(33) << data.l_04_o_gdcomac_nd_f8() << eprosima::fastcdr::MemberId(33) << data.l_04_o_gdcomac_nd_f8()
<< eprosima::fastcdr::MemberId(34) << data.l_04_o_gdcomac_vczt_f8()
; ;
scdr.end_serialize_type(current_state); scdr.end_serialize_type(current_state);
} }
@ -1711,10 +1373,6 @@ eProsima_user_DllExport void deserialize(
dcdr >> data.l_04_o_gdcomac_nd_f8(); dcdr >> data.l_04_o_gdcomac_nd_f8();
break; break;
case 34:
dcdr >> data.l_04_o_gdcomac_vczt_f8();
break;
default: default:
ret_value = false; ret_value = false;
break; break;
@ -1901,18 +1559,13 @@ void serialize_key(
scdr << data.l_04_o_gdcomac_nd_f8().value(); scdr << data.l_04_o_gdcomac_nd_f8().value();
} }
if (data.l_04_o_gdcomac_vczt_f8().has_value())
{
scdr << data.l_04_o_gdcomac_vczt_f8().value();
}
} }
template<> template<>
eProsima_user_DllExport size_t calculate_serialized_size( eProsima_user_DllExport size_t calculate_serialized_size(
eprosima::fastcdr::CdrSizeCalculator& calculator, eprosima::fastcdr::CdrSizeCalculator& calculator,
const XNSim::C909::ATA04::GroundHandling_heartbeat& data, const XNSim::C909::ATA04::Aerodynamics_output& data,
size_t& current_alignment) size_t& current_alignment)
{ {
using namespace XNSim::C909::ATA04; using namespace XNSim::C909::ATA04;
@ -1928,7 +1581,43 @@ eProsima_user_DllExport size_t calculate_serialized_size(
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0),
data.groundhandling_model_heartbeat(), current_alignment); data.l_04_o_aerocomac_fxb_f8(), current_alignment);
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1),
data.l_04_o_aerocomac_fyb_f8(), current_alignment);
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(2),
data.l_04_o_aerocomac_fzb_f8(), current_alignment);
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(3),
data.l_04_o_aerocomac_mxb_f8(), current_alignment);
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(4),
data.l_04_o_aerocomac_myb_f8(), current_alignment);
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(5),
data.l_04_o_aerocomac_mzb_f8(), current_alignment);
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(6),
data.l_04_o_aerocomac_cls_f8(), current_alignment);
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(7),
data.l_04_o_aerocomac_cl_f8(), current_alignment);
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(8),
data.l_04_o_aerocomac_cd_f8(), current_alignment);
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(9),
data.l_04_o_aerocomac_cm_f8(), current_alignment);
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(10),
data.l_04_o_aerocomac_cr_f8(), current_alignment);
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(11),
data.l_04_o_aerocomac_cy_f8(), current_alignment);
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(12),
data.l_04_o_aerocomac_cn_f8(), current_alignment);
calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment); calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment);
@ -1939,7 +1628,7 @@ eProsima_user_DllExport size_t calculate_serialized_size(
template<> template<>
eProsima_user_DllExport void serialize( eProsima_user_DllExport void serialize(
eprosima::fastcdr::Cdr& scdr, eprosima::fastcdr::Cdr& scdr,
const XNSim::C909::ATA04::GroundHandling_heartbeat& data) const XNSim::C909::ATA04::Aerodynamics_output& data)
{ {
using namespace XNSim::C909::ATA04; using namespace XNSim::C909::ATA04;
@ -1950,7 +1639,19 @@ eProsima_user_DllExport void serialize(
eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR);
scdr scdr
<< eprosima::fastcdr::MemberId(0) << data.groundhandling_model_heartbeat() << eprosima::fastcdr::MemberId(0) << data.l_04_o_aerocomac_fxb_f8()
<< eprosima::fastcdr::MemberId(1) << data.l_04_o_aerocomac_fyb_f8()
<< eprosima::fastcdr::MemberId(2) << data.l_04_o_aerocomac_fzb_f8()
<< eprosima::fastcdr::MemberId(3) << data.l_04_o_aerocomac_mxb_f8()
<< eprosima::fastcdr::MemberId(4) << data.l_04_o_aerocomac_myb_f8()
<< eprosima::fastcdr::MemberId(5) << data.l_04_o_aerocomac_mzb_f8()
<< eprosima::fastcdr::MemberId(6) << data.l_04_o_aerocomac_cls_f8()
<< eprosima::fastcdr::MemberId(7) << data.l_04_o_aerocomac_cl_f8()
<< eprosima::fastcdr::MemberId(8) << data.l_04_o_aerocomac_cd_f8()
<< eprosima::fastcdr::MemberId(9) << data.l_04_o_aerocomac_cm_f8()
<< eprosima::fastcdr::MemberId(10) << data.l_04_o_aerocomac_cr_f8()
<< eprosima::fastcdr::MemberId(11) << data.l_04_o_aerocomac_cy_f8()
<< eprosima::fastcdr::MemberId(12) << data.l_04_o_aerocomac_cn_f8()
; ;
scdr.end_serialize_type(current_state); scdr.end_serialize_type(current_state);
} }
@ -1958,7 +1659,7 @@ eProsima_user_DllExport void serialize(
template<> template<>
eProsima_user_DllExport void deserialize( eProsima_user_DllExport void deserialize(
eprosima::fastcdr::Cdr& cdr, eprosima::fastcdr::Cdr& cdr,
XNSim::C909::ATA04::GroundHandling_heartbeat& data) XNSim::C909::ATA04::Aerodynamics_output& data)
{ {
using namespace XNSim::C909::ATA04; using namespace XNSim::C909::ATA04;
@ -1971,7 +1672,55 @@ eProsima_user_DllExport void deserialize(
switch (mid.id) switch (mid.id)
{ {
case 0: case 0:
dcdr >> data.groundhandling_model_heartbeat(); dcdr >> data.l_04_o_aerocomac_fxb_f8();
break;
case 1:
dcdr >> data.l_04_o_aerocomac_fyb_f8();
break;
case 2:
dcdr >> data.l_04_o_aerocomac_fzb_f8();
break;
case 3:
dcdr >> data.l_04_o_aerocomac_mxb_f8();
break;
case 4:
dcdr >> data.l_04_o_aerocomac_myb_f8();
break;
case 5:
dcdr >> data.l_04_o_aerocomac_mzb_f8();
break;
case 6:
dcdr >> data.l_04_o_aerocomac_cls_f8();
break;
case 7:
dcdr >> data.l_04_o_aerocomac_cl_f8();
break;
case 8:
dcdr >> data.l_04_o_aerocomac_cd_f8();
break;
case 9:
dcdr >> data.l_04_o_aerocomac_cm_f8();
break;
case 10:
dcdr >> data.l_04_o_aerocomac_cr_f8();
break;
case 11:
dcdr >> data.l_04_o_aerocomac_cy_f8();
break;
case 12:
dcdr >> data.l_04_o_aerocomac_cn_f8();
break; break;
default: default:
@ -1984,15 +1733,75 @@ eProsima_user_DllExport void deserialize(
void serialize_key( void serialize_key(
eprosima::fastcdr::Cdr& scdr, eprosima::fastcdr::Cdr& scdr,
const XNSim::C909::ATA04::GroundHandling_heartbeat& data) const XNSim::C909::ATA04::Aerodynamics_output& data)
{ {
using namespace XNSim::C909::ATA04; using namespace XNSim::C909::ATA04;
static_cast<void>(scdr); static_cast<void>(scdr);
static_cast<void>(data); static_cast<void>(data);
if (data.groundhandling_model_heartbeat().has_value()) if (data.l_04_o_aerocomac_fxb_f8().has_value())
{ {
scdr << data.groundhandling_model_heartbeat().value(); scdr << data.l_04_o_aerocomac_fxb_f8().value();
}
if (data.l_04_o_aerocomac_fyb_f8().has_value())
{
scdr << data.l_04_o_aerocomac_fyb_f8().value();
}
if (data.l_04_o_aerocomac_fzb_f8().has_value())
{
scdr << data.l_04_o_aerocomac_fzb_f8().value();
}
if (data.l_04_o_aerocomac_mxb_f8().has_value())
{
scdr << data.l_04_o_aerocomac_mxb_f8().value();
}
if (data.l_04_o_aerocomac_myb_f8().has_value())
{
scdr << data.l_04_o_aerocomac_myb_f8().value();
}
if (data.l_04_o_aerocomac_mzb_f8().has_value())
{
scdr << data.l_04_o_aerocomac_mzb_f8().value();
}
if (data.l_04_o_aerocomac_cls_f8().has_value())
{
scdr << data.l_04_o_aerocomac_cls_f8().value();
}
if (data.l_04_o_aerocomac_cl_f8().has_value())
{
scdr << data.l_04_o_aerocomac_cl_f8().value();
}
if (data.l_04_o_aerocomac_cd_f8().has_value())
{
scdr << data.l_04_o_aerocomac_cd_f8().value();
}
if (data.l_04_o_aerocomac_cm_f8().has_value())
{
scdr << data.l_04_o_aerocomac_cm_f8().value();
}
if (data.l_04_o_aerocomac_cr_f8().has_value())
{
scdr << data.l_04_o_aerocomac_cr_f8().value();
}
if (data.l_04_o_aerocomac_cy_f8().has_value())
{
scdr << data.l_04_o_aerocomac_cy_f8().value();
}
if (data.l_04_o_aerocomac_cn_f8().has_value())
{
scdr << data.l_04_o_aerocomac_cn_f8().value();
} }
} }
@ -3177,95 +2986,6 @@ void serialize_key(
} }
template<>
eProsima_user_DllExport size_t calculate_serialized_size(
eprosima::fastcdr::CdrSizeCalculator& calculator,
const XNSim::C909::ATA04::WeightBalance_heartbeat& data,
size_t& current_alignment)
{
using namespace XNSim::C909::ATA04;
static_cast<void>(data);
eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding();
size_t calculated_size {calculator.begin_calculate_type_serialized_size(
eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ?
eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 :
eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR,
current_alignment)};
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0),
data.weightbody_model_heartbeat(), current_alignment);
calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment);
return calculated_size;
}
template<>
eProsima_user_DllExport void serialize(
eprosima::fastcdr::Cdr& scdr,
const XNSim::C909::ATA04::WeightBalance_heartbeat& data)
{
using namespace XNSim::C909::ATA04;
eprosima::fastcdr::Cdr::state current_state(scdr);
scdr.begin_serialize_type(current_state,
eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ?
eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 :
eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR);
scdr
<< eprosima::fastcdr::MemberId(0) << data.weightbody_model_heartbeat()
;
scdr.end_serialize_type(current_state);
}
template<>
eProsima_user_DllExport void deserialize(
eprosima::fastcdr::Cdr& cdr,
XNSim::C909::ATA04::WeightBalance_heartbeat& data)
{
using namespace XNSim::C909::ATA04;
cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ?
eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 :
eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR,
[&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool
{
bool ret_value = true;
switch (mid.id)
{
case 0:
dcdr >> data.weightbody_model_heartbeat();
break;
default:
ret_value = false;
break;
}
return ret_value;
});
}
void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const XNSim::C909::ATA04::WeightBalance_heartbeat& data)
{
using namespace XNSim::C909::ATA04;
static_cast<void>(scdr);
static_cast<void>(data);
if (data.weightbody_model_heartbeat().has_value())
{
scdr << data.weightbody_model_heartbeat().value();
}
}
} // namespace fastcdr } // namespace fastcdr
} // namespace eprosima } // namespace eprosima

View File

@ -216,370 +216,6 @@ namespace XNSim {
register_Aerodynamics_input_type_identifier(type_identifiers_); register_Aerodynamics_input_type_identifier(type_identifiers_);
} }
Aerodynamics_outputPubSubType::Aerodynamics_outputPubSubType()
{
set_name("XNSim::C909::ATA04::Aerodynamics_output");
uint32_t type_size = XNSim_C909_ATA04_Aerodynamics_output_max_cdr_typesize;
type_size += static_cast<uint32_t>(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */
max_serialized_type_size = type_size + 4; /*encapsulation*/
is_compute_key_provided = false;
uint32_t key_length = XNSim_C909_ATA04_Aerodynamics_output_max_key_cdr_typesize > 16 ? XNSim_C909_ATA04_Aerodynamics_output_max_key_cdr_typesize : 16;
key_buffer_ = reinterpret_cast<unsigned char*>(malloc(key_length));
memset(key_buffer_, 0, key_length);
}
Aerodynamics_outputPubSubType::~Aerodynamics_outputPubSubType()
{
if (key_buffer_ != nullptr)
{
free(key_buffer_);
}
}
bool Aerodynamics_outputPubSubType::serialize(
const void* const data,
SerializedPayload_t& payload,
DataRepresentationId_t data_representation)
{
const Aerodynamics_output* p_type = static_cast<const Aerodynamics_output*>(data);
// Object that manages the raw buffer.
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(payload.data), payload.max_size);
// Object that serializes the data.
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN,
data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ?
eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2);
payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE;
ser.set_encoding_flag(
data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ?
eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR :
eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2);
try
{
// Serialize encapsulation
ser.serialize_encapsulation();
// Serialize the object.
ser << *p_type;
ser.set_dds_cdr_options({0,0});
}
catch (eprosima::fastcdr::exception::Exception& /*exception*/)
{
return false;
}
// Get the serialized length
payload.length = static_cast<uint32_t>(ser.get_serialized_data_length());
return true;
}
bool Aerodynamics_outputPubSubType::deserialize(
SerializedPayload_t& payload,
void* data)
{
try
{
// Convert DATA to pointer of your type
Aerodynamics_output* p_type = static_cast<Aerodynamics_output*>(data);
// Object that manages the raw buffer.
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(payload.data), payload.length);
// Object that deserializes the data.
eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN);
// Deserialize encapsulation.
deser.read_encapsulation();
payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE;
// Deserialize the object.
deser >> *p_type;
}
catch (eprosima::fastcdr::exception::Exception& /*exception*/)
{
return false;
}
return true;
}
uint32_t Aerodynamics_outputPubSubType::calculate_serialized_size(
const void* const data,
DataRepresentationId_t data_representation)
{
try
{
eprosima::fastcdr::CdrSizeCalculator calculator(
data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ?
eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2);
size_t current_alignment {0};
return static_cast<uint32_t>(calculator.calculate_serialized_size(
*static_cast<const Aerodynamics_output*>(data), current_alignment)) +
4u /*encapsulation*/;
}
catch (eprosima::fastcdr::exception::Exception& /*exception*/)
{
return 0;
}
}
void* Aerodynamics_outputPubSubType::create_data()
{
return reinterpret_cast<void*>(new Aerodynamics_output());
}
void Aerodynamics_outputPubSubType::delete_data(
void* data)
{
delete(reinterpret_cast<Aerodynamics_output*>(data));
}
bool Aerodynamics_outputPubSubType::compute_key(
SerializedPayload_t& payload,
InstanceHandle_t& handle,
bool force_md5)
{
if (!is_compute_key_provided)
{
return false;
}
Aerodynamics_output data;
if (deserialize(payload, static_cast<void*>(&data)))
{
return compute_key(static_cast<void*>(&data), handle, force_md5);
}
return false;
}
bool Aerodynamics_outputPubSubType::compute_key(
const void* const data,
InstanceHandle_t& handle,
bool force_md5)
{
if (!is_compute_key_provided)
{
return false;
}
const Aerodynamics_output* p_type = static_cast<const Aerodynamics_output*>(data);
// Object that manages the raw buffer.
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(key_buffer_),
XNSim_C909_ATA04_Aerodynamics_output_max_key_cdr_typesize);
// Object that serializes the data.
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2);
ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2);
eprosima::fastcdr::serialize_key(ser, *p_type);
if (force_md5 || XNSim_C909_ATA04_Aerodynamics_output_max_key_cdr_typesize > 16)
{
md5_.init();
md5_.update(key_buffer_, static_cast<unsigned int>(ser.get_serialized_data_length()));
md5_.finalize();
for (uint8_t i = 0; i < 16; ++i)
{
handle.value[i] = md5_.digest[i];
}
}
else
{
for (uint8_t i = 0; i < 16; ++i)
{
handle.value[i] = key_buffer_[i];
}
}
return true;
}
void Aerodynamics_outputPubSubType::register_type_object_representation()
{
register_Aerodynamics_output_type_identifier(type_identifiers_);
}
Aerodynamics_heartbeatPubSubType::Aerodynamics_heartbeatPubSubType()
{
set_name("XNSim::C909::ATA04::Aerodynamics_heartbeat");
uint32_t type_size = XNSim_C909_ATA04_Aerodynamics_heartbeat_max_cdr_typesize;
type_size += static_cast<uint32_t>(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */
max_serialized_type_size = type_size + 4; /*encapsulation*/
is_compute_key_provided = false;
uint32_t key_length = XNSim_C909_ATA04_Aerodynamics_heartbeat_max_key_cdr_typesize > 16 ? XNSim_C909_ATA04_Aerodynamics_heartbeat_max_key_cdr_typesize : 16;
key_buffer_ = reinterpret_cast<unsigned char*>(malloc(key_length));
memset(key_buffer_, 0, key_length);
}
Aerodynamics_heartbeatPubSubType::~Aerodynamics_heartbeatPubSubType()
{
if (key_buffer_ != nullptr)
{
free(key_buffer_);
}
}
bool Aerodynamics_heartbeatPubSubType::serialize(
const void* const data,
SerializedPayload_t& payload,
DataRepresentationId_t data_representation)
{
const Aerodynamics_heartbeat* p_type = static_cast<const Aerodynamics_heartbeat*>(data);
// Object that manages the raw buffer.
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(payload.data), payload.max_size);
// Object that serializes the data.
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN,
data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ?
eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2);
payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE;
ser.set_encoding_flag(
data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ?
eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR :
eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2);
try
{
// Serialize encapsulation
ser.serialize_encapsulation();
// Serialize the object.
ser << *p_type;
ser.set_dds_cdr_options({0,0});
}
catch (eprosima::fastcdr::exception::Exception& /*exception*/)
{
return false;
}
// Get the serialized length
payload.length = static_cast<uint32_t>(ser.get_serialized_data_length());
return true;
}
bool Aerodynamics_heartbeatPubSubType::deserialize(
SerializedPayload_t& payload,
void* data)
{
try
{
// Convert DATA to pointer of your type
Aerodynamics_heartbeat* p_type = static_cast<Aerodynamics_heartbeat*>(data);
// Object that manages the raw buffer.
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(payload.data), payload.length);
// Object that deserializes the data.
eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN);
// Deserialize encapsulation.
deser.read_encapsulation();
payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE;
// Deserialize the object.
deser >> *p_type;
}
catch (eprosima::fastcdr::exception::Exception& /*exception*/)
{
return false;
}
return true;
}
uint32_t Aerodynamics_heartbeatPubSubType::calculate_serialized_size(
const void* const data,
DataRepresentationId_t data_representation)
{
try
{
eprosima::fastcdr::CdrSizeCalculator calculator(
data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ?
eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2);
size_t current_alignment {0};
return static_cast<uint32_t>(calculator.calculate_serialized_size(
*static_cast<const Aerodynamics_heartbeat*>(data), current_alignment)) +
4u /*encapsulation*/;
}
catch (eprosima::fastcdr::exception::Exception& /*exception*/)
{
return 0;
}
}
void* Aerodynamics_heartbeatPubSubType::create_data()
{
return reinterpret_cast<void*>(new Aerodynamics_heartbeat());
}
void Aerodynamics_heartbeatPubSubType::delete_data(
void* data)
{
delete(reinterpret_cast<Aerodynamics_heartbeat*>(data));
}
bool Aerodynamics_heartbeatPubSubType::compute_key(
SerializedPayload_t& payload,
InstanceHandle_t& handle,
bool force_md5)
{
if (!is_compute_key_provided)
{
return false;
}
Aerodynamics_heartbeat data;
if (deserialize(payload, static_cast<void*>(&data)))
{
return compute_key(static_cast<void*>(&data), handle, force_md5);
}
return false;
}
bool Aerodynamics_heartbeatPubSubType::compute_key(
const void* const data,
InstanceHandle_t& handle,
bool force_md5)
{
if (!is_compute_key_provided)
{
return false;
}
const Aerodynamics_heartbeat* p_type = static_cast<const Aerodynamics_heartbeat*>(data);
// Object that manages the raw buffer.
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(key_buffer_),
XNSim_C909_ATA04_Aerodynamics_heartbeat_max_key_cdr_typesize);
// Object that serializes the data.
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2);
ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2);
eprosima::fastcdr::serialize_key(ser, *p_type);
if (force_md5 || XNSim_C909_ATA04_Aerodynamics_heartbeat_max_key_cdr_typesize > 16)
{
md5_.init();
md5_.update(key_buffer_, static_cast<unsigned int>(ser.get_serialized_data_length()));
md5_.finalize();
for (uint8_t i = 0; i < 16; ++i)
{
handle.value[i] = md5_.digest[i];
}
}
else
{
for (uint8_t i = 0; i < 16; ++i)
{
handle.value[i] = key_buffer_[i];
}
}
return true;
}
void Aerodynamics_heartbeatPubSubType::register_type_object_representation()
{
register_Aerodynamics_heartbeat_type_identifier(type_identifiers_);
}
GroundHandling_inputPubSubType::GroundHandling_inputPubSubType() GroundHandling_inputPubSubType::GroundHandling_inputPubSubType()
{ {
set_name("XNSim::C909::ATA04::GroundHandling_input"); set_name("XNSim::C909::ATA04::GroundHandling_input");
@ -944,19 +580,19 @@ namespace XNSim {
register_GroundHandling_output_type_identifier(type_identifiers_); register_GroundHandling_output_type_identifier(type_identifiers_);
} }
GroundHandling_heartbeatPubSubType::GroundHandling_heartbeatPubSubType() Aerodynamics_outputPubSubType::Aerodynamics_outputPubSubType()
{ {
set_name("XNSim::C909::ATA04::GroundHandling_heartbeat"); set_name("XNSim::C909::ATA04::Aerodynamics_output");
uint32_t type_size = XNSim_C909_ATA04_GroundHandling_heartbeat_max_cdr_typesize; uint32_t type_size = XNSim_C909_ATA04_Aerodynamics_output_max_cdr_typesize;
type_size += static_cast<uint32_t>(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ type_size += static_cast<uint32_t>(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */
max_serialized_type_size = type_size + 4; /*encapsulation*/ max_serialized_type_size = type_size + 4; /*encapsulation*/
is_compute_key_provided = false; is_compute_key_provided = false;
uint32_t key_length = XNSim_C909_ATA04_GroundHandling_heartbeat_max_key_cdr_typesize > 16 ? XNSim_C909_ATA04_GroundHandling_heartbeat_max_key_cdr_typesize : 16; uint32_t key_length = XNSim_C909_ATA04_Aerodynamics_output_max_key_cdr_typesize > 16 ? XNSim_C909_ATA04_Aerodynamics_output_max_key_cdr_typesize : 16;
key_buffer_ = reinterpret_cast<unsigned char*>(malloc(key_length)); key_buffer_ = reinterpret_cast<unsigned char*>(malloc(key_length));
memset(key_buffer_, 0, key_length); memset(key_buffer_, 0, key_length);
} }
GroundHandling_heartbeatPubSubType::~GroundHandling_heartbeatPubSubType() Aerodynamics_outputPubSubType::~Aerodynamics_outputPubSubType()
{ {
if (key_buffer_ != nullptr) if (key_buffer_ != nullptr)
{ {
@ -964,12 +600,12 @@ namespace XNSim {
} }
} }
bool GroundHandling_heartbeatPubSubType::serialize( bool Aerodynamics_outputPubSubType::serialize(
const void* const data, const void* const data,
SerializedPayload_t& payload, SerializedPayload_t& payload,
DataRepresentationId_t data_representation) DataRepresentationId_t data_representation)
{ {
const GroundHandling_heartbeat* p_type = static_cast<const GroundHandling_heartbeat*>(data); const Aerodynamics_output* p_type = static_cast<const Aerodynamics_output*>(data);
// Object that manages the raw buffer. // Object that manages the raw buffer.
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(payload.data), payload.max_size); eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(payload.data), payload.max_size);
@ -1001,14 +637,14 @@ namespace XNSim {
return true; return true;
} }
bool GroundHandling_heartbeatPubSubType::deserialize( bool Aerodynamics_outputPubSubType::deserialize(
SerializedPayload_t& payload, SerializedPayload_t& payload,
void* data) void* data)
{ {
try try
{ {
// Convert DATA to pointer of your type // Convert DATA to pointer of your type
GroundHandling_heartbeat* p_type = static_cast<GroundHandling_heartbeat*>(data); Aerodynamics_output* p_type = static_cast<Aerodynamics_output*>(data);
// Object that manages the raw buffer. // Object that manages the raw buffer.
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(payload.data), payload.length); eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(payload.data), payload.length);
@ -1031,7 +667,7 @@ namespace XNSim {
return true; return true;
} }
uint32_t GroundHandling_heartbeatPubSubType::calculate_serialized_size( uint32_t Aerodynamics_outputPubSubType::calculate_serialized_size(
const void* const data, const void* const data,
DataRepresentationId_t data_representation) DataRepresentationId_t data_representation)
{ {
@ -1042,7 +678,7 @@ namespace XNSim {
eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2);
size_t current_alignment {0}; size_t current_alignment {0};
return static_cast<uint32_t>(calculator.calculate_serialized_size( return static_cast<uint32_t>(calculator.calculate_serialized_size(
*static_cast<const GroundHandling_heartbeat*>(data), current_alignment)) + *static_cast<const Aerodynamics_output*>(data), current_alignment)) +
4u /*encapsulation*/; 4u /*encapsulation*/;
} }
catch (eprosima::fastcdr::exception::Exception& /*exception*/) catch (eprosima::fastcdr::exception::Exception& /*exception*/)
@ -1051,18 +687,18 @@ namespace XNSim {
} }
} }
void* GroundHandling_heartbeatPubSubType::create_data() void* Aerodynamics_outputPubSubType::create_data()
{ {
return reinterpret_cast<void*>(new GroundHandling_heartbeat()); return reinterpret_cast<void*>(new Aerodynamics_output());
} }
void GroundHandling_heartbeatPubSubType::delete_data( void Aerodynamics_outputPubSubType::delete_data(
void* data) void* data)
{ {
delete(reinterpret_cast<GroundHandling_heartbeat*>(data)); delete(reinterpret_cast<Aerodynamics_output*>(data));
} }
bool GroundHandling_heartbeatPubSubType::compute_key( bool Aerodynamics_outputPubSubType::compute_key(
SerializedPayload_t& payload, SerializedPayload_t& payload,
InstanceHandle_t& handle, InstanceHandle_t& handle,
bool force_md5) bool force_md5)
@ -1072,7 +708,7 @@ namespace XNSim {
return false; return false;
} }
GroundHandling_heartbeat data; Aerodynamics_output data;
if (deserialize(payload, static_cast<void*>(&data))) if (deserialize(payload, static_cast<void*>(&data)))
{ {
return compute_key(static_cast<void*>(&data), handle, force_md5); return compute_key(static_cast<void*>(&data), handle, force_md5);
@ -1081,7 +717,7 @@ namespace XNSim {
return false; return false;
} }
bool GroundHandling_heartbeatPubSubType::compute_key( bool Aerodynamics_outputPubSubType::compute_key(
const void* const data, const void* const data,
InstanceHandle_t& handle, InstanceHandle_t& handle,
bool force_md5) bool force_md5)
@ -1091,17 +727,17 @@ namespace XNSim {
return false; return false;
} }
const GroundHandling_heartbeat* p_type = static_cast<const GroundHandling_heartbeat*>(data); const Aerodynamics_output* p_type = static_cast<const Aerodynamics_output*>(data);
// Object that manages the raw buffer. // Object that manages the raw buffer.
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(key_buffer_), eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(key_buffer_),
XNSim_C909_ATA04_GroundHandling_heartbeat_max_key_cdr_typesize); XNSim_C909_ATA04_Aerodynamics_output_max_key_cdr_typesize);
// Object that serializes the data. // Object that serializes the data.
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2); eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2);
ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2);
eprosima::fastcdr::serialize_key(ser, *p_type); eprosima::fastcdr::serialize_key(ser, *p_type);
if (force_md5 || XNSim_C909_ATA04_GroundHandling_heartbeat_max_key_cdr_typesize > 16) if (force_md5 || XNSim_C909_ATA04_Aerodynamics_output_max_key_cdr_typesize > 16)
{ {
md5_.init(); md5_.init();
md5_.update(key_buffer_, static_cast<unsigned int>(ser.get_serialized_data_length())); md5_.update(key_buffer_, static_cast<unsigned int>(ser.get_serialized_data_length()));
@ -1121,9 +757,9 @@ namespace XNSim {
return true; return true;
} }
void GroundHandling_heartbeatPubSubType::register_type_object_representation() void Aerodynamics_outputPubSubType::register_type_object_representation()
{ {
register_GroundHandling_heartbeat_type_identifier(type_identifiers_); register_Aerodynamics_output_type_identifier(type_identifiers_);
} }
WeightBalance_inputPubSubType::WeightBalance_inputPubSubType() WeightBalance_inputPubSubType::WeightBalance_inputPubSubType()
@ -1490,188 +1126,6 @@ namespace XNSim {
register_WeightBalance_output_type_identifier(type_identifiers_); register_WeightBalance_output_type_identifier(type_identifiers_);
} }
WeightBalance_heartbeatPubSubType::WeightBalance_heartbeatPubSubType()
{
set_name("XNSim::C909::ATA04::WeightBalance_heartbeat");
uint32_t type_size = XNSim_C909_ATA04_WeightBalance_heartbeat_max_cdr_typesize;
type_size += static_cast<uint32_t>(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */
max_serialized_type_size = type_size + 4; /*encapsulation*/
is_compute_key_provided = false;
uint32_t key_length = XNSim_C909_ATA04_WeightBalance_heartbeat_max_key_cdr_typesize > 16 ? XNSim_C909_ATA04_WeightBalance_heartbeat_max_key_cdr_typesize : 16;
key_buffer_ = reinterpret_cast<unsigned char*>(malloc(key_length));
memset(key_buffer_, 0, key_length);
}
WeightBalance_heartbeatPubSubType::~WeightBalance_heartbeatPubSubType()
{
if (key_buffer_ != nullptr)
{
free(key_buffer_);
}
}
bool WeightBalance_heartbeatPubSubType::serialize(
const void* const data,
SerializedPayload_t& payload,
DataRepresentationId_t data_representation)
{
const WeightBalance_heartbeat* p_type = static_cast<const WeightBalance_heartbeat*>(data);
// Object that manages the raw buffer.
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(payload.data), payload.max_size);
// Object that serializes the data.
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN,
data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ?
eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2);
payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE;
ser.set_encoding_flag(
data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ?
eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR :
eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2);
try
{
// Serialize encapsulation
ser.serialize_encapsulation();
// Serialize the object.
ser << *p_type;
ser.set_dds_cdr_options({0,0});
}
catch (eprosima::fastcdr::exception::Exception& /*exception*/)
{
return false;
}
// Get the serialized length
payload.length = static_cast<uint32_t>(ser.get_serialized_data_length());
return true;
}
bool WeightBalance_heartbeatPubSubType::deserialize(
SerializedPayload_t& payload,
void* data)
{
try
{
// Convert DATA to pointer of your type
WeightBalance_heartbeat* p_type = static_cast<WeightBalance_heartbeat*>(data);
// Object that manages the raw buffer.
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(payload.data), payload.length);
// Object that deserializes the data.
eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN);
// Deserialize encapsulation.
deser.read_encapsulation();
payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE;
// Deserialize the object.
deser >> *p_type;
}
catch (eprosima::fastcdr::exception::Exception& /*exception*/)
{
return false;
}
return true;
}
uint32_t WeightBalance_heartbeatPubSubType::calculate_serialized_size(
const void* const data,
DataRepresentationId_t data_representation)
{
try
{
eprosima::fastcdr::CdrSizeCalculator calculator(
data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ?
eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2);
size_t current_alignment {0};
return static_cast<uint32_t>(calculator.calculate_serialized_size(
*static_cast<const WeightBalance_heartbeat*>(data), current_alignment)) +
4u /*encapsulation*/;
}
catch (eprosima::fastcdr::exception::Exception& /*exception*/)
{
return 0;
}
}
void* WeightBalance_heartbeatPubSubType::create_data()
{
return reinterpret_cast<void*>(new WeightBalance_heartbeat());
}
void WeightBalance_heartbeatPubSubType::delete_data(
void* data)
{
delete(reinterpret_cast<WeightBalance_heartbeat*>(data));
}
bool WeightBalance_heartbeatPubSubType::compute_key(
SerializedPayload_t& payload,
InstanceHandle_t& handle,
bool force_md5)
{
if (!is_compute_key_provided)
{
return false;
}
WeightBalance_heartbeat data;
if (deserialize(payload, static_cast<void*>(&data)))
{
return compute_key(static_cast<void*>(&data), handle, force_md5);
}
return false;
}
bool WeightBalance_heartbeatPubSubType::compute_key(
const void* const data,
InstanceHandle_t& handle,
bool force_md5)
{
if (!is_compute_key_provided)
{
return false;
}
const WeightBalance_heartbeat* p_type = static_cast<const WeightBalance_heartbeat*>(data);
// Object that manages the raw buffer.
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(key_buffer_),
XNSim_C909_ATA04_WeightBalance_heartbeat_max_key_cdr_typesize);
// Object that serializes the data.
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2);
ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2);
eprosima::fastcdr::serialize_key(ser, *p_type);
if (force_md5 || XNSim_C909_ATA04_WeightBalance_heartbeat_max_key_cdr_typesize > 16)
{
md5_.init();
md5_.update(key_buffer_, static_cast<unsigned int>(ser.get_serialized_data_length()));
md5_.finalize();
for (uint8_t i = 0; i < 16; ++i)
{
handle.value[i] = md5_.digest[i];
}
}
else
{
for (uint8_t i = 0; i < 16; ++i)
{
handle.value[i] = key_buffer_[i];
}
}
return true;
}
void WeightBalance_heartbeatPubSubType::register_type_object_representation()
{
register_WeightBalance_heartbeat_type_identifier(type_identifiers_);
}
} // namespace ATA04 } // namespace ATA04
} // namespace C909 } // namespace C909

View File

@ -125,168 +125,6 @@ namespace XNSim
}; };
/*!
* @brief This class represents the TopicDataType of the type Aerodynamics_output defined by the user in the IDL file.
* @ingroup C909_V1
*/
class Aerodynamics_outputPubSubType : public eprosima::fastdds::dds::TopicDataType
{
public:
typedef Aerodynamics_output type;
eProsima_user_DllExport Aerodynamics_outputPubSubType();
eProsima_user_DllExport ~Aerodynamics_outputPubSubType() override;
eProsima_user_DllExport bool serialize(
const void* const data,
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool deserialize(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
void* data) override;
eProsima_user_DllExport uint32_t calculate_serialized_size(
const void* const data,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool compute_key(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport bool compute_key(
const void* const data,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport void* create_data() override;
eProsima_user_DllExport void delete_data(
void* data) override;
//Register TypeObject representation in Fast DDS TypeObjectRegistry
eProsima_user_DllExport void register_type_object_representation() override;
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
eProsima_user_DllExport inline bool is_bounded() const override
{
return true;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
eProsima_user_DllExport inline bool is_plain(
eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override
{
static_cast<void>(data_representation);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
eProsima_user_DllExport inline bool construct_sample(
void* memory) const override
{
static_cast<void>(memory);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
private:
eprosima::fastdds::MD5 md5_;
unsigned char* key_buffer_;
};
/*!
* @brief This class represents the TopicDataType of the type Aerodynamics_heartbeat defined by the user in the IDL file.
* @ingroup C909_V1
*/
class Aerodynamics_heartbeatPubSubType : public eprosima::fastdds::dds::TopicDataType
{
public:
typedef Aerodynamics_heartbeat type;
eProsima_user_DllExport Aerodynamics_heartbeatPubSubType();
eProsima_user_DllExport ~Aerodynamics_heartbeatPubSubType() override;
eProsima_user_DllExport bool serialize(
const void* const data,
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool deserialize(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
void* data) override;
eProsima_user_DllExport uint32_t calculate_serialized_size(
const void* const data,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool compute_key(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport bool compute_key(
const void* const data,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport void* create_data() override;
eProsima_user_DllExport void delete_data(
void* data) override;
//Register TypeObject representation in Fast DDS TypeObjectRegistry
eProsima_user_DllExport void register_type_object_representation() override;
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
eProsima_user_DllExport inline bool is_bounded() const override
{
return true;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
eProsima_user_DllExport inline bool is_plain(
eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override
{
static_cast<void>(data_representation);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
eProsima_user_DllExport inline bool construct_sample(
void* memory) const override
{
static_cast<void>(memory);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
private:
eprosima::fastdds::MD5 md5_;
unsigned char* key_buffer_;
};
/*! /*!
* @brief This class represents the TopicDataType of the type GroundHandling_input defined by the user in the IDL file. * @brief This class represents the TopicDataType of the type GroundHandling_input defined by the user in the IDL file.
* @ingroup C909_V1 * @ingroup C909_V1
@ -450,18 +288,18 @@ namespace XNSim
}; };
/*! /*!
* @brief This class represents the TopicDataType of the type GroundHandling_heartbeat defined by the user in the IDL file. * @brief This class represents the TopicDataType of the type Aerodynamics_output defined by the user in the IDL file.
* @ingroup C909_V1 * @ingroup C909_V1
*/ */
class GroundHandling_heartbeatPubSubType : public eprosima::fastdds::dds::TopicDataType class Aerodynamics_outputPubSubType : public eprosima::fastdds::dds::TopicDataType
{ {
public: public:
typedef GroundHandling_heartbeat type; typedef Aerodynamics_output type;
eProsima_user_DllExport GroundHandling_heartbeatPubSubType(); eProsima_user_DllExport Aerodynamics_outputPubSubType();
eProsima_user_DllExport ~GroundHandling_heartbeatPubSubType() override; eProsima_user_DllExport ~Aerodynamics_outputPubSubType() override;
eProsima_user_DllExport bool serialize( eProsima_user_DllExport bool serialize(
const void* const data, const void* const data,
@ -691,87 +529,6 @@ namespace XNSim
unsigned char* key_buffer_; unsigned char* key_buffer_;
}; };
/*!
* @brief This class represents the TopicDataType of the type WeightBalance_heartbeat defined by the user in the IDL file.
* @ingroup C909_V1
*/
class WeightBalance_heartbeatPubSubType : public eprosima::fastdds::dds::TopicDataType
{
public:
typedef WeightBalance_heartbeat type;
eProsima_user_DllExport WeightBalance_heartbeatPubSubType();
eProsima_user_DllExport ~WeightBalance_heartbeatPubSubType() override;
eProsima_user_DllExport bool serialize(
const void* const data,
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool deserialize(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
void* data) override;
eProsima_user_DllExport uint32_t calculate_serialized_size(
const void* const data,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool compute_key(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport bool compute_key(
const void* const data,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport void* create_data() override;
eProsima_user_DllExport void delete_data(
void* data) override;
//Register TypeObject representation in Fast DDS TypeObjectRegistry
eProsima_user_DllExport void register_type_object_representation() override;
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
eProsima_user_DllExport inline bool is_bounded() const override
{
return true;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
eProsima_user_DllExport inline bool is_plain(
eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override
{
static_cast<void>(data_representation);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
eProsima_user_DllExport inline bool construct_sample(
void* memory) const override
{
static_cast<void>(memory);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
private:
eprosima::fastdds::MD5 md5_;
unsigned char* key_buffer_;
};
} // namespace ATA04 } // namespace ATA04
} // namespace C909 } // namespace C909
} // namespace XNSim } // namespace XNSim

File diff suppressed because it is too large Load Diff

View File

@ -53,32 +53,6 @@ namespace ATA04 {
eProsima_user_DllExport void register_Aerodynamics_input_type_identifier( eProsima_user_DllExport void register_Aerodynamics_input_type_identifier(
eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids);
/**
* @brief Register Aerodynamics_output related TypeIdentifier.
* Fully-descriptive TypeIdentifiers are directly registered.
* Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is
* indirectly registered as well.
*
* @param[out] TypeIdentifier of the registered type.
* The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers.
* Invalid TypeIdentifier is returned in case of error.
*/
eProsima_user_DllExport void register_Aerodynamics_output_type_identifier(
eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids);
/**
* @brief Register Aerodynamics_heartbeat related TypeIdentifier.
* Fully-descriptive TypeIdentifiers are directly registered.
* Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is
* indirectly registered as well.
*
* @param[out] TypeIdentifier of the registered type.
* The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers.
* Invalid TypeIdentifier is returned in case of error.
*/
eProsima_user_DllExport void register_Aerodynamics_heartbeat_type_identifier(
eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids);
/** /**
* @brief Register GroundHandling_input related TypeIdentifier. * @brief Register GroundHandling_input related TypeIdentifier.
* Fully-descriptive TypeIdentifiers are directly registered. * Fully-descriptive TypeIdentifiers are directly registered.
@ -106,7 +80,7 @@ eProsima_user_DllExport void register_GroundHandling_output_type_identifier(
eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids);
/** /**
* @brief Register GroundHandling_heartbeat related TypeIdentifier. * @brief Register Aerodynamics_output related TypeIdentifier.
* Fully-descriptive TypeIdentifiers are directly registered. * Fully-descriptive TypeIdentifiers are directly registered.
* Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is
* indirectly registered as well. * indirectly registered as well.
@ -115,7 +89,7 @@ eProsima_user_DllExport void register_GroundHandling_output_type_identifier(
* The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers.
* Invalid TypeIdentifier is returned in case of error. * Invalid TypeIdentifier is returned in case of error.
*/ */
eProsima_user_DllExport void register_GroundHandling_heartbeat_type_identifier( eProsima_user_DllExport void register_Aerodynamics_output_type_identifier(
eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids);
/** /**
@ -144,19 +118,6 @@ eProsima_user_DllExport void register_WeightBalance_input_type_identifier(
eProsima_user_DllExport void register_WeightBalance_output_type_identifier( eProsima_user_DllExport void register_WeightBalance_output_type_identifier(
eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids);
/**
* @brief Register WeightBalance_heartbeat related TypeIdentifier.
* Fully-descriptive TypeIdentifiers are directly registered.
* Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is
* indirectly registered as well.
*
* @param[out] TypeIdentifier of the registered type.
* The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers.
* Invalid TypeIdentifier is returned in case of error.
*/
eProsima_user_DllExport void register_WeightBalance_heartbeat_type_identifier(
eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids);
} // namespace ATA04 } // namespace ATA04
} // namespace C909 } // namespace C909

68
Release/IDL/C909_V1/CMakeLists.txt Executable file → Normal file
View File

@ -1,65 +1,53 @@
cmake_minimum_required(VERSION 3.16) cmake_minimum_required(VERSION 3.16)
project(C909_V1_Interface LANGUAGES CXX) project(C909_V1_Interface LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
#
if(DEFINED ENV{XNCore}) if(DEFINED ENV{XNCore})
set(XNCore_PATH $ENV{XNCore}) set(XNCore_PATH $ENV{XNCore})
else() else()
message(FATAL_ERROR "Environment variable XNCore is not set.") message(FATAL_ERROR "Environment variable XNCore is not set.")
endif() endif()
# XNCore_PATH include
include_directories(${XNCore_PATH}/include) include_directories(${XNCore_PATH}/include)
if(NOT fastcdr_FOUND) if(NOT fastcdr_FOUND)
find_package(fastcdr 2 REQUIRED) find_package(fastcdr 2 REQUIRED)
endif() endif()
if(NOT fastdds_FOUND) if(NOT fastdds_FOUND)
find_package(fastdds 3 REQUIRED) find_package(fastdds 3 REQUIRED)
endif() endif()
find_package(OpenSSL REQUIRED) find_package(OpenSSL REQUIRED)
add_library(C909_V1_Interface SHARED add_library(C909_V1_Interface SHARED
C909_V1.hpp C909_V1.hpp
C909_V1CdrAux.hpp C909_V1CdrAux.hpp
C909_V1CdrAux.ipp C909_V1CdrAux.ipp
C909_V1PubSubTypes.hpp C909_V1PubSubTypes.hpp
C909_V1PubSubTypes.cxx C909_V1PubSubTypes.cxx
C909_V1TypeObjectSupport.hpp C909_V1TypeObjectSupport.hpp
C909_V1TypeObjectSupport.cxx C909_V1TypeObjectSupport.cxx
ATA04/GroundHandling_input.hpp ATA04/Aerodynamics_input.hpp
ATA04/GroundHandling_input.cxx ATA04/Aerodynamics_input.cxx
ATA04/GroundHandling_output.hpp ATA04/GroundHandling_input.hpp
ATA04/GroundHandling_output.cxx ATA04/GroundHandling_input.cxx
ATA04/GroundHandling_heartbeat.hpp ATA04/GroundHandling_output.hpp
ATA04/GroundHandling_heartbeat.cxx ATA04/GroundHandling_output.cxx
ATA04/Aerodynamics_output.hpp
ATA04/Aerodynamics_output.cxx
ATA04/WeightBalance_input.hpp
ATA04/WeightBalance_input.cxx
ATA04/WeightBalance_output.hpp
ATA04/WeightBalance_output.cxx
) )
target_link_libraries(C909_V1_Interface PRIVATE target_link_libraries(C909_V1_Interface PRIVATE
fastcdr fastcdr fastdds OpenSSL::SSL OpenSSL::Crypto
fastdds ${XNCore_PATH}/lib/libXNCore.so
OpenSSL::SSL
OpenSSL::Crypto
${XNCore_PATH}/lib/libXNCore.so
) )
target_compile_definitions(C909_V1_Interface PRIVATE C909_V1_INTERFACE_LIBRARY) target_compile_definitions(C909_V1_Interface PRIVATE C909_V1_INTERFACE_LIBRARY)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${XNCore_PATH}" CACHE PATH "Install path prefix" FORCE) set(CMAKE_INSTALL_PREFIX "${XNCore_PATH}" CACHE PATH "Install path prefix" FORCE)
endif() endif()
include(GNUInstallDirs) include(GNUInstallDirs)
install(TARGETS C909_V1_Interface install(TARGETS C909_V1_Interface
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION . RUNTIME DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION .
) )

View File

@ -0,0 +1,57 @@
{
"files.associations": {
"chrono": "cpp",
"cctype": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"codecvt": "cpp",
"compare": "cpp",
"concepts": "cpp",
"cstdint": "cpp",
"deque": "cpp",
"map": "cpp",
"unordered_map": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"ratio": "cpp",
"string": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"istream": "cpp",
"limits": "cpp",
"new": "cpp",
"ostream": "cpp",
"ranges": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"typeinfo": "cpp",
"cstring": "cpp"
}
}

View File

@ -0,0 +1,55 @@
cmake_minimum_required(VERSION 3.16)
project(XNInterfaceGenServer LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
#
if(DEFINED ENV{XNCore})
set(XNCore_PATH $ENV{XNCore})
else()
message(FATAL_ERROR "Environment variable XNCore is not set.")
endif()
#
find_package(nlohmann_json 3.9.1 REQUIRED)
find_package(SQLite3 REQUIRED)
add_library(XNInterfaceGenServer SHARED
XNInterfaceGenServer.h
XNInterfaceGenServer.cpp
GetInterfaceData.h
GetInterfaceData.cpp
GenIDL.h
GenIDL.cpp
FastDDSGen.h
FastDDSGen.cpp
PublicDefine.h
PublicDefine.cpp
DDSInterfaceGen.h
DDSInterfaceGen.cpp
CMakeListsGen.h
CMakeListsGen.cpp
)
#
target_include_directories(XNInterfaceGenServer PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(XNInterfaceGenServer PRIVATE
nlohmann_json::nlohmann_json
SQLite::SQLite3
)
target_compile_definitions(XNInterfaceGenServer PRIVATE XNINTERFACEGENSERVER_LIBRARY)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${XNCore_PATH}" CACHE PATH "Install path prefix" FORCE)
endif()
include(GNUInstallDirs)
install(TARGETS XNInterfaceGenServer
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION .
)

View File

@ -0,0 +1,92 @@
#include "CMakeListsGen.h"
bool CMakeListsGen::generateCMakeLists(const AllInterfaceData &interfaceData,
const std::string &idlPath, const std::string &configName)
{
std::string idlDirPath = fs::path(idlPath).parent_path().string();
std::string cmakefilePath = idlDirPath + "/CMakeLists.txt";
// 1. 生成CMakeLists.txt文件
std::ofstream cmakeFile(cmakefilePath);
if (!cmakeFile.is_open()) {
return false;
}
cmakeFile << "cmake_minimum_required(VERSION 3.16)" << std::endl;
cmakeFile << "project(" << configName << "_Interface LANGUAGES CXX)" << std::endl;
cmakeFile << "set(CMAKE_CXX_STANDARD 17)" << std::endl;
cmakeFile << "set(CMAKE_CXX_STANDARD_REQUIRED ON)" << std::endl;
cmakeFile << "set(CMAKE_POSITION_INDEPENDENT_CODE ON)" << std::endl;
// 获取环境变量
cmakeFile << "if(DEFINED ENV{XNCore})" << std::endl;
cmakeFile << "\tset(XNCore_PATH $ENV{XNCore})" << std::endl;
cmakeFile << "else()" << std::endl;
cmakeFile << "\tmessage(FATAL_ERROR \"Environment variable XNCore is not set.\")" << std::endl;
cmakeFile << "endif()" << std::endl;
// 添加 XNCore_PATH 下的 include 目录为包含目录
cmakeFile << "include_directories(${XNCore_PATH}/include)" << std::endl;
cmakeFile << "if(NOT fastcdr_FOUND)" << std::endl;
cmakeFile << "\tfind_package(fastcdr 2 REQUIRED)" << std::endl;
cmakeFile << "endif()" << std::endl;
cmakeFile << "if(NOT fastdds_FOUND)" << std::endl;
cmakeFile << "\tfind_package(fastdds 3 REQUIRED)" << std::endl;
cmakeFile << "endif()" << std::endl;
cmakeFile << "find_package(OpenSSL REQUIRED)" << std::endl;
cmakeFile << "add_library(" << configName << "_Interface SHARED" << std::endl;
cmakeFile << " " << configName << ".hpp" << std::endl;
cmakeFile << " " << configName << "CdrAux.hpp" << std::endl;
cmakeFile << " " << configName << "CdrAux.ipp" << std::endl;
cmakeFile << " " << configName << "PubSubTypes.hpp" << std::endl;
cmakeFile << " " << configName << "PubSubTypes.cxx" << std::endl;
cmakeFile << " " << configName << "TypeObjectSupport.hpp" << std::endl;
cmakeFile << " " << configName << "TypeObjectSupport.cxx" << std::endl;
for (const auto &ataInterfaceData : interfaceData.ataInterfaceData) {
std::string ataName = ataInterfaceData.ataName;
for (const auto &structInterfaceData : ataInterfaceData.structInterfaceData) {
std::string structName = structInterfaceData.modelStructName;
cmakeFile << " " << ataName << "/" << structName << ".hpp" << std::endl;
cmakeFile << " " << ataName << "/" << structName << ".cxx" << std::endl;
}
}
cmakeFile << ")" << std::endl;
cmakeFile << "target_link_libraries(" << configName << "_Interface PRIVATE" << std::endl;
cmakeFile << " fastcdr fastdds OpenSSL::SSL OpenSSL::Crypto" << std::endl;
cmakeFile << " ${XNCore_PATH}/lib/libXNCore.so" << std::endl;
cmakeFile << ")" << std::endl;
cmakeFile << "target_compile_definitions(" << configName << "_Interface PRIVATE "
<< toUpper(configName) << "_INTERFACE_LIBRARY)" << std::endl;
cmakeFile << "if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)" << std::endl;
cmakeFile
<< "\tset(CMAKE_INSTALL_PREFIX \"${XNCore_PATH}\" CACHE PATH \"Install path prefix\" FORCE)"
<< std::endl;
cmakeFile << "endif()" << std::endl;
cmakeFile << "include(GNUInstallDirs)" << std::endl;
cmakeFile << "install(TARGETS " << configName << "_Interface" << std::endl;
cmakeFile << " RUNTIME DESTINATION ." << std::endl;
cmakeFile << " LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}" << std::endl;
cmakeFile << " ARCHIVE DESTINATION ." << std::endl;
cmakeFile << ")" << std::endl;
cmakeFile.close();
return true;
}
std::string CMakeListsGen::toUpper(const std::string &str)
{
std::string result = str;
for (auto &c : result) {
c = std::toupper(c);
}
return result;
}

View File

@ -0,0 +1,17 @@
#pragma once
#include "PublicDefine.h"
class CMakeListsGen
{
public:
/**
* @brief CMakeLists.txt文件
* @return
*/
static bool generateCMakeLists(const AllInterfaceData &interfaceData,
const std::string &idlPath, const std::string &configName);
private:
static std::string toUpper(const std::string &str);
};

View File

@ -0,0 +1,182 @@
#include "DDSInterfaceGen.h"
DDSInterfaceGen::DDSInterfaceGen(const std::string &idlPath)
{
IDLPath = fs::path(idlPath).parent_path().string();
IDLName = fs::path(idlPath).stem().string();
}
bool DDSInterfaceGen::generateDDSInterface(const AllInterfaceData &interfaceData)
{
std::string systemName = interfaceData.systemName;
std::string planeName = interfaceData.planeName;
for (const auto &ata : interfaceData.ataInterfaceData) {
std::string ataName = ata.ataName;
std::string interfaceFolderPath = IDLPath + "/" + ataName;
fs::create_directories(interfaceFolderPath);
std::string nameSpace = systemName + "::" + planeName + "::" + ataName;
for (const auto &structData : ata.structInterfaceData) {
std::string structName = structData.modelStructName;
generateDDSInterfaceHpp(nameSpace, structName, interfaceFolderPath,
structData.interfaceData);
generateDDSInterfaceCxx(nameSpace, structName, interfaceFolderPath,
structData.interfaceData);
}
}
return true;
}
bool DDSInterfaceGen::generateDDSInterfaceHpp(const std::string &nameSpace,
const std::string &structName,
const std::string &interfaceFolderPath,
const std::vector<InterfaceData> &interfaceData)
{
std::string className = structName + "_Interface";
std::string topicType = nameSpace + "::" + structName;
std::string hppFilePath = interfaceFolderPath + "/" + structName + ".hpp";
std::ofstream hppFile(hppFilePath);
// 1. 写入引用头文件
hppFile << "#pragma once" << std::endl;
hppFile << "#include \"../" << IDLName << "PubSubTypes.hpp\"" << std::endl;
hppFile << "#include \"XNCore/XNDDSInterface.h\"" << std::endl;
// 2. 写入命名空间
hppFile << "namespace " << nameSpace << std::endl;
hppFile << "{" << std::endl;
// 3. 写入类声明
hppFile << "class " << className << " final : public XNDDSInterface" << std::endl;
hppFile << "{" << std::endl;
hppFile << "public:" << std::endl;
// 4. 写入构造函数和析构函数
hppFile << "\t" << className << "();" << std::endl;
hppFile << "\t" << "virtual ~" << className << "();" << std::endl;
// 5. 写入初始化函数
hppFile << "\t"
<< "virtual void Initialize(XNFrameworkPtr framework, uint32_t modelId, uint32_t "
"DDS_type) override;"
<< std::endl;
// 6. 写入清空数据函数
hppFile << "\t" << "virtual void clearOutData() override;" << std::endl;
// 7. 写入发送数据函数
hppFile << "\t" << "virtual void sendOutData() override;" << std::endl;
// 8. 写入输入数据监听函数
hppFile << "\t" << "void inputDataListener(const " << topicType << " &input);" << std::endl;
// 9. 写入获取数据模板函数
hppFile << "\t" << "template <typename T>" << std::endl;
hppFile << "\t" << "void getData(T *model_data)" << std::endl;
hppFile << "\t" << "{" << std::endl;
hppFile << "\t\t" << "if(model_data == nullptr)" << std::endl;
hppFile << "\t\t\t" << "return;" << std::endl;
for (const auto &interface : interfaceData) {
hppFile << "\t\t" << "assign_value_get(data." << interface.interfaceName
<< "(), model_data->" << interface.interfaceName << ");" << std::endl;
}
hppFile << "\t" << "}" << std::endl;
// 10. 写入设置数据模板函数
hppFile << "\t" << "template <typename T>" << std::endl;
hppFile << "\t" << "void setData(T *model_data)" << std::endl;
hppFile << "\t" << "{" << std::endl;
hppFile << "\t\t" << "if(model_data == nullptr)" << std::endl;
hppFile << "\t\t\t" << "return;" << std::endl;
hppFile << "\t\t" << "clearOutData();" << std::endl;
for (const auto &interface : interfaceData) {
hppFile << "\t\t" << "assign_value_set(data." << interface.interfaceName
<< "(), model_data->" << structName << ");" << std::endl;
}
hppFile << "\t" << "}" << std::endl;
// 11. 写入私有成员变量
hppFile << "" << "private:" << std::endl;
hppFile << "\t" << topicType << " data;" << std::endl;
hppFile << "\t" << topicType << " out_data;" << std::endl;
// 12. 写入类声明结束
hppFile << "};" << std::endl;
// 13. 写入命名空间结束
hppFile << "}" << std::endl;
hppFile.close();
return true;
}
bool DDSInterfaceGen::generateDDSInterfaceCxx(const std::string &nameSpace,
const std::string &structName,
const std::string &interfaceFolderPath,
const std::vector<InterfaceData> &interfaceData)
{
std::string className = structName + "_Interface";
std::string topicType = nameSpace + "::" + structName;
std::string cxxFilePath = interfaceFolderPath + "/" + structName + ".cxx";
std::ofstream cxxFile(cxxFilePath);
// 1. 写入引用头文件
cxxFile << "#include \"" << structName << ".hpp\"" << std::endl;
// 2. 写入命名空间
cxxFile << "namespace " << nameSpace << std::endl;
cxxFile << "{" << std::endl;
// 3. 写入类构造函数实现
cxxFile << className << "::" << className << "()" << std::endl;
cxxFile << "{" << std::endl;
for (const auto &interface : interfaceData) {
cxxFile << "\t" << "MAP_DATA_FUNC(" << interface.interfaceName << ");" << std::endl;
}
//TODO 这里先待定
cxxFile << "\t" << "this->header[0] = 0xa6; // XNSim头0xa6" << std::endl;
cxxFile << "\t" << "this->header[1] = 0xc0; // 机型头0xc0表示C909" << std::endl;
cxxFile << "\t" << "this->header[2] = 0x04; // 章节头0x04表示ATA04" << std::endl;
cxxFile << "\t" << "this->header[3] = 0x01; // 模型头0x01表示GroundHandling" << std::endl;
cxxFile << "\t" << "this->header[4] = 0x00; // 结构体头0x00表示输入结构体" << std::endl;
cxxFile << "\t" << "this->header[5] = 0x00; // 数据方向0x00表示外部输入" << std::endl;
cxxFile << "\t" << "this->header[6] = 0x00; // 数据大小" << std::endl;
cxxFile << "\t" << "this->header[7] = 0x00; // 数据大小" << std::endl;
cxxFile << "}" << std::endl;
// 4. 写入类析构函数实现
cxxFile << className << "::~" << className << "()" << std::endl;
cxxFile << "{" << std::endl;
cxxFile << "}" << std::endl;
// 5. 写入类初始化函数实现
cxxFile << "void " << className
<< "::Initialize(XNFrameworkPtr framework, uint32_t modelId,uint32_t DDS_type)"
<< std::endl;
cxxFile << "{" << std::endl;
cxxFile << "\t" << "auto ddsManager = framework->GetDDSManager();" << std::endl;
cxxFile << "\t" << "if (!ddsManager) {" << std::endl;
cxxFile << "\t\t" << "LOG_ERROR(\"DDSManager is nullptr\");" << std::endl;
cxxFile << "\t\t" << "return;" << std::endl;
cxxFile << "\t" << "}" << std::endl;
cxxFile << "\t" << "if (DDS_type == 0) {" << std::endl; // 读取与发送都进行
cxxFile << "\t\t" << "dataWriter = ddsManager->RegisterPublisher<" << topicType
<< "PubSubType>(\"" << topicType << "\", modelId);" << std::endl;
cxxFile << "\t\t" << "ddsManager->RegisterSubscriber<" << topicType << "PubSubType>(\""
<< topicType << "\", modelId, std::bind(&" << className
<< "::inputDataListener, this, std::placeholders::_1));" << std::endl;
cxxFile << "\t" << "}" << std::endl;
cxxFile << "\t" << "else if (DDS_type == 1) {" << std::endl; // 只读取
cxxFile << "\t\t" << "ddsManager->RegisterSubscriber<" << topicType << "PubSubType>(\""
<< topicType << "\", modelId, std::bind(&" << className
<< "::inputDataListener, this, std::placeholders::_1));" << std::endl;
cxxFile << "\t" << "}" << std::endl;
cxxFile << "\t" << "else if (DDS_type == 2) {" << std::endl; // 只发送
cxxFile << "\t\t" << "dataWriter = ddsManager->RegisterPublisher<" << topicType
<< "PubSubType>(\"" << topicType << "\", modelId);" << std::endl;
cxxFile << "\t" << "}" << std::endl;
cxxFile << "}" << std::endl;
// 6. 写入清空数据函数实现
cxxFile << "void " << className << "::clearOutData()" << std::endl;
cxxFile << "{" << std::endl;
cxxFile << "\t" << "this->out_data = " << topicType << "();" << std::endl;
cxxFile << "}" << std::endl;
// 7. 写入发送数据函数实现
cxxFile << "void " << className << "::sendOutData()" << std::endl;
cxxFile << "{" << std::endl;
cxxFile << "\t" << "if (dataWriter) {" << std::endl;
cxxFile << "\t\t" << "dataWriter->write(&this->out_data);" << std::endl;
cxxFile << "\t" << "}" << std::endl;
cxxFile << "}" << std::endl;
// 8. 写入输入数据监听函数实现
cxxFile << "void " << className << "::inputDataListener(const " << topicType << " &input)"
<< std::endl;
cxxFile << "{" << std::endl;
cxxFile << "\t" << "this->data = input;" << std::endl;
cxxFile << "}" << std::endl;
// 9. 写入命名空间实现结束
cxxFile << "}" << std::endl;
cxxFile.close();
return true;
}

View File

@ -0,0 +1,22 @@
#pragma once
#include "PublicDefine.h"
class DDSInterfaceGen
{
public:
DDSInterfaceGen(const std::string &idlPath);
bool generateDDSInterface(const AllInterfaceData &interfaceData);
private:
bool generateDDSInterfaceHpp(const std::string &nameSpace, const std::string &structName,
const std::string &interfaceFolderPath,
const std::vector<InterfaceData> &interfaceData);
bool generateDDSInterfaceCxx(const std::string &nameSpace, const std::string &structName,
const std::string &interfaceFolderPath,
const std::vector<InterfaceData> &interfaceData);
private:
std::string IDLPath;
std::string IDLName;
};

View File

@ -0,0 +1,18 @@
#include "FastDDSGen.h"
bool FastDDSGen::generateFastDDSCode(std::string idlFilePath)
{
// 检查IDL文件是否存在
if (!fs::exists(idlFilePath)) {
return false;
}
std::string idlDirPath = fs::path(idlFilePath).parent_path().string();
// 构建fastddsgen命令
std::string command = "fastddsgen " + idlFilePath + " -replace" + " -d " + idlDirPath;
// 执行命令
int result = std::system(command.c_str());
return result == 0;
}

View File

@ -0,0 +1,16 @@
#pragma once
#include "PublicDefine.h"
/**
* @brief FastDDS代码生成类IDL文件生成FastDDS代码
*/
class FastDDSGen
{
public:
/**
* @brief FastDDS代码
* @return
*/
static bool generateFastDDSCode(std::string idlFilePath);
};

View File

@ -0,0 +1,99 @@
#include "GenIDL.h"
#include <fstream>
#include <sstream>
#include <algorithm>
#include <map>
#include <filesystem>
namespace fs = std::filesystem;
std::string GenIDL::idlFilePath = "";
bool GenIDL::createConfigDirectory(const std::string &configName)
{
std::string dirPath = GetXNCoreEnv() + "/IDL/" + configName;
try {
fs::create_directories(dirPath);
GenIDL::idlFilePath = dirPath + "/" + configName + ".idl";
return true;
} catch (const fs::filesystem_error &) {
GenIDL::idlFilePath = "";
return false;
}
}
std::string GenIDL::generateStructDefinition(const StructInterfaceData &structData)
{
std::stringstream ss;
// 生成结构体名称
std::string structName = structData.modelStructName;
// 生成结构体定义
ss << "\t\t\tstruct " << structName << "\n\t\t\t{\n";
// 生成成员变量
for (const auto &interface : structData.interfaceData) {
ss << "\t\t\t\t@optional ";
ss << interface.interfaceType << " ";
// 生成变量名
ss << interface.interfaceName;
// 如果是数组,添加数组维度
if (interface.interfaceIsArray) {
if (interface.interfaceArraySize_2 > 1) {
ss << "[" << interface.interfaceArraySize_1 << "]["
<< interface.interfaceArraySize_2 << "]";
} else {
ss << "[" << interface.interfaceArraySize_1 << "]";
}
}
ss << ";\n";
}
ss << "\t\t\t};\n";
return ss.str();
}
std::string GenIDL::generateIDLContent(const AllInterfaceData &interfaceData)
{
std::stringstream ss;
// 生成模块定义
ss << "module " << interfaceData.systemName << "\n{\n";
ss << "\tmodule " << interfaceData.planeName << "\n\t{\n";
// 遍历ATA数据
for (const auto &ataData : interfaceData.ataInterfaceData) {
ss << "\t\tmodule " << ataData.ataName << "\n\t\t{\n";
// 遍历结构体数据
for (const auto &structData : ataData.structInterfaceData) {
ss << generateStructDefinition(structData);
}
ss << "\t\t};\n";
}
ss << "\t};\n};\n";
return ss.str();
}
bool GenIDL::generateIDL(const AllInterfaceData &interfaceData)
{
if (GenIDL::idlFilePath.empty()) {
return false;
}
std::ofstream idlFile(GenIDL::idlFilePath);
if (!idlFile.is_open()) {
return false;
}
idlFile << generateIDLContent(interfaceData);
idlFile.close();
return true;
}

View File

@ -0,0 +1,46 @@
#pragma once
#include "GetInterfaceData.h"
/**
* @brief IDL文件生成类IDL文件
*/
class GenIDL
{
public:
/**
* @brief IDL文件
* @param interfaceData
* @return
*/
static bool generateIDL(const AllInterfaceData &interfaceData);
/**
* @brief IDL文件路径
* @return IDL文件完整路径
*/
static std::string &getIDLFilePath() { return idlFilePath; }
/**
* @brief
* @return
*/
static bool createConfigDirectory(const std::string &configName);
private:
/**
* @brief IDL文件内容
* @param interfaceData
* @return IDL文件内容
*/
static std::string generateIDLContent(const AllInterfaceData &interfaceData);
/**
* @brief
* @param structData
* @return
*/
static std::string generateStructDefinition(const StructInterfaceData &structData);
static std::string idlFilePath; ///< IDL文件完整路径
};

View File

@ -0,0 +1,144 @@
#include "GetInterfaceData.h"
/**
* @brief
* @param str
* @param defaultValue
* @return
*/
static int safe_stoi(const std::string &str, int defaultValue = 0)
{
if (str.empty()) {
return defaultValue;
}
try {
return std::stoi(str);
} catch (const std::exception &) {
return defaultValue;
}
}
/**
* @brief
* @param data
* @param argc
* @param argv
* @param azColName
* @return 0
*/
static int callback(void *data, int argc, char **argv, char **azColName)
{
if (!data || !argv || !azColName) {
return 0;
}
auto *allData = static_cast<AllInterfaceData *>(data);
static bool isFirstRecord = true;
std::string currentSystemName;
std::string currentPlaneName;
std::string currentATAName;
std::string currentModelStructName;
InterfaceData currentInterfaceData;
//先把数据都读出来
for (int i = 0; i < argc; i++) {
std::string colName = azColName[i];
std::string value = argv[i] ? argv[i] : "";
if (colName == "SystemName") {
currentSystemName = value;
} else if (colName == "PlaneName") {
currentPlaneName = value;
} else if (colName == "ATAName") {
currentATAName = value;
} else if (colName == "ModelStructName") {
currentModelStructName = value;
} else if (colName == "InterfaceName") {
currentInterfaceData.interfaceName = value;
} else if (colName == "InterfaceType") {
currentInterfaceData.interfaceType = value;
} else if (colName == "InterfaceIsArray") {
currentInterfaceData.interfaceIsArray = safe_stoi(value);
} else if (colName == "InterfaceArraySize_1") {
currentInterfaceData.interfaceArraySize_1 = safe_stoi(value);
} else if (colName == "InterfaceArraySize_2") {
currentInterfaceData.interfaceArraySize_2 = safe_stoi(value);
} else if (colName == "InterfaceNotes") {
currentInterfaceData.interfaceNotes = value;
}
}
// 如果是第一条记录,初始化系统名称和飞机名称
if (isFirstRecord) {
allData->systemName = currentSystemName;
allData->planeName = currentPlaneName;
isFirstRecord = false;
}
// 检查系统名称和飞机名称是否匹配
if (currentSystemName != allData->systemName || currentPlaneName != allData->planeName) {
return 0;
}
//检查ATA是否已存在
for (auto &ata : allData->ataInterfaceData) {
if (ata.ataName == currentATAName) {
for (auto &structData : ata.structInterfaceData) {
if (structData.modelStructName == currentModelStructName) {
for (auto &interfaceData : structData.interfaceData) {
if (interfaceData.interfaceName == currentInterfaceData.interfaceName) {
return 0;
}
}
structData.interfaceData.push_back(currentInterfaceData);
return 0;
}
}
StructInterfaceData structData;
structData.modelStructName = currentModelStructName;
structData.interfaceData.push_back(currentInterfaceData);
ata.structInterfaceData.push_back(structData);
return 0;
}
}
ATAInterfaceData ataData;
ataData.ataName = currentATAName;
StructInterfaceData structData;
structData.modelStructName = currentModelStructName;
structData.interfaceData.push_back(currentInterfaceData);
ataData.structInterfaceData.push_back(structData);
allData->ataInterfaceData.push_back(ataData);
return 0;
}
/**
* @brief
* @param tableName
* @return
*/
AllInterfaceData GetInterfaceData::getInterfaceData(const std::string &tableName,
std::string &errorMsg)
{
AllInterfaceData allData;
std::string dbPath = GetXNCoreEnv() + "/database/XNSim.db";
sqlite3 *db;
int rc = sqlite3_open(dbPath.c_str(), &db);
if (rc != SQLITE_OK) {
errorMsg = "无法打开数据库: " + std::string(sqlite3_errmsg(db));
return allData;
}
char *errMsg = nullptr;
std::string sql = "SELECT * FROM " + tableName;
rc = sqlite3_exec(db, sql.c_str(), callback, &allData, &errMsg);
if (rc != SQLITE_OK) {
std::string error = errMsg;
sqlite3_free(errMsg);
errorMsg = "SQL错误: " + error;
return allData;
}
sqlite3_close(db);
return allData;
}

View File

@ -0,0 +1,17 @@
#pragma once
#include "PublicDefine.h"
/**
* @brief SQLite数据库中读取接口信息
*/
class GetInterfaceData
{
public:
/**
* @brief
* @param tableName
* @return
*/
static AllInterfaceData getInterfaceData(const std::string &tableName, std::string &errorMsg);
};

View File

@ -0,0 +1,9 @@
#include "PublicDefine.h"
std::string GetXNCoreEnv()
{
const char *env_value = std::getenv("XNCore");
std::cout << "XNCore: " << env_value << std::endl;
return env_value ? env_value : "";
}

View File

@ -0,0 +1,45 @@
#pragma once
#include <string>
#include <vector>
#include <sqlite3.h>
#include <stdexcept>
#include <map>
#include <filesystem>
#include <cstdlib>
#include <fstream>
#include <cstring>
#include <iostream>
namespace fs = std::filesystem;
struct InterfaceData {
std::string interfaceName; ///< 接口名称
std::string interfaceType; ///< 接口类型
int interfaceIsArray; ///< 是否为数组
int interfaceArraySize_1; ///< 数组第一维大小
int interfaceArraySize_2; ///< 数组第二维大小
std::string interfaceNotes; ///< 接口注释
};
struct StructInterfaceData {
std::string modelStructName; ///< 模型结构名称
std::vector<InterfaceData> interfaceData;
};
struct ATAInterfaceData {
std::string ataName; ///< ATA名称
std::vector<StructInterfaceData> structInterfaceData;
};
struct AllInterfaceData {
std::string systemName; ///< 系统名称
std::string planeName; ///< 飞机名称
std::vector<ATAInterfaceData> ataInterfaceData;
};
/**
* @brief XNCore环境变量
* @return std::string XNCore环境变量的值
*/
std::string GetXNCoreEnv();

View File

@ -0,0 +1,66 @@
#include "XNInterfaceGenServer.h"
#include "GetInterfaceData.h"
#include "GenIDL.h"
#include "FastDDSGen.h"
#include "DDSInterfaceGen.h"
#include "CMakeListsGen.h"
int XNInterfaceGen(const char *tableName, const int tableNameSize, const char *configName,
const int configNameSize, const char *errorMsg, const int errorMsgSize)
{
std::string errorMsgStr;
// 1. 从数据库获取接口数据
AllInterfaceData interfaceData = GetInterfaceData::getInterfaceData(tableName, errorMsgStr);
if (!errorMsgStr.empty()) {
memcpy((void *)errorMsg, errorMsgStr.c_str(), errorMsgSize);
return -1;
}
// 2. 创建构型目录
bool ret = GenIDL::createConfigDirectory(configName);
if (!ret) {
memcpy((void *)errorMsg, "Create config directory failed", errorMsgSize);
return -1;
}
// 3. 生成IDL文件
ret = GenIDL::generateIDL(interfaceData);
if (!ret) {
memcpy((void *)errorMsg, "Generate IDL failed", errorMsgSize);
return -1;
}
// 4. 生成FastDDS代码
ret = FastDDSGen::generateFastDDSCode(GenIDL::getIDLFilePath());
if (!ret) {
memcpy((void *)errorMsg, "Generate FastDDS code failed", errorMsgSize);
return -1;
}
// 5. 生成DDS接口
DDSInterfaceGen ddsInterfaceGen(GenIDL::getIDLFilePath());
ret = ddsInterfaceGen.generateDDSInterface(interfaceData);
if (!ret) {
memcpy((void *)errorMsg, "Generate DDS interface failed", errorMsgSize);
return -1;
}
// 6. 生成CMakeLists.txt文件
ret = CMakeListsGen::generateCMakeLists(interfaceData, GenIDL::getIDLFilePath(), configName);
if (!ret) {
memcpy((void *)errorMsg, "Generate CMakeLists.txt failed", errorMsgSize);
return -1;
}
// 7. 执行CMake编译和安装
std::string idlDirPath = fs::path(GenIDL::getIDLFilePath()).parent_path().string();
std::string buildCmd =
"cd " + idlDirPath + " && mkdir -p build && cd build && cmake .. && make && make install";
int buildRet = system(buildCmd.c_str());
if (buildRet != 0) {
memcpy((void *)errorMsg, "CMake build or install failed", errorMsgSize);
return -1;
}
return 0;
}

View File

@ -0,0 +1,10 @@
#ifndef XN_INTERFACE_GEN_SERVER_H
#define XN_INTERFACE_GEN_SERVER_H
#include "XNInterfaceGenServer_global.h"
extern "C" XNIGS_EXPORT int XNInterfaceGen(const char *tableName, const int tableNameSize,
const char *configName, const int configNameSize,
const char *errorMsg, const int errorMsgSize);
#endif // XN_INTERFACE_GEN_SERVER_H

View File

@ -0,0 +1,10 @@
#ifndef XNINTERFACEGENSERVER_GLOBAL_H
#define XNINTERFACEGENSERVER_GLOBAL_H
#ifdef XNINTERFACEGENSERVER_LIBRARY
# define XNIGS_EXPORT __attribute__((visibility("default")))
#else
# define XNIGS_EXPORT __attribute__((visibility("default")))
#endif
#endif // XNINTERFACEGENSERVER_GLOBAL_H

View File

@ -0,0 +1,49 @@
cmake_minimum_required(VERSION 3.10)
project(XNInterfaceGenTest)
# C++
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
#
if(DEFINED ENV{XNCore})
set(XNCore_PATH $ENV{XNCore})
else()
message(FATAL_ERROR "Environment variable XNCore is not set.")
endif()
#
add_executable(XNInterfaceGenTest XNInterfaceGenTest.cpp)
#
target_include_directories(XNInterfaceGenTest PRIVATE
${CMAKE_SOURCE_DIR}/.. #
)
#
set(LIB_SEARCH_PATHS
${XNCore_PATH}/lib
)
#
find_library(XNINTERFACE_GEN_SERVER_LIB
NAMES XNInterfaceGenServer
PATHS ${LIB_SEARCH_PATHS}
NO_DEFAULT_PATH
REQUIRED
)
message(STATUS "Found library at: ${XNINTERFACE_GEN_SERVER_LIB}")
if(NOT XNINTERFACE_GEN_SERVER_LIB)
message(FATAL_ERROR "XNInterfaceGenServer library not found in ${LIB_SEARCH_PATHS}")
endif()
#
target_link_libraries(XNInterfaceGenTest PRIVATE ${XNINTERFACE_GEN_SERVER_LIB})
#
set_target_properties(XNInterfaceGenTest PROPERTIES
INSTALL_RPATH "${XNCore_PATH}/lib"
BUILD_WITH_INSTALL_RPATH TRUE
)

View File

@ -0,0 +1,38 @@
/**
* @file test_XNInterfaceGen.cpp
* @brief XNInterfaceGen动态库的测试程序
*/
#include <iostream>
#include <string>
#include <cstring>
// 声明外部函数
extern "C"
{
int XNInterfaceGen(const char *tableName, const int tableNameSize, const char *configName,
const int configNameSize, const char *errorMsg, const int errorMsgSize);
}
int main()
{
// 测试参数
const char *tableName = "DataInterface_1";
const char *configName = "C909_V1";
char errorMsg[1024] = {0}; // 错误信息缓冲区
std::cout << "开始测试XNInterfaceGen..." << std::endl;
// 调用XNInterfaceGen函数
int ret = XNInterfaceGen(tableName, strlen(tableName), configName, strlen(configName), errorMsg,
sizeof(errorMsg));
// 检查结果
if (ret == 0) {
std::cout << "测试成功!接口生成完成。" << std::endl;
} else {
std::cout << "测试失败!错误信息: " << errorMsg << std::endl;
}
return ret;
}