From 1cb2ae14194f7a16be3a1760c9c98ad6e66ca750 Mon Sep 17 00:00:00 2001 From: jinchao <383321154@qq.com> Date: Thu, 22 May 2025 08:53:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=B0=E6=93=8D=E6=A8=A1=E5=9E=8B=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Release/Models/XNGroundHandling.idl | 169 +-- Release/include/XNCore/XNDDSInterface.h | 148 ++- Release/include/XNCore/XNTypeTraits.h | 21 +- XNCore/XNDDSInterface.cpp | 100 +- XNCore/XNDDSInterface.h | 146 ++- XNCore/XNTypeTraits.h | 21 +- .../XNGroundHandling/.vscode/settings.json | 3 +- XNModels/XNGroundHandling/CMakeLists.txt | 6 - .../XNGroundHandling/CMakeLists.txt | 1 - .../XNGroundHandling/XNGroundHandling.cpp | 383 +------ .../XNGroundHandling/XNGroundHandling.h | 14 +- .../XNGroundHandling_global.h | 6 +- .../XNGroundHandling/XNGroundHandling_p.h | 5 + .../XNGroundHandlingInterface/CMakeLists.txt | 1 - .../XNGroundHandling.hpp | 10 +- .../XNGroundHandling.idl | 169 +-- .../XNGroundHandlingCdrAux.hpp | 24 +- .../XNGroundHandlingCdrAux.ipp | 54 +- .../XNGroundHandlingInterface.cxx | 292 +++-- .../XNGroundHandlingInterface.hpp | 368 ++++--- .../XNGroundHandlingPubSubTypes.cxx | 993 +++++++++--------- .../XNGroundHandlingPubSubTypes.hpp | 437 ++++---- .../XNGroundHandlingTypeObjectSupport.cxx | 21 +- .../XNGroundHandlingTypeObjectSupport.hpp | 9 +- 24 files changed, 1724 insertions(+), 1677 deletions(-) diff --git a/Release/Models/XNGroundHandling.idl b/Release/Models/XNGroundHandling.idl index 14ac426..f4a816f 100644 --- a/Release/Models/XNGroundHandling.idl +++ b/Release/Models/XNGroundHandling.idl @@ -1,90 +1,93 @@ module XNSim { - module ATA04 + module C909 { - struct GroundHandling_input + module ATA04 { - @optional char l_04_i_gdcomac_frz_l1; - @optional char l_04_i_gdcomac_chocks_l1; - @optional double l_04_i_gdcomac_alt_agl_f8; - @optional char l_04_i_gdcomac_frzflt_l1; - @optional double l_04_i_gdcomac_p_f8; - @optional double l_04_i_gdcomac_q_f8; - @optional double l_04_i_gdcomac_r_f8; - @optional double l_04_i_gdcomac_ug_f8; - @optional double l_04_i_gdcomac_vg_f8; - @optional double l_04_i_gdcomac_wg_f8; - @optional double l_04_i_gdcomac_blcg_f8; - @optional double l_04_i_gdcomac_bscg_f8; - @optional double l_04_i_gdcomac_wlcg_f8; - @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_gear_f8[3]; - @optional double l_04_i_gdcomac_gsteer_f8[10]; - @optional double l_04_i_gdcomac_tire_pres_f8[3][2]; - @optional char l_04_i_gdcomac_onjax_l1; - @optional double l_04_i_gdcomac_contdep_f8[7]; - @optional double l_04_i_gdcomac_thetag_f8; - @optional double l_04_i_gdcomac_phig_f8; - @optional long l_04_i_gdcomac_rwyrgh_i2; - @optional double l_04_i_gdcomac_rwyhdg_f8; - @optional char l_04_i_gdcomac_reset_braketemp_l1; - @optional char l_04_i_gdcomac_reset_tirepress_l1; - @optional double l_04_i_gdcomac_temp_c_f8; - @optional double l_04_i_gdcomac_brake_temp_f8[3][2]; - @optional char l_04_i_gdcomac_tire_tburst_l1[3][2]; - @optional char l_04_i_gdcomac_tire_tflat_l1[3][2]; - @optional char l_04_i_gdcomac_brk_reset_tpres_l1; - @optional double l_04_i_gdcomac_rcon_ci_f8[14]; - @optional double l_04_i_gdcomac_pb_towforce_f8; - @optional long l_04_i_gdcomac_gsteer_state_i4; - @optional char l_04_i_gdcomac_trim_active_l1; - @optional double l_04_i_gdcomac_phi_deg_f8; - @optional double l_04_i_gdcomac_theta_deg_f8; - @optional double l_04_i_gdcomac_psi_deg_f8; - @optional char l_04_i_gdcomac_resetint_l1; - }; - struct GroundHandling_output - { - @optional char l_04_o_gdcomac_frz_l1; - @optional char l_04_o_gdcomac_ac_on_ground_l1; - @optional double l_04_o_gdcomac_ac_stationary_f8; - @optional double l_04_o_gdcomac_alt_tire_f8; - @optional double l_04_o_gdcomac_zcg_to_tire_f8; - @optional double l_04_o_gdcomac_fxb_f8; - @optional double l_04_o_gdcomac_fyb_f8; - @optional double l_04_o_gdcomac_fzb_f8; - @optional double l_04_o_gdcomac_mxb_f8; - @optional double l_04_o_gdcomac_myb_f8; - @optional double l_04_o_gdcomac_mzb_f8; - @optional double l_04_o_gdcomac_fygs_f8[3]; - @optional double l_04_o_gdcomac_mzgs_f8[3]; - @optional double l_04_o_gdcomac_mu_f8[3]; - @optional double l_04_o_gdcomac_dstroke_f8[3]; - @optional double l_04_o_gdcomac_sr_f8[3][2]; - @optional double l_04_o_gdcomac_sy_f8[3][2]; - @optional double l_04_o_gdcomac_sx_f8[3][2]; - @optional double l_04_o_gdcomac_xft_f8[3]; - @optional double l_04_o_gdcomac_yft_f8[3]; - @optional double l_04_o_gdcomac_zft_f8[3]; - @optional double l_04_o_gdcomac_distngrxcg_f8; - @optional double l_04_o_gdcomac_distmgrxcg_f8; - @optional double l_04_o_gdcomac_distmgrzcg_f8; - @optional double l_04_o_gdcomac_tire_vel_f8[3][2]; - @optional char l_04_o_gdcomac_tire_burst_l1[3][2]; - @optional double l_04_o_gdcomac_tire_temp_f8[3][2]; - @optional char l_04_o_gdcomac_wow_l1; - @optional double l_04_o_gdcomac_utirew_f8[3][2]; - @optional double l_04_o_gdcomac_vtirew_f8[3][2]; - @optional double l_04_o_gdcomac_whl_omega_f8[3][2]; - @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_nd_f8[3]; - @optional double l_04_o_gdcomac_vczt_f8[3][2]; - }; - struct GroundHandling_heartbeat - { - long groundhandling_model_heartbeat; + struct GroundHandling_input + { + @optional char l_04_i_gdcomac_frz_l1; + @optional char l_04_i_gdcomac_chocks_l1; + @optional double l_04_i_gdcomac_alt_agl_f8; + @optional char l_04_i_gdcomac_frzflt_l1; + @optional double l_04_i_gdcomac_p_f8; + @optional double l_04_i_gdcomac_q_f8; + @optional double l_04_i_gdcomac_r_f8; + @optional double l_04_i_gdcomac_ug_f8; + @optional double l_04_i_gdcomac_vg_f8; + @optional double l_04_i_gdcomac_wg_f8; + @optional double l_04_i_gdcomac_blcg_f8; + @optional double l_04_i_gdcomac_bscg_f8; + @optional double l_04_i_gdcomac_wlcg_f8; + @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_gear_f8[3]; + @optional double l_04_i_gdcomac_gsteer_f8[10]; + @optional double l_04_i_gdcomac_tire_pres_f8[3][2]; + @optional char l_04_i_gdcomac_onjax_l1; + @optional double l_04_i_gdcomac_contdep_f8[7]; + @optional double l_04_i_gdcomac_thetag_f8; + @optional double l_04_i_gdcomac_phig_f8; + @optional long l_04_i_gdcomac_rwyrgh_i2; + @optional double l_04_i_gdcomac_rwyhdg_f8; + @optional char l_04_i_gdcomac_reset_braketemp_l1; + @optional char l_04_i_gdcomac_reset_tirepress_l1; + @optional double l_04_i_gdcomac_temp_c_f8; + @optional double l_04_i_gdcomac_brake_temp_f8[3][2]; + @optional char l_04_i_gdcomac_tire_tburst_l1[3][2]; + @optional char l_04_i_gdcomac_tire_tflat_l1[3][2]; + @optional char l_04_i_gdcomac_brk_reset_tpres_l1; + @optional double l_04_i_gdcomac_rcon_ci_f8[14]; + @optional double l_04_i_gdcomac_pb_towforce_f8; + @optional long l_04_i_gdcomac_gsteer_state_i4; + @optional char l_04_i_gdcomac_trim_active_l1; + @optional double l_04_i_gdcomac_phi_deg_f8; + @optional double l_04_i_gdcomac_theta_deg_f8; + @optional double l_04_i_gdcomac_psi_deg_f8; + @optional char l_04_i_gdcomac_resetint_l1; + }; + struct GroundHandling_output + { + @optional char l_04_o_gdcomac_frz_l1; + @optional char l_04_o_gdcomac_ac_on_ground_l1; + @optional double l_04_o_gdcomac_ac_stationary_f8; + @optional double l_04_o_gdcomac_alt_tire_f8; + @optional double l_04_o_gdcomac_zcg_to_tire_f8; + @optional double l_04_o_gdcomac_fxb_f8; + @optional double l_04_o_gdcomac_fyb_f8; + @optional double l_04_o_gdcomac_fzb_f8; + @optional double l_04_o_gdcomac_mxb_f8; + @optional double l_04_o_gdcomac_myb_f8; + @optional double l_04_o_gdcomac_mzb_f8; + @optional double l_04_o_gdcomac_fygs_f8[3]; + @optional double l_04_o_gdcomac_mzgs_f8[3]; + @optional double l_04_o_gdcomac_mu_f8[3]; + @optional double l_04_o_gdcomac_dstroke_f8[3]; + @optional double l_04_o_gdcomac_sr_f8[3][2]; + @optional double l_04_o_gdcomac_sy_f8[3][2]; + @optional double l_04_o_gdcomac_sx_f8[3][2]; + @optional double l_04_o_gdcomac_xft_f8[3]; + @optional double l_04_o_gdcomac_yft_f8[3]; + @optional double l_04_o_gdcomac_zft_f8[3]; + @optional double l_04_o_gdcomac_distngrxcg_f8; + @optional double l_04_o_gdcomac_distmgrxcg_f8; + @optional double l_04_o_gdcomac_distmgrzcg_f8; + @optional double l_04_o_gdcomac_tire_vel_f8[3][2]; + @optional char l_04_o_gdcomac_tire_burst_l1[3][2]; + @optional double l_04_o_gdcomac_tire_temp_f8[3][2]; + @optional char l_04_o_gdcomac_wow_l1; + @optional double l_04_o_gdcomac_utirew_f8[3][2]; + @optional double l_04_o_gdcomac_vtirew_f8[3][2]; + @optional double l_04_o_gdcomac_whl_omega_f8[3][2]; + @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_nd_f8[3]; + @optional double l_04_o_gdcomac_vczt_f8[3][2]; + }; + struct GroundHandling_heartbeat + { + @optional long groundhandling_model_heartbeat; + }; }; }; }; diff --git a/Release/include/XNCore/XNDDSInterface.h b/Release/include/XNCore/XNDDSInterface.h index 21ba78c..a9e81f6 100644 --- a/Release/include/XNCore/XNDDSInterface.h +++ b/Release/include/XNCore/XNDDSInterface.h @@ -1,6 +1,7 @@ #pragma once -#include "XNObject.h" +#include "XNFramework.h" +#include "XNDDSManager.h" #include "XNByteArray.h" #include "XNTypeTraits.h" #include @@ -19,7 +20,7 @@ public: * @brief 初始化 * @param framework: 框架 */ - virtual void Initialize(XNFrameworkPtr framework) = 0; + virtual void Initialize(XNFrameworkPtr framework, uint32_t modelID) = 0; /** * @brief 获取该接口的UDP包 @@ -28,13 +29,17 @@ public: XNByteArray getUDPPackage(); /** - * @brief JSON前端获取指定变量的数据 - * @param varName: 变量名 - * @param nameSize: 变量名大小 - * @param varData: 数据 - * @param dataSize: 数据大小 + * @brief 批量获取指定变量的数据 + * @param varNames: 变量名列表 + * @return: 变量名到数据的映射 */ - void getData(const char *varName, const size_t nameSize, char *varData, size_t dataSize); + std::unordered_map getStringData(std::vector varNames); + + /** + * @brief 批量设置指定变量的数据 + * @param data: 变量名到数据的映射 + */ + void setDataByString(std::unordered_map data); protected: /** @@ -153,7 +158,7 @@ protected: } else { return std::to_string(0); } - } else if constexpr (std::is_same_v) { + } else if constexpr (is_std_array_v) { if (data) { return getStringFromStdArray(data.value()); } else { @@ -164,6 +169,34 @@ protected: return std::string(); } + /** + * @brief 通过字符串数据设置指定变量,用于JSON前端 + * @param data: 数据 + * @param value: 字符串数据 + */ + template + void setDataFromString(eprosima::fastcdr::optional &data, const std::string &value) + { + if constexpr (std::is_arithmetic_v) { + if constexpr (std::is_same_v || std::is_same_v) { + data = std::stod(value); + } else { + data = std::stoll(value); + } + } else if constexpr (is_std_array_v) { + // 解析输入字符串 + std::stringstream ss(value); + std::string item; + std::vector items; + while (std::getline(ss, item, ',')) { + items.push_back(item); + } + T temp; + setStdArrayFromString(temp, items, 0); + data = temp; + } + } + /** * @brief 获取指定数组变量的字符串数据,用于JSON前端 * @param data: 数据 @@ -185,13 +218,69 @@ protected: return ss.str(); } -private: /** - * @brief 通过变量名获取指定的数据 - * @param varName: 变量名 - * @return: 数据(字符串格式) + * @brief 通过字符串数据设置指定数组变量,用于JSON前端 + * @param data: 数据 + * @param value: 字符串数据,格式为"数字,数字,..." + * @param start_pos: 当前数组在输入字符串中的起始位置 + * @return 处理完当前数组后,下一个数组的起始位置 + * @throw std::runtime_error: 当输入数据格式不正确时抛出异常 */ - std::string getData(const std::string &varName); + template + size_t setStdArrayFromString(std::array &data, const std::vector &value, + size_t start_pos = 0) + { + // 递归处理每个元素 + for (std::size_t i = 0; i < N; ++i) { + try { + if constexpr (std::is_arithmetic_v) { + // 对于基本类型,直接转换 + if constexpr (std::is_same_v || std::is_same_v) { + data[i] = static_cast(std::stod(value[start_pos + i])); + } else { + data[i] = static_cast(std::stoll(value[start_pos + i])); + } + } else if constexpr (is_std_array_v) { + // 对于嵌套数组,递归处理 + start_pos = setStdArrayFromString(data[i], value, start_pos + i); + } else { + static_assert(std::is_arithmetic_v || is_std_array_v, + "Type must be arithmetic or std::array"); + } + } catch (const std::exception &e) { + throw std::runtime_error("Error parsing element " + std::to_string(i) + ": " + + e.what()); + } + } + return start_pos + N; + } + + template + void assign_value_get(eprosima::fastcdr::optional &data, T2 &model_data) + { + if (data) { + auto temp = data.value(); + if constexpr (std::is_arithmetic_v) { + model_data = temp; + } else if constexpr (is_std_array_v) { + size_t arraySize = array_size_v; + for (size_t i = 0; i < arraySize; ++i) { + auto temp2 = temp[i]; + if constexpr (std::is_arithmetic_v) { + model_data[i] = temp2; + } else if constexpr (is_std_array_v) { + size_t arraySize2 = array_size_v; + for (size_t j = 0; j < arraySize2; ++j) { + model_data[i][j] = temp2[j]; + } + } + } + } + } + } + + virtual void clearOutData() {} + virtual void sendOutData() {} protected: struct ByteArrayFunc { @@ -200,15 +289,20 @@ protected: }; std::unordered_map> getDataFunction; + std::unordered_map> setDataFunction; std::vector getByteArrayFunction; std::unordered_map> setByteArrayFunction; std::mutex mutex; uint8_t header[5]{}; // 固定大小的头部 - size_t headerSize = 0; + size_t headerSize = 5; + FAST_DDS_MACRO::DataWriter *dataWriter; }; #define MAP_DATA_FUNC(NAME) \ getDataFunction[#NAME] = [this]() { return getString(data.NAME()); }; \ + setDataFunction[#NAME] = [this](std::string value) { \ + setDataFromString(out_data.NAME(), value); \ + }; \ getByteArrayFunction.push_back( \ {[this]() { return getByteArray(data.NAME()); }, getTypeSize()}); \ setByteArrayFunction[#NAME] = [this](XNByteArray byteArray) { \ @@ -220,13 +314,13 @@ protected: auto temp = data.NAME().value(); \ if constexpr (std::is_arithmetic_v) { \ model_data->NAME = temp; \ - } else if constexpr (std::is_std_array_v) { \ - size_t arraySize = std::tuple_size::value; \ + } else if constexpr (is_std_array_v) { \ + size_t arraySize = array_size_v; \ for (size_t i = 0; i < arraySize; ++i) { \ if constexpr (std::is_arithmetic_v) { \ model_data->NAME[i] = temp[i]; \ - } else if constexpr (std::is_std_array_v) { \ - size_t arraySize2 = std::tuple_size::value; \ + } else if constexpr (is_std_array_v) { \ + size_t arraySize2 = array_size_v; \ for (size_t j = 0; j < arraySize2; ++j) { \ model_data->NAME[i][j] = temp[i][j]; \ } \ @@ -236,19 +330,19 @@ protected: } #define ASSIGN_VALUE_SET(NAME) \ - if constexpr (std::is_arithmetic_v) { \ - data.NAME(model_data->NAME); \ - } else if constexpr (std::is_std_array_v) { \ - using thisType = typename decltype(data.NAME())::type; \ + if constexpr (std::is_arithmetic_v) { \ + out_data.NAME(model_data->NAME); \ + } else if constexpr (is_std_array_v) { \ + using thisType = typename decltype(out_data.NAME())::type; \ thisType temp; \ - size_t arraySize1 = std::tuple_size::value; \ + size_t arraySize1 = array_size_v; \ using subType = thisType::value_type; \ if constexpr (std::is_arithmetic_v) { \ for (size_t i = 0; i < arraySize1; ++i) { \ temp[i] = model_data->NAME[i]; \ } \ - } else if constexpr (std::is_std_array_v) { \ - size_t arraySize2 = std::tuple_size::value; \ + } else if constexpr (is_std_array_v) { \ + size_t arraySize2 = array_size_v; \ std::array temp; \ for (size_t i = 0; i < arraySize1; ++i) { \ for (size_t j = 0; j < arraySize2; ++j) { \ @@ -256,5 +350,5 @@ protected: } \ } \ } \ - data.NAME(temp); \ + out_data.NAME(temp); \ } diff --git a/Release/include/XNCore/XNTypeTraits.h b/Release/include/XNCore/XNTypeTraits.h index 2be257d..ebd2671 100644 --- a/Release/include/XNCore/XNTypeTraits.h +++ b/Release/include/XNCore/XNTypeTraits.h @@ -15,14 +15,31 @@ struct is_std_array> : std::true_type { template inline constexpr bool is_std_array_v = is_std_array::value; +/** + * @brief 获取类型的数组大小 + * @tparam T 要检查的类型 + * @return 如果是std::array,返回其大小;否则返回1 + */ +template +struct array_size : std::integral_constant { +}; + +template +struct array_size> : std::integral_constant { +}; + +// 变量模板简化使用 +template +inline constexpr std::size_t array_size_v = array_size::value; + // 获取类型大小的辅助函数 template constexpr size_t getTypeSize() { if constexpr (is_std_array_v) { // 对于std::array,计算所有元素的总大小 - return getTypeSize() * std::tuple_size::value; + return getTypeSize() * array_size_v; } else { return sizeof(T); } -} \ No newline at end of file +} diff --git a/XNCore/XNDDSInterface.cpp b/XNCore/XNDDSInterface.cpp index 839d46d..9b8fbc6 100644 --- a/XNCore/XNDDSInterface.cpp +++ b/XNCore/XNDDSInterface.cpp @@ -4,23 +4,22 @@ using json = nlohmann::json; -void XNDDSInterface::getUDPPackage(uint8_t *buffer, size_t bufferSize) +XNByteArray XNDDSInterface::getUDPPackage() { - if (bufferSize < MAX_UDP_PACKET_SIZE) - return; + XNByteArray result; size_t currentPos = 0; // 复制头部 if (headerSize >= 5) { - std::memcpy(buffer, header, 5); + result.append(header, 5); currentPos = 5; } // 复制数据 for (auto func : getByteArrayFunction) { if (currentPos + func.size <= MAX_UDP_PACKET_SIZE) { - func.func(buffer + currentPos, func.size); + result.append(func.func()); currentPos += func.size; } else { break; // 超出最大包大小 @@ -29,79 +28,38 @@ void XNDDSInterface::getUDPPackage(uint8_t *buffer, size_t bufferSize) // 更新包大小 if (currentPos >= 5) { - buffer[4] = static_cast(currentPos); + result[4] = static_cast(currentPos); } + + return result; } -std::string XNDDSInterface::getData(const std::string &varName) +std::unordered_map +XNDDSInterface::getStringData(std::vector varNames) { - int index1 = -1; - int index2 = -1; - std::string trueVarName = varName; - - size_t startPos = varName.find('['); - if (startPos != std::string::npos) { - size_t midPos = varName.find("][", startPos); - size_t endPos = varName.find_last_of(']'); - - if (midPos != std::string::npos) { - try { - index1 = std::stoi(varName.substr(startPos + 1, midPos - startPos - 1)); - index2 = std::stoi(varName.substr(midPos + 2, endPos - midPos - 2)); - } catch (...) { - std::cerr << "无法解析数组索引: " << varName << std::endl; - index1 = 0; - index2 = 0; - } - } else if (endPos != std::string::npos) { - try { - index1 = std::stoi(varName.substr(startPos + 1, endPos - startPos - 1)); - } catch (...) { - std::cerr << "无法解析数组索引: " << varName << std::endl; - index1 = 0; - } - } - trueVarName = varName.substr(0, startPos); - } - - auto it = getDataFunction.find(trueVarName); - if (it == getDataFunction.end()) { - return std::string(); - } + std::unordered_map result; std::lock_guard lock(mutex); - std::string result = it->second(); - - if (index1 < 0) { - return result; + for (const auto &varName : varNames) { + auto it = getDataFunction.find(varName); + if (it == getDataFunction.end()) { + continue; + } + result[varName] = it->second(); } - std::vector list; - std::stringstream ss(result); - std::string item; - while (std::getline(ss, item, ',')) { - list.push_back(item); - } + return result; +} - if (index1 >= static_cast(list.size())) { - std::cerr << "数组索引超出范围: " << varName << std::endl; - return std::string(); +void XNDDSInterface::setDataByString(std::unordered_map data) +{ + clearOutData(); + for (const auto &[varName, value] : data) { + auto it = setDataFunction.find(varName); + if (it == setDataFunction.end()) { + continue; + } + it->second(value); } - - if (index2 < 0) { - return list[index1]; - } - - std::vector list2; - std::stringstream ss2(list[index1]); - while (std::getline(ss2, item, ' ')) { - list2.push_back(item); - } - - if (index2 >= static_cast(list2.size())) { - std::cerr << "数组索引超出范围: " << varName << std::endl; - return std::string(); - } - - return list2[index2]; -} \ No newline at end of file + sendOutData(); +} diff --git a/XNCore/XNDDSInterface.h b/XNCore/XNDDSInterface.h index 4db4a7a..a9e81f6 100644 --- a/XNCore/XNDDSInterface.h +++ b/XNCore/XNDDSInterface.h @@ -1,6 +1,7 @@ #pragma once -#include "XNObject.h" +#include "XNFramework.h" +#include "XNDDSManager.h" #include "XNByteArray.h" #include "XNTypeTraits.h" #include @@ -19,7 +20,7 @@ public: * @brief 初始化 * @param framework: 框架 */ - virtual void Initialize(XNFrameworkPtr framework) = 0; + virtual void Initialize(XNFrameworkPtr framework, uint32_t modelID) = 0; /** * @brief 获取该接口的UDP包 @@ -28,13 +29,17 @@ public: XNByteArray getUDPPackage(); /** - * @brief JSON前端获取指定变量的数据 - * @param varName: 变量名 - * @param nameSize: 变量名大小 - * @param varData: 数据 - * @param dataSize: 数据大小 + * @brief 批量获取指定变量的数据 + * @param varNames: 变量名列表 + * @return: 变量名到数据的映射 */ - void getData(const char *varName, const size_t nameSize, char *varData, size_t dataSize); + std::unordered_map getStringData(std::vector varNames); + + /** + * @brief 批量设置指定变量的数据 + * @param data: 变量名到数据的映射 + */ + void setDataByString(std::unordered_map data); protected: /** @@ -153,7 +158,7 @@ protected: } else { return std::to_string(0); } - } else if constexpr (std::is_same_v) { + } else if constexpr (is_std_array_v) { if (data) { return getStringFromStdArray(data.value()); } else { @@ -164,6 +169,34 @@ protected: return std::string(); } + /** + * @brief 通过字符串数据设置指定变量,用于JSON前端 + * @param data: 数据 + * @param value: 字符串数据 + */ + template + void setDataFromString(eprosima::fastcdr::optional &data, const std::string &value) + { + if constexpr (std::is_arithmetic_v) { + if constexpr (std::is_same_v || std::is_same_v) { + data = std::stod(value); + } else { + data = std::stoll(value); + } + } else if constexpr (is_std_array_v) { + // 解析输入字符串 + std::stringstream ss(value); + std::string item; + std::vector items; + while (std::getline(ss, item, ',')) { + items.push_back(item); + } + T temp; + setStdArrayFromString(temp, items, 0); + data = temp; + } + } + /** * @brief 获取指定数组变量的字符串数据,用于JSON前端 * @param data: 数据 @@ -185,13 +218,69 @@ protected: return ss.str(); } -private: /** - * @brief 通过变量名获取指定的数据 - * @param varName: 变量名 - * @return: 数据(字符串格式) + * @brief 通过字符串数据设置指定数组变量,用于JSON前端 + * @param data: 数据 + * @param value: 字符串数据,格式为"数字,数字,..." + * @param start_pos: 当前数组在输入字符串中的起始位置 + * @return 处理完当前数组后,下一个数组的起始位置 + * @throw std::runtime_error: 当输入数据格式不正确时抛出异常 */ - std::string getData(const std::string &varName); + template + size_t setStdArrayFromString(std::array &data, const std::vector &value, + size_t start_pos = 0) + { + // 递归处理每个元素 + for (std::size_t i = 0; i < N; ++i) { + try { + if constexpr (std::is_arithmetic_v) { + // 对于基本类型,直接转换 + if constexpr (std::is_same_v || std::is_same_v) { + data[i] = static_cast(std::stod(value[start_pos + i])); + } else { + data[i] = static_cast(std::stoll(value[start_pos + i])); + } + } else if constexpr (is_std_array_v) { + // 对于嵌套数组,递归处理 + start_pos = setStdArrayFromString(data[i], value, start_pos + i); + } else { + static_assert(std::is_arithmetic_v || is_std_array_v, + "Type must be arithmetic or std::array"); + } + } catch (const std::exception &e) { + throw std::runtime_error("Error parsing element " + std::to_string(i) + ": " + + e.what()); + } + } + return start_pos + N; + } + + template + void assign_value_get(eprosima::fastcdr::optional &data, T2 &model_data) + { + if (data) { + auto temp = data.value(); + if constexpr (std::is_arithmetic_v) { + model_data = temp; + } else if constexpr (is_std_array_v) { + size_t arraySize = array_size_v; + for (size_t i = 0; i < arraySize; ++i) { + auto temp2 = temp[i]; + if constexpr (std::is_arithmetic_v) { + model_data[i] = temp2; + } else if constexpr (is_std_array_v) { + size_t arraySize2 = array_size_v; + for (size_t j = 0; j < arraySize2; ++j) { + model_data[i][j] = temp2[j]; + } + } + } + } + } + } + + virtual void clearOutData() {} + virtual void sendOutData() {} protected: struct ByteArrayFunc { @@ -200,15 +289,20 @@ protected: }; std::unordered_map> getDataFunction; + std::unordered_map> setDataFunction; std::vector getByteArrayFunction; std::unordered_map> setByteArrayFunction; std::mutex mutex; uint8_t header[5]{}; // 固定大小的头部 size_t headerSize = 5; + FAST_DDS_MACRO::DataWriter *dataWriter; }; #define MAP_DATA_FUNC(NAME) \ getDataFunction[#NAME] = [this]() { return getString(data.NAME()); }; \ + setDataFunction[#NAME] = [this](std::string value) { \ + setDataFromString(out_data.NAME(), value); \ + }; \ getByteArrayFunction.push_back( \ {[this]() { return getByteArray(data.NAME()); }, getTypeSize()}); \ setByteArrayFunction[#NAME] = [this](XNByteArray byteArray) { \ @@ -220,13 +314,13 @@ protected: auto temp = data.NAME().value(); \ if constexpr (std::is_arithmetic_v) { \ model_data->NAME = temp; \ - } else if constexpr (std::is_std_array_v) { \ - size_t arraySize = std::tuple_size::value; \ + } else if constexpr (is_std_array_v) { \ + size_t arraySize = array_size_v; \ for (size_t i = 0; i < arraySize; ++i) { \ if constexpr (std::is_arithmetic_v) { \ model_data->NAME[i] = temp[i]; \ - } else if constexpr (std::is_std_array_v) { \ - size_t arraySize2 = std::tuple_size::value; \ + } else if constexpr (is_std_array_v) { \ + size_t arraySize2 = array_size_v; \ for (size_t j = 0; j < arraySize2; ++j) { \ model_data->NAME[i][j] = temp[i][j]; \ } \ @@ -236,19 +330,19 @@ protected: } #define ASSIGN_VALUE_SET(NAME) \ - if constexpr (std::is_arithmetic_v) { \ - data.NAME(model_data->NAME); \ - } else if constexpr (std::is_std_array_v) { \ - using thisType = typename decltype(data.NAME())::type; \ + if constexpr (std::is_arithmetic_v) { \ + out_data.NAME(model_data->NAME); \ + } else if constexpr (is_std_array_v) { \ + using thisType = typename decltype(out_data.NAME())::type; \ thisType temp; \ - size_t arraySize1 = std::tuple_size::value; \ + size_t arraySize1 = array_size_v; \ using subType = thisType::value_type; \ if constexpr (std::is_arithmetic_v) { \ for (size_t i = 0; i < arraySize1; ++i) { \ temp[i] = model_data->NAME[i]; \ } \ - } else if constexpr (std::is_std_array_v) { \ - size_t arraySize2 = std::tuple_size::value; \ + } else if constexpr (is_std_array_v) { \ + size_t arraySize2 = array_size_v; \ std::array temp; \ for (size_t i = 0; i < arraySize1; ++i) { \ for (size_t j = 0; j < arraySize2; ++j) { \ @@ -256,5 +350,5 @@ protected: } \ } \ } \ - data.NAME(temp); \ + out_data.NAME(temp); \ } diff --git a/XNCore/XNTypeTraits.h b/XNCore/XNTypeTraits.h index 2be257d..ebd2671 100644 --- a/XNCore/XNTypeTraits.h +++ b/XNCore/XNTypeTraits.h @@ -15,14 +15,31 @@ struct is_std_array> : std::true_type { template inline constexpr bool is_std_array_v = is_std_array::value; +/** + * @brief 获取类型的数组大小 + * @tparam T 要检查的类型 + * @return 如果是std::array,返回其大小;否则返回1 + */ +template +struct array_size : std::integral_constant { +}; + +template +struct array_size> : std::integral_constant { +}; + +// 变量模板简化使用 +template +inline constexpr std::size_t array_size_v = array_size::value; + // 获取类型大小的辅助函数 template constexpr size_t getTypeSize() { if constexpr (is_std_array_v) { // 对于std::array,计算所有元素的总大小 - return getTypeSize() * std::tuple_size::value; + return getTypeSize() * array_size_v; } else { return sizeof(T); } -} \ No newline at end of file +} diff --git a/XNModels/XNGroundHandling/.vscode/settings.json b/XNModels/XNGroundHandling/.vscode/settings.json index 863f241..a7dfdcc 100755 --- a/XNModels/XNGroundHandling/.vscode/settings.json +++ b/XNModels/XNGroundHandling/.vscode/settings.json @@ -71,6 +71,7 @@ "cinttypes": "cpp", "typeindex": "cpp", "typeinfo": "cpp", - "variant": "cpp" + "variant": "cpp", + "fstream": "cpp" } } \ No newline at end of file diff --git a/XNModels/XNGroundHandling/CMakeLists.txt b/XNModels/XNGroundHandling/CMakeLists.txt index c2dab7a..c077dcd 100755 --- a/XNModels/XNGroundHandling/CMakeLists.txt +++ b/XNModels/XNGroundHandling/CMakeLists.txt @@ -2,9 +2,6 @@ cmake_minimum_required(VERSION 3.16) project(XNGroundHandling LANGUAGES CXX) -set(CMAKE_AUTOUIC ON) -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTORCC ON) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -18,8 +15,5 @@ endif() # 添加 XNCore_PATH 下的 include 目录为包含目录 include_directories(${XNCore_PATH}/include) -find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core) -find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core) - add_subdirectory(XNGroundHandlingInterface) add_subdirectory(XNGroundHandling) diff --git a/XNModels/XNGroundHandling/XNGroundHandling/CMakeLists.txt b/XNModels/XNGroundHandling/XNGroundHandling/CMakeLists.txt index 402084b..9368165 100755 --- a/XNModels/XNGroundHandling/XNGroundHandling/CMakeLists.txt +++ b/XNModels/XNGroundHandling/XNGroundHandling/CMakeLists.txt @@ -7,7 +7,6 @@ add_library(XNGroundHandling SHARED ) target_link_libraries(XNGroundHandling PRIVATE - Qt${QT_VERSION_MAJOR}::Core ${XNCore_PATH}/lib/libXNCore.so XNGroundHandlingInterface) diff --git a/XNModels/XNGroundHandling/XNGroundHandling/XNGroundHandling.cpp b/XNModels/XNGroundHandling/XNGroundHandling/XNGroundHandling.cpp index 84b3f62..a06d5b5 100755 --- a/XNModels/XNGroundHandling/XNGroundHandling/XNGroundHandling.cpp +++ b/XNModels/XNGroundHandling/XNGroundHandling/XNGroundHandling.cpp @@ -2,18 +2,10 @@ #include "XNGroundHandling_p.h" #include #include -#include -XN_DLL_INITIALIZE(XNGroundHandling) +XN_MODEL_INITIALIZE(XNGroundHandling) -XN_REGISTER_PARTICIPANT_BEGIN(XNGroundHandling) -XN_PUBLISHTOPIC(XNSim::ATA04::GroundHandling_output) -XN_PUBLISHTOPIC(XNSim::ATA04::GroundHandling_heartbeat) -XN_SUBSCRIBETOPIC(XNSim::ATA04::GroundHandling_input, &XNGroundHandling::OnInput) -XN_REGISTER_PARTICIPANT_END(XNGroundHandling) - -XNGroundHandling::XNGroundHandling(QObject *parent) - : XNModelObject(*new XNGroundHandlingPrivate(this), parent) +XNGroundHandling::XNGroundHandling() : XNModelObject(new XNGroundHandlingPrivate()) { } @@ -21,30 +13,27 @@ XNGroundHandling::~XNGroundHandling() { } -XNGroundHandling::XNGroundHandling(XNGroundHandlingPrivate &dd, QObject *parent) - : XNModelObject(dd, parent) +XNGroundHandling::XNGroundHandling(PrivateType *p) : XNModelObject(p) { } -void XNGroundHandling::OnInitialize() +void XNGroundHandling::Initialize() { - Q_D(XNGroundHandling); - XNModelObject::OnInitialize(); + T_D(); + XNModelObject::Initialize(); if (d->_dynamicLib) { - d->_fun = reinterpret_cast( - d->_dynamicLib->resolve("_Z29SACSCGroundHandlingEntryPointP20ComacDataStructure_S")); + d->_fun = (FunctionType)dlsym(d->_dynamicLib, d->_entryPointName.c_str()); if (!d->_fun) { - LOG_WARNING("Failed to resolve SACSCGroundHandlingEntry:%1", - d->_dynamicLib->errorString()); + LOG_WARNING("Failed to resolve SACSCGroundHandlingEntry"); } } //add other initial code here } -void XNGroundHandling::OnPrepareForExecute() +void XNGroundHandling::PrepareForExecute() { - Q_D(XNGroundHandling); - XNModelObject::OnPrepareForExecute(); + T_D(); + XNModelObject::PrepareForExecute(); //add your initial data code here d->_data.input_ground = new input_ground_S(); d->_data.input_ground->l_04_i_gdcomac_brake_torq_f8 = new double *[3]; @@ -122,355 +111,21 @@ void XNGroundHandling::OnPrepareForExecute() for (int i = 0; i < 3; i++) { d->_data.output_ground->l_04_o_gdcomac_vczt_f8[i] = new double[2]; } + d->_inputInterface.Initialize(GetFramework(), GetUniqueId()); + d->_outputInterface.Initialize(GetFramework(), GetUniqueId()); + d->_heartbeatInterface.Initialize(GetFramework(), GetUniqueId()); } void XNGroundHandling::StepUpdate() { - Q_D(XNGroundHandling); + T_D(); XNModelObject::StepUpdate(); if (d->_fun) { //add your input code here - QMutexLocker locker(&d->_mutex); + d->_inputInterface.getData(d->_data.input_ground); d->_fun(&d->_data); + d->_outputInterface.setData(d->_data.output_ground); + d->_heartbeatInterface.setData(&d->_data); //add your output code here } - OnOutput(); -} - -// template -// void CopyInputData(T1 *model_input, const T2 &dds_input) -// { -// Q_D(XNGroundHandling); -// QMutexLocker locker(&d->_mutex); -// if (dds_input.l_04_i_gdcomac_frz_l1()) { -// model_input->l_04_i_gdcomac_frz_l1 = dds_input.l_04_i_gdcomac_frz_l1().value(); -// } -// } - -void XNGroundHandling::OnInput(const XNSim::ATA04::GroundHandling_input &input) -{ - Q_D(XNGroundHandling); - QMutexLocker locker(&d->_mutex); - if (input.l_04_i_gdcomac_frz_l1()) { - d->_data.input_ground->l_04_i_gdcomac_frz_l1 = input.l_04_i_gdcomac_frz_l1().value(); - } - if (input.l_04_i_gdcomac_chocks_l1()) { - d->_data.input_ground->l_04_i_gdcomac_chocks_l1 = input.l_04_i_gdcomac_chocks_l1().value(); - } - if (input.l_04_i_gdcomac_alt_agl_f8()) { - d->_data.input_ground->l_04_i_gdcomac_alt_agl_f8 = - input.l_04_i_gdcomac_alt_agl_f8().value(); - } - if (input.l_04_i_gdcomac_frzflt_l1()) { - d->_data.input_ground->l_04_i_gdcomac_frzflt_l1 = input.l_04_i_gdcomac_frzflt_l1().value(); - } - if (input.l_04_i_gdcomac_p_f8()) { - d->_data.input_ground->l_04_i_gdcomac_p_f8 = input.l_04_i_gdcomac_p_f8().value(); - } - if (input.l_04_i_gdcomac_q_f8()) { - d->_data.input_ground->l_04_i_gdcomac_q_f8 = input.l_04_i_gdcomac_q_f8().value(); - } - if (input.l_04_i_gdcomac_r_f8()) { - d->_data.input_ground->l_04_i_gdcomac_r_f8 = input.l_04_i_gdcomac_r_f8().value(); - } - if (input.l_04_i_gdcomac_ug_f8()) { - d->_data.input_ground->l_04_i_gdcomac_ug_f8 = input.l_04_i_gdcomac_ug_f8().value(); - } - if (input.l_04_i_gdcomac_vg_f8()) { - d->_data.input_ground->l_04_i_gdcomac_vg_f8 = input.l_04_i_gdcomac_vg_f8().value(); - } - if (input.l_04_i_gdcomac_wg_f8()) { - d->_data.input_ground->l_04_i_gdcomac_wg_f8 = input.l_04_i_gdcomac_wg_f8().value(); - } - if (input.l_04_i_gdcomac_blcg_f8()) { - d->_data.input_ground->l_04_i_gdcomac_blcg_f8 = input.l_04_i_gdcomac_blcg_f8().value(); - } - if (input.l_04_i_gdcomac_bscg_f8()) { - d->_data.input_ground->l_04_i_gdcomac_bscg_f8 = input.l_04_i_gdcomac_bscg_f8().value(); - } - if (input.l_04_i_gdcomac_wlcg_f8()) { - d->_data.input_ground->l_04_i_gdcomac_wlcg_f8 = input.l_04_i_gdcomac_wlcg_f8().value(); - } - if (input.l_04_i_gdcomac_pb_active_l1()) { - d->_data.input_ground->l_04_i_gdcomac_pb_active_l1 = - input.l_04_i_gdcomac_pb_active_l1().value(); - } - if (input.l_04_i_gdcomac_brake_torq_f8()) { - auto l_04_i_gdcomac_brake_torq_f8 = input.l_04_i_gdcomac_brake_torq_f8().value(); - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 2; j++) { - d->_data.input_ground->l_04_i_gdcomac_brake_torq_f8[i][j] = - l_04_i_gdcomac_brake_torq_f8[i][j]; - } - } - } - if (input.l_04_i_gdcomac_gear_f8()) { - auto l_04_i_gdcomac_gear_f8 = input.l_04_i_gdcomac_gear_f8().value(); - for (int i = 0; i < 3; i++) { - d->_data.input_ground->l_04_i_gdcomac_gear_f8[i] = l_04_i_gdcomac_gear_f8[i]; - } - } - if (input.l_04_i_gdcomac_gsteer_f8()) { - auto l_04_i_gdcomac_gsteer_f8 = input.l_04_i_gdcomac_gsteer_f8().value(); - for (int i = 0; i < 3; i++) { - d->_data.input_ground->l_04_i_gdcomac_gsteer_f8[i] = l_04_i_gdcomac_gsteer_f8[i]; - } - } - if (input.l_04_i_gdcomac_tire_pres_f8()) { - auto l_04_i_gdcomac_tire_pres_f8 = input.l_04_i_gdcomac_tire_pres_f8().value(); - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 2; j++) { - d->_data.input_ground->l_04_i_gdcomac_tire_pres_f8[i][j] = - l_04_i_gdcomac_tire_pres_f8[i][j]; - } - } - } - if (input.l_04_i_gdcomac_onjax_l1()) { - d->_data.input_ground->l_04_i_gdcomac_onjax_l1 = input.l_04_i_gdcomac_onjax_l1().value(); - } - if (input.l_04_i_gdcomac_contdep_f8()) { - auto l_04_i_gdcomac_contdep_f8 = input.l_04_i_gdcomac_contdep_f8().value(); - for (int i = 0; i < 3; i++) { - d->_data.input_ground->l_04_i_gdcomac_contdep_f8[i] = l_04_i_gdcomac_contdep_f8[i]; - } - } - if (input.l_04_i_gdcomac_thetag_f8()) { - d->_data.input_ground->l_04_i_gdcomac_thetag_f8 = input.l_04_i_gdcomac_thetag_f8().value(); - } - if (input.l_04_i_gdcomac_phig_f8()) { - d->_data.input_ground->l_04_i_gdcomac_phig_f8 = input.l_04_i_gdcomac_phig_f8().value(); - } - if (input.l_04_i_gdcomac_rwyrgh_i2()) { - d->_data.input_ground->l_04_i_gdcomac_rwyrgh_i2 = input.l_04_i_gdcomac_rwyrgh_i2().value(); - } - if (input.l_04_i_gdcomac_rwyhdg_f8()) { - d->_data.input_ground->l_04_i_gdcomac_rwyhdg_f8 = input.l_04_i_gdcomac_rwyhdg_f8().value(); - } - if (input.l_04_i_gdcomac_reset_braketemp_l1()) { - d->_data.input_ground->l_04_i_gdcomac_reset_braketemp_l1 = - input.l_04_i_gdcomac_reset_braketemp_l1().value(); - } - if (input.l_04_i_gdcomac_reset_tirepress_l1()) { - d->_data.input_ground->l_04_i_gdcomac_reset_tirepress_l1 = - input.l_04_i_gdcomac_reset_tirepress_l1().value(); - } - if (input.l_04_i_gdcomac_temp_c_f8()) { - d->_data.input_ground->l_04_i_gdcomac_temp_c_f8 = input.l_04_i_gdcomac_temp_c_f8().value(); - } - if (input.l_04_i_gdcomac_brake_temp_f8()) { - auto l_04_i_gdcomac_brake_temp_f8 = input.l_04_i_gdcomac_brake_temp_f8().value(); - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 2; j++) { - d->_data.input_ground->l_04_i_gdcomac_brake_temp_f8[i][j] = - l_04_i_gdcomac_brake_temp_f8[i][j]; - } - } - } - if (input.l_04_i_gdcomac_tire_tburst_l1()) { - auto l_04_i_gdcomac_tire_tburst_l1 = input.l_04_i_gdcomac_tire_tburst_l1().value(); - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 2; j++) { - d->_data.input_ground->l_04_i_gdcomac_tire_tburst_l1[i][j] = - l_04_i_gdcomac_tire_tburst_l1[i][j]; - } - } - } - if (input.l_04_i_gdcomac_tire_tflat_l1()) { - auto l_04_i_gdcomac_tire_tflat_l1 = input.l_04_i_gdcomac_tire_tflat_l1().value(); - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 2; j++) { - d->_data.input_ground->l_04_i_gdcomac_tire_tflat_l1[i][j] = - l_04_i_gdcomac_tire_tflat_l1[i][j]; - } - } - } - if (input.l_04_i_gdcomac_brk_reset_tpres_l1()) { - d->_data.input_ground->l_04_i_gdcomac_brk_reset_tpres_l1 = - input.l_04_i_gdcomac_brk_reset_tpres_l1().value(); - } - if (input.l_04_i_gdcomac_rcon_ci_f8()) { - auto l_04_i_gdcomac_rcon_ci_f8 = input.l_04_i_gdcomac_rcon_ci_f8().value(); - for (int i = 0; i < 3; i++) { - d->_data.input_ground->l_04_i_gdcomac_rcon_ci_f8[i] = l_04_i_gdcomac_rcon_ci_f8[i]; - } - } - if (input.l_04_i_gdcomac_pb_towforce_f8()) { - d->_data.input_ground->l_04_i_gdcomac_pb_towforce_f8 = - input.l_04_i_gdcomac_pb_towforce_f8().value(); - } - if (input.l_04_i_gdcomac_gsteer_state_i4()) { - d->_data.input_ground->l_04_i_gdcomac_gsteer_state_i4 = - input.l_04_i_gdcomac_gsteer_state_i4().value(); - } - if (input.l_04_i_gdcomac_trim_active_l1()) { - d->_data.input_ground->l_04_i_gdcomac_trim_active_l1 = - input.l_04_i_gdcomac_trim_active_l1().value(); - } - if (input.l_04_i_gdcomac_phi_deg_f8()) { - d->_data.input_ground->l_04_i_gdcomac_phi_deg_f8 = - input.l_04_i_gdcomac_phi_deg_f8().value(); - } - if (input.l_04_i_gdcomac_theta_deg_f8()) { - d->_data.input_ground->l_04_i_gdcomac_theta_deg_f8 = - input.l_04_i_gdcomac_theta_deg_f8().value(); - } - if (input.l_04_i_gdcomac_psi_deg_f8()) { - d->_data.input_ground->l_04_i_gdcomac_psi_deg_f8 = - input.l_04_i_gdcomac_psi_deg_f8().value(); - } - if (input.l_04_i_gdcomac_resetint_l1()) { - d->_data.input_ground->l_04_i_gdcomac_resetint_l1 = - input.l_04_i_gdcomac_resetint_l1().value(); - } -} - -void XNGroundHandling::OnOutput() -{ - Q_D(XNGroundHandling); - QMutexLocker locker(&d->_mutex); - XNSim::ATA04::GroundHandling_heartbeat heartbeat; - heartbeat.groundhandling_model_heartbeat(d->_data.groundhandling_model_heartbeat); - d->_dataWriters["XNSim::ATA04::GroundHandling_heartbeat"]->write(&heartbeat); - //DDS数据发布 - XNSim::ATA04::GroundHandling_output output; - output.l_04_o_gdcomac_frz_l1(d->_data.output_ground->l_04_o_gdcomac_frz_l1); - output.l_04_o_gdcomac_ac_on_ground_l1(d->_data.output_ground->l_04_o_gdcomac_ac_on_ground_l1); - output.l_04_o_gdcomac_ac_stationary_f8(d->_data.output_ground->l_04_o_gdcomac_ac_stationary_f8); - output.l_04_o_gdcomac_alt_tire_f8(d->_data.output_ground->l_04_o_gdcomac_alt_tire_f8); - output.l_04_o_gdcomac_zcg_to_tire_f8(d->_data.output_ground->l_04_o_gdcomac_zcg_to_tire_f8); - output.l_04_o_gdcomac_fxb_f8(d->_data.output_ground->l_04_o_gdcomac_fxb_f8); - output.l_04_o_gdcomac_fyb_f8(d->_data.output_ground->l_04_o_gdcomac_fyb_f8); - output.l_04_o_gdcomac_fzb_f8(d->_data.output_ground->l_04_o_gdcomac_fzb_f8); - output.l_04_o_gdcomac_mxb_f8(d->_data.output_ground->l_04_o_gdcomac_mxb_f8); - output.l_04_o_gdcomac_myb_f8(d->_data.output_ground->l_04_o_gdcomac_myb_f8); - output.l_04_o_gdcomac_mzb_f8(d->_data.output_ground->l_04_o_gdcomac_mzb_f8); - std::array l_04_o_gdcomac_fygs_f8; - for (int i = 0; i < 3; i++) { - l_04_o_gdcomac_fygs_f8[i] = d->_data.output_ground->l_04_o_gdcomac_fygs_f8[i]; - } - output.l_04_o_gdcomac_fygs_f8(l_04_o_gdcomac_fygs_f8); - std::array l_04_o_gdcomac_mzgs_f8; - for (int i = 0; i < 3; i++) { - l_04_o_gdcomac_mzgs_f8[i] = d->_data.output_ground->l_04_o_gdcomac_mzgs_f8[i]; - } - output.l_04_o_gdcomac_mzgs_f8(l_04_o_gdcomac_mzgs_f8); - std::array l_04_o_gdcomac_mu_f8; - for (int i = 0; i < 3; i++) { - l_04_o_gdcomac_mu_f8[i] = d->_data.output_ground->l_04_o_gdcomac_mu_f8[i]; - } - output.l_04_o_gdcomac_mu_f8(l_04_o_gdcomac_mu_f8); - std::array l_04_o_gdcomac_dstroke_f8; - for (int i = 0; i < 3; i++) { - l_04_o_gdcomac_dstroke_f8[i] = d->_data.output_ground->l_04_o_gdcomac_dstroke_f8[i]; - } - output.l_04_o_gdcomac_dstroke_f8(l_04_o_gdcomac_dstroke_f8); - std::array, 3> l_04_o_gdcomac_sr_f8; - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 2; j++) { - l_04_o_gdcomac_sr_f8[i][j] = d->_data.output_ground->l_04_o_gdcomac_sr_f8[i][j]; - } - } - output.l_04_o_gdcomac_sr_f8(l_04_o_gdcomac_sr_f8); - std::array, 3> l_04_o_gdcomac_sy_f8; - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 2; j++) { - l_04_o_gdcomac_sy_f8[i][j] = d->_data.output_ground->l_04_o_gdcomac_sy_f8[i][j]; - } - } - output.l_04_o_gdcomac_sy_f8(l_04_o_gdcomac_sy_f8); - std::array, 3> l_04_o_gdcomac_sx_f8; - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 2; j++) { - l_04_o_gdcomac_sx_f8[i][j] = d->_data.output_ground->l_04_o_gdcomac_sx_f8[i][j]; - } - } - output.l_04_o_gdcomac_sx_f8(l_04_o_gdcomac_sx_f8); - std::array l_04_o_gdcomac_xft_f8; - for (int i = 0; i < 3; i++) { - l_04_o_gdcomac_xft_f8[i] = d->_data.output_ground->l_04_o_gdcomac_xft_f8[i]; - } - output.l_04_o_gdcomac_xft_f8(l_04_o_gdcomac_xft_f8); - std::array l_04_o_gdcomac_yft_f8; - for (int i = 0; i < 3; i++) { - l_04_o_gdcomac_yft_f8[i] = d->_data.output_ground->l_04_o_gdcomac_yft_f8[i]; - } - output.l_04_o_gdcomac_yft_f8(l_04_o_gdcomac_yft_f8); - std::array l_04_o_gdcomac_zft_f8; - for (int i = 0; i < 3; i++) { - l_04_o_gdcomac_zft_f8[i] = d->_data.output_ground->l_04_o_gdcomac_zft_f8[i]; - } - output.l_04_o_gdcomac_zft_f8(l_04_o_gdcomac_zft_f8); - output.l_04_o_gdcomac_distngrxcg_f8(d->_data.output_ground->l_04_o_gdcomac_distngrxcg_f8); - output.l_04_o_gdcomac_distmgrxcg_f8(d->_data.output_ground->l_04_o_gdcomac_distmgrxcg_f8); - output.l_04_o_gdcomac_distmgrzcg_f8(d->_data.output_ground->l_04_o_gdcomac_distmgrzcg_f8); - std::array, 3> l_04_o_gdcomac_tire_vel_f8; - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 2; j++) { - l_04_o_gdcomac_tire_vel_f8[i][j] = - d->_data.output_ground->l_04_o_gdcomac_tire_vel_f8[i][j]; - } - } - output.l_04_o_gdcomac_tire_vel_f8(l_04_o_gdcomac_tire_vel_f8); - std::array, 3> l_04_o_gdcomac_tire_temp_f8; - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 2; j++) { - l_04_o_gdcomac_tire_temp_f8[i][j] = - d->_data.output_ground->l_04_o_gdcomac_tire_temp_f8[i][j]; - } - } - output.l_04_o_gdcomac_tire_temp_f8(l_04_o_gdcomac_tire_temp_f8); - std::array, 3> l_04_o_gdcomac_tire_burst_l1; - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 2; j++) { - l_04_o_gdcomac_tire_burst_l1[i][j] = - d->_data.output_ground->l_04_o_gdcomac_tire_burst_l1[i][j]; - } - } - output.l_04_o_gdcomac_tire_burst_l1(l_04_o_gdcomac_tire_burst_l1); - output.l_04_o_gdcomac_wow_l1(d->_data.output_ground->l_04_o_gdcomac_wow_l1); - std::array, 3> l_04_o_gdcomac_utirew_f8; - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 2; j++) { - l_04_o_gdcomac_utirew_f8[i][j] = d->_data.output_ground->l_04_o_gdcomac_utirew_f8[i][j]; - } - } - output.l_04_o_gdcomac_utirew_f8(l_04_o_gdcomac_utirew_f8); - std::array, 3> l_04_o_gdcomac_vtirew_f8; - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 2; j++) { - l_04_o_gdcomac_vtirew_f8[i][j] = d->_data.output_ground->l_04_o_gdcomac_vtirew_f8[i][j]; - } - } - output.l_04_o_gdcomac_vtirew_f8(l_04_o_gdcomac_vtirew_f8); - std::array, 3> l_04_o_gdcomac_whl_omega_f8; - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 2; j++) { - l_04_o_gdcomac_whl_omega_f8[i][j] = - d->_data.output_ground->l_04_o_gdcomac_whl_omega_f8[i][j]; - } - } - output.l_04_o_gdcomac_whl_omega_f8(l_04_o_gdcomac_whl_omega_f8); - std::array l_04_o_gdcomac_dstruc_f8; - for (int i = 0; i < 6; i++) { - l_04_o_gdcomac_dstruc_f8[i] = d->_data.output_ground->l_04_o_gdcomac_dstruc_f8[i]; - } - output.l_04_o_gdcomac_dstruc_f8(l_04_o_gdcomac_dstruc_f8); - std::array l_04_o_gdcomac_nd_f8; - for (int i = 0; i < 3; i++) { - l_04_o_gdcomac_nd_f8[i] = d->_data.output_ground->l_04_o_gdcomac_nd_f8[i]; - } - output.l_04_o_gdcomac_nd_f8(l_04_o_gdcomac_nd_f8); - std::array l_04_o_gdcomac_wor_par_f8; - for (int i = 0; i < 3; i++) { - l_04_o_gdcomac_wor_par_f8[i] = d->_data.output_ground->l_04_o_gdcomac_wor_par_f8[i]; - } - output.l_04_o_gdcomac_wor_par_f8(l_04_o_gdcomac_wor_par_f8); - std::array, 3> l_04_o_gdcomac_vczt_f8; - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 2; j++) { - l_04_o_gdcomac_vczt_f8[i][j] = d->_data.output_ground->l_04_o_gdcomac_vczt_f8[i][j]; - } - } - output.l_04_o_gdcomac_vczt_f8(l_04_o_gdcomac_vczt_f8); - d->_dataWriters["XNSim::ATA04::GroundHandling_output"]->write(&output); -} +} \ No newline at end of file diff --git a/XNModels/XNGroundHandling/XNGroundHandling/XNGroundHandling.h b/XNModels/XNGroundHandling/XNGroundHandling/XNGroundHandling.h index 84dc86d..d6db9d1 100755 --- a/XNModels/XNGroundHandling/XNGroundHandling/XNGroundHandling.h +++ b/XNModels/XNGroundHandling/XNGroundHandling/XNGroundHandling.h @@ -1,7 +1,6 @@ #pragma once #include "XNGroundHandling_global.h" #include -#include "../XNGroundHandlingInterface/XNGroundHandlingInterface.hpp" struct XNGroundHandlingPrivate; @@ -9,22 +8,17 @@ class XNGROUNDHANDLING_EXPORT XNGroundHandling : public XNModelObject { XN_METATYPE(XNGroundHandling, XNModelObject) XN_DECLARE_PRIVATE(XNGroundHandling) - XN_DECLARE_DDS() public: - explicit XNGroundHandling(QObject *parent = nullptr); + XNGroundHandling(); virtual ~XNGroundHandling(); protected: - XNGroundHandling(XNGroundHandlingPrivate &dd, QObject *parent = nullptr); + XNGroundHandling(PrivateType *p); public: virtual void Initialize() override; virtual void PrepareForExecute() override; - -public: virtual void StepUpdate() override; - -private: - void OnInput(const XNSim::ATA04::GroundHandling_input &input); - void OnOutput(); }; + +XNCLASS_PTR_DECLARE(XNGroundHandling) \ No newline at end of file diff --git a/XNModels/XNGroundHandling/XNGroundHandling/XNGroundHandling_global.h b/XNModels/XNGroundHandling/XNGroundHandling/XNGroundHandling_global.h index 4b8742a..968d0d0 100755 --- a/XNModels/XNGroundHandling/XNGroundHandling/XNGroundHandling_global.h +++ b/XNModels/XNGroundHandling/XNGroundHandling/XNGroundHandling_global.h @@ -1,12 +1,10 @@ #ifndef XNGROUNDHANDLING_GLOBAL_H #define XNGROUNDHANDLING_GLOBAL_H -#include - #if defined(XNGROUNDHANDLING_LIBRARY) -#define XNGROUNDHANDLING_EXPORT Q_DECL_EXPORT +# define XNGROUNDHANDLING_EXPORT __attribute__((visibility("default"))) #else -#define XNGROUNDHANDLING_EXPORT Q_DECL_IMPORT +# define XNGROUNDHANDLING_EXPORT __attribute__((visibility("hidden"))) #endif #endif // XNGROUNDHANDLING_GLOBAL_H diff --git a/XNModels/XNGroundHandling/XNGroundHandling/XNGroundHandling_p.h b/XNModels/XNGroundHandling/XNGroundHandling/XNGroundHandling_p.h index df69b8d..ac0ec6e 100755 --- a/XNModels/XNGroundHandling/XNGroundHandling/XNGroundHandling_p.h +++ b/XNModels/XNGroundHandling/XNGroundHandling/XNGroundHandling_p.h @@ -1,6 +1,7 @@ #pragma once #include #include +#include "../XNGroundHandlingInterface/XNGroundHandlingInterface.hpp" typedef void (*FunctionType)(ComacDataStructure_S *); @@ -12,4 +13,8 @@ struct XNGroundHandlingPrivate : public XNModelObjectPrivate { std::string _entryPointName = "_Z29SACSCGroundHandlingEntryPointP20ComacDataStructure_S"; std::mutex _mutex; + + XNSim::C909::ATA04::GroundHandling_input_Interface _inputInterface; + XNSim::C909::ATA04::GroundHandling_output_Interface _outputInterface; + XNSim::C909::ATA04::GroundHandling_heartbeat_Interface _heartbeatInterface; }; diff --git a/XNModels/XNGroundHandling/XNGroundHandlingInterface/CMakeLists.txt b/XNModels/XNGroundHandling/XNGroundHandlingInterface/CMakeLists.txt index 8665301..f40410a 100755 --- a/XNModels/XNGroundHandling/XNGroundHandlingInterface/CMakeLists.txt +++ b/XNModels/XNGroundHandling/XNGroundHandlingInterface/CMakeLists.txt @@ -25,7 +25,6 @@ add_library(XNGroundHandlingInterface SHARED ) target_link_libraries(XNGroundHandlingInterface PRIVATE - Qt${QT_VERSION_MAJOR}::Core fastcdr fastdds OpenSSL::SSL diff --git a/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandling.hpp b/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandling.hpp index 1fd7f7e..0addfcf 100755 --- a/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandling.hpp +++ b/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandling.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef FAST_DDS_GENERATED__XNSIM_ATA04_XNGROUNDHANDLING_HPP -#define FAST_DDS_GENERATED__XNSIM_ATA04_XNGROUNDHANDLING_HPP +#ifndef FAST_DDS_GENERATED__XNSIM_C909_ATA04_XNGROUNDHANDLING_HPP +#define FAST_DDS_GENERATED__XNSIM_C909_ATA04_XNGROUNDHANDLING_HPP #include #include @@ -53,6 +53,8 @@ namespace XNSim { +namespace C909 { + namespace ATA04 { /*! @@ -3841,8 +3843,10 @@ private: } // namespace ATA04 +} // namespace C909 + } // namespace XNSim -#endif // _FAST_DDS_GENERATED_XNSIM_ATA04_XNGROUNDHANDLING_HPP_ +#endif // _FAST_DDS_GENERATED_XNSIM_C909_ATA04_XNGROUNDHANDLING_HPP_ diff --git a/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandling.idl b/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandling.idl index e810547..f4a816f 100755 --- a/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandling.idl +++ b/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandling.idl @@ -1,90 +1,93 @@ module XNSim { - module ATA04 + module C909 { - struct GroundHandling_input + module ATA04 { - @optional char l_04_i_gdcomac_frz_l1; - @optional char l_04_i_gdcomac_chocks_l1; - @optional double l_04_i_gdcomac_alt_agl_f8; - @optional char l_04_i_gdcomac_frzflt_l1; - @optional double l_04_i_gdcomac_p_f8; - @optional double l_04_i_gdcomac_q_f8; - @optional double l_04_i_gdcomac_r_f8; - @optional double l_04_i_gdcomac_ug_f8; - @optional double l_04_i_gdcomac_vg_f8; - @optional double l_04_i_gdcomac_wg_f8; - @optional double l_04_i_gdcomac_blcg_f8; - @optional double l_04_i_gdcomac_bscg_f8; - @optional double l_04_i_gdcomac_wlcg_f8; - @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_gear_f8[3]; - @optional double l_04_i_gdcomac_gsteer_f8[10]; - @optional double l_04_i_gdcomac_tire_pres_f8[3][2]; - @optional char l_04_i_gdcomac_onjax_l1; - @optional double l_04_i_gdcomac_contdep_f8[7]; - @optional double l_04_i_gdcomac_thetag_f8; - @optional double l_04_i_gdcomac_phig_f8; - @optional long l_04_i_gdcomac_rwyrgh_i2; - @optional double l_04_i_gdcomac_rwyhdg_f8; - @optional char l_04_i_gdcomac_reset_braketemp_l1; - @optional char l_04_i_gdcomac_reset_tirepress_l1; - @optional double l_04_i_gdcomac_temp_c_f8; - @optional double l_04_i_gdcomac_brake_temp_f8[3][2]; - @optional char l_04_i_gdcomac_tire_tburst_l1[3][2]; - @optional char l_04_i_gdcomac_tire_tflat_l1[3][2]; - @optional char l_04_i_gdcomac_brk_reset_tpres_l1; - @optional double l_04_i_gdcomac_rcon_ci_f8[14]; - @optional double l_04_i_gdcomac_pb_towforce_f8; - @optional long l_04_i_gdcomac_gsteer_state_i4; - @optional char l_04_i_gdcomac_trim_active_l1; - @optional double l_04_i_gdcomac_phi_deg_f8; - @optional double l_04_i_gdcomac_theta_deg_f8; - @optional double l_04_i_gdcomac_psi_deg_f8; - @optional char l_04_i_gdcomac_resetint_l1; - }; - struct GroundHandling_output - { - @optional char l_04_o_gdcomac_frz_l1; - @optional char l_04_o_gdcomac_ac_on_ground_l1; - @optional double l_04_o_gdcomac_ac_stationary_f8; - @optional double l_04_o_gdcomac_alt_tire_f8; - @optional double l_04_o_gdcomac_zcg_to_tire_f8; - @optional double l_04_o_gdcomac_fxb_f8; - @optional double l_04_o_gdcomac_fyb_f8; - @optional double l_04_o_gdcomac_fzb_f8; - @optional double l_04_o_gdcomac_mxb_f8; - @optional double l_04_o_gdcomac_myb_f8; - @optional double l_04_o_gdcomac_mzb_f8; - @optional double l_04_o_gdcomac_fygs_f8[3]; - @optional double l_04_o_gdcomac_mzgs_f8[3]; - @optional double l_04_o_gdcomac_mu_f8[3]; - @optional double l_04_o_gdcomac_dstroke_f8[3]; - @optional double l_04_o_gdcomac_sr_f8[3][2]; - @optional double l_04_o_gdcomac_sy_f8[3][2]; - @optional double l_04_o_gdcomac_sx_f8[3][2]; - @optional double l_04_o_gdcomac_xft_f8[3]; - @optional double l_04_o_gdcomac_yft_f8[3]; - @optional double l_04_o_gdcomac_zft_f8[3]; - @optional double l_04_o_gdcomac_distngrxcg_f8; - @optional double l_04_o_gdcomac_distmgrxcg_f8; - @optional double l_04_o_gdcomac_distmgrzcg_f8; - @optional double l_04_o_gdcomac_tire_vel_f8[3][2]; - @optional char l_04_o_gdcomac_tire_burst_l1[3][2]; - @optional double l_04_o_gdcomac_tire_temp_f8[3][2]; - @optional char l_04_o_gdcomac_wow_l1; - @optional double l_04_o_gdcomac_utirew_f8[3][2]; - @optional double l_04_o_gdcomac_vtirew_f8[3][2]; - @optional double l_04_o_gdcomac_whl_omega_f8[3][2]; - @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_nd_f8[3]; - @optional double l_04_o_gdcomac_vczt_f8[3][2]; - }; - struct GroundHandling_heartbeat - { - @optional long groundhandling_model_heartbeat; + struct GroundHandling_input + { + @optional char l_04_i_gdcomac_frz_l1; + @optional char l_04_i_gdcomac_chocks_l1; + @optional double l_04_i_gdcomac_alt_agl_f8; + @optional char l_04_i_gdcomac_frzflt_l1; + @optional double l_04_i_gdcomac_p_f8; + @optional double l_04_i_gdcomac_q_f8; + @optional double l_04_i_gdcomac_r_f8; + @optional double l_04_i_gdcomac_ug_f8; + @optional double l_04_i_gdcomac_vg_f8; + @optional double l_04_i_gdcomac_wg_f8; + @optional double l_04_i_gdcomac_blcg_f8; + @optional double l_04_i_gdcomac_bscg_f8; + @optional double l_04_i_gdcomac_wlcg_f8; + @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_gear_f8[3]; + @optional double l_04_i_gdcomac_gsteer_f8[10]; + @optional double l_04_i_gdcomac_tire_pres_f8[3][2]; + @optional char l_04_i_gdcomac_onjax_l1; + @optional double l_04_i_gdcomac_contdep_f8[7]; + @optional double l_04_i_gdcomac_thetag_f8; + @optional double l_04_i_gdcomac_phig_f8; + @optional long l_04_i_gdcomac_rwyrgh_i2; + @optional double l_04_i_gdcomac_rwyhdg_f8; + @optional char l_04_i_gdcomac_reset_braketemp_l1; + @optional char l_04_i_gdcomac_reset_tirepress_l1; + @optional double l_04_i_gdcomac_temp_c_f8; + @optional double l_04_i_gdcomac_brake_temp_f8[3][2]; + @optional char l_04_i_gdcomac_tire_tburst_l1[3][2]; + @optional char l_04_i_gdcomac_tire_tflat_l1[3][2]; + @optional char l_04_i_gdcomac_brk_reset_tpres_l1; + @optional double l_04_i_gdcomac_rcon_ci_f8[14]; + @optional double l_04_i_gdcomac_pb_towforce_f8; + @optional long l_04_i_gdcomac_gsteer_state_i4; + @optional char l_04_i_gdcomac_trim_active_l1; + @optional double l_04_i_gdcomac_phi_deg_f8; + @optional double l_04_i_gdcomac_theta_deg_f8; + @optional double l_04_i_gdcomac_psi_deg_f8; + @optional char l_04_i_gdcomac_resetint_l1; + }; + struct GroundHandling_output + { + @optional char l_04_o_gdcomac_frz_l1; + @optional char l_04_o_gdcomac_ac_on_ground_l1; + @optional double l_04_o_gdcomac_ac_stationary_f8; + @optional double l_04_o_gdcomac_alt_tire_f8; + @optional double l_04_o_gdcomac_zcg_to_tire_f8; + @optional double l_04_o_gdcomac_fxb_f8; + @optional double l_04_o_gdcomac_fyb_f8; + @optional double l_04_o_gdcomac_fzb_f8; + @optional double l_04_o_gdcomac_mxb_f8; + @optional double l_04_o_gdcomac_myb_f8; + @optional double l_04_o_gdcomac_mzb_f8; + @optional double l_04_o_gdcomac_fygs_f8[3]; + @optional double l_04_o_gdcomac_mzgs_f8[3]; + @optional double l_04_o_gdcomac_mu_f8[3]; + @optional double l_04_o_gdcomac_dstroke_f8[3]; + @optional double l_04_o_gdcomac_sr_f8[3][2]; + @optional double l_04_o_gdcomac_sy_f8[3][2]; + @optional double l_04_o_gdcomac_sx_f8[3][2]; + @optional double l_04_o_gdcomac_xft_f8[3]; + @optional double l_04_o_gdcomac_yft_f8[3]; + @optional double l_04_o_gdcomac_zft_f8[3]; + @optional double l_04_o_gdcomac_distngrxcg_f8; + @optional double l_04_o_gdcomac_distmgrxcg_f8; + @optional double l_04_o_gdcomac_distmgrzcg_f8; + @optional double l_04_o_gdcomac_tire_vel_f8[3][2]; + @optional char l_04_o_gdcomac_tire_burst_l1[3][2]; + @optional double l_04_o_gdcomac_tire_temp_f8[3][2]; + @optional char l_04_o_gdcomac_wow_l1; + @optional double l_04_o_gdcomac_utirew_f8[3][2]; + @optional double l_04_o_gdcomac_vtirew_f8[3][2]; + @optional double l_04_o_gdcomac_whl_omega_f8[3][2]; + @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_nd_f8[3]; + @optional double l_04_o_gdcomac_vczt_f8[3][2]; + }; + struct GroundHandling_heartbeat + { + @optional long groundhandling_model_heartbeat; + }; }; }; }; diff --git a/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandlingCdrAux.hpp b/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandlingCdrAux.hpp index 36ed0f0..671fd0b 100755 --- a/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandlingCdrAux.hpp +++ b/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandlingCdrAux.hpp @@ -19,19 +19,19 @@ * This file was generated by the tool fastddsgen. */ -#ifndef FAST_DDS_GENERATED__XNSIM_ATA04_XNGROUNDHANDLINGCDRAUX_HPP -#define FAST_DDS_GENERATED__XNSIM_ATA04_XNGROUNDHANDLINGCDRAUX_HPP +#ifndef FAST_DDS_GENERATED__XNSIM_C909_ATA04_XNGROUNDHANDLINGCDRAUX_HPP +#define FAST_DDS_GENERATED__XNSIM_C909_ATA04_XNGROUNDHANDLINGCDRAUX_HPP #include "XNGroundHandling.hpp" -constexpr uint32_t XNSim_ATA04_GroundHandling_input_max_cdr_typesize {1093UL}; -constexpr uint32_t XNSim_ATA04_GroundHandling_input_max_key_cdr_typesize {0UL}; +constexpr uint32_t XNSim_C909_ATA04_GroundHandling_input_max_cdr_typesize {1093UL}; +constexpr uint32_t XNSim_C909_ATA04_GroundHandling_input_max_key_cdr_typesize {0UL}; -constexpr uint32_t XNSim_ATA04_GroundHandling_output_max_cdr_typesize {1328UL}; -constexpr uint32_t XNSim_ATA04_GroundHandling_output_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_ATA04_GroundHandling_heartbeat_max_cdr_typesize {12UL}; -constexpr uint32_t XNSim_ATA04_GroundHandling_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}; namespace eprosima { @@ -42,19 +42,19 @@ class CdrSizeCalculator; eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, - const XNSim::ATA04::GroundHandling_input& data); + const XNSim::C909::ATA04::GroundHandling_input& data); eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, - const XNSim::ATA04::GroundHandling_output& data); + const XNSim::C909::ATA04::GroundHandling_output& data); eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, - const XNSim::ATA04::GroundHandling_heartbeat& data); + const XNSim::C909::ATA04::GroundHandling_heartbeat& data); } // namespace fastcdr } // namespace eprosima -#endif // FAST_DDS_GENERATED__XNSIM_ATA04_XNGROUNDHANDLINGCDRAUX_HPP +#endif // FAST_DDS_GENERATED__XNSIM_C909_ATA04_XNGROUNDHANDLINGCDRAUX_HPP diff --git a/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandlingCdrAux.ipp b/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandlingCdrAux.ipp index e4d0516..65db859 100755 --- a/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandlingCdrAux.ipp +++ b/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandlingCdrAux.ipp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef FAST_DDS_GENERATED__XNSIM_ATA04_XNGROUNDHANDLINGCDRAUX_IPP -#define FAST_DDS_GENERATED__XNSIM_ATA04_XNGROUNDHANDLINGCDRAUX_IPP +#ifndef FAST_DDS_GENERATED__XNSIM_C909_ATA04_XNGROUNDHANDLINGCDRAUX_IPP +#define FAST_DDS_GENERATED__XNSIM_C909_ATA04_XNGROUNDHANDLINGCDRAUX_IPP #include "XNGroundHandlingCdrAux.hpp" @@ -37,10 +37,10 @@ namespace fastcdr { template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, - const XNSim::ATA04::GroundHandling_input& data, + const XNSim::C909::ATA04::GroundHandling_input& data, size_t& current_alignment) { - using namespace XNSim::ATA04; + using namespace XNSim::C909::ATA04; static_cast(data); @@ -178,9 +178,9 @@ eProsima_user_DllExport size_t calculate_serialized_size( template<> eProsima_user_DllExport void serialize( eprosima::fastcdr::Cdr& scdr, - const XNSim::ATA04::GroundHandling_input& data) + const XNSim::C909::ATA04::GroundHandling_input& data) { - using namespace XNSim::ATA04; + using namespace XNSim::C909::ATA04; eprosima::fastcdr::Cdr::state current_state(scdr); scdr.begin_serialize_type(current_state, @@ -235,9 +235,9 @@ eProsima_user_DllExport void serialize( template<> eProsima_user_DllExport void deserialize( eprosima::fastcdr::Cdr& cdr, - XNSim::ATA04::GroundHandling_input& data) + XNSim::C909::ATA04::GroundHandling_input& data) { - using namespace XNSim::ATA04; + using namespace XNSim::C909::ATA04; cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : @@ -413,9 +413,9 @@ eProsima_user_DllExport void deserialize( void serialize_key( eprosima::fastcdr::Cdr& scdr, - const XNSim::ATA04::GroundHandling_input& data) + const XNSim::C909::ATA04::GroundHandling_input& data) { - using namespace XNSim::ATA04; + using namespace XNSim::C909::ATA04; static_cast(scdr); static_cast(data); @@ -620,10 +620,10 @@ void serialize_key( template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, - const XNSim::ATA04::GroundHandling_output& data, + const XNSim::C909::ATA04::GroundHandling_output& data, size_t& current_alignment) { - using namespace XNSim::ATA04; + using namespace XNSim::C909::ATA04; static_cast(data); @@ -749,9 +749,9 @@ eProsima_user_DllExport size_t calculate_serialized_size( template<> eProsima_user_DllExport void serialize( eprosima::fastcdr::Cdr& scdr, - const XNSim::ATA04::GroundHandling_output& data) + const XNSim::C909::ATA04::GroundHandling_output& data) { - using namespace XNSim::ATA04; + using namespace XNSim::C909::ATA04; eprosima::fastcdr::Cdr::state current_state(scdr); scdr.begin_serialize_type(current_state, @@ -802,9 +802,9 @@ eProsima_user_DllExport void serialize( template<> eProsima_user_DllExport void deserialize( eprosima::fastcdr::Cdr& cdr, - XNSim::ATA04::GroundHandling_output& data) + XNSim::C909::ATA04::GroundHandling_output& data) { - using namespace XNSim::ATA04; + using namespace XNSim::C909::ATA04; cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : @@ -964,9 +964,9 @@ eProsima_user_DllExport void deserialize( void serialize_key( eprosima::fastcdr::Cdr& scdr, - const XNSim::ATA04::GroundHandling_output& data) + const XNSim::C909::ATA04::GroundHandling_output& data) { - using namespace XNSim::ATA04; + using namespace XNSim::C909::ATA04; static_cast(scdr); static_cast(data); @@ -1151,10 +1151,10 @@ void serialize_key( template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, - const XNSim::ATA04::GroundHandling_heartbeat& data, + const XNSim::C909::ATA04::GroundHandling_heartbeat& data, size_t& current_alignment) { - using namespace XNSim::ATA04; + using namespace XNSim::C909::ATA04; static_cast(data); @@ -1178,9 +1178,9 @@ eProsima_user_DllExport size_t calculate_serialized_size( template<> eProsima_user_DllExport void serialize( eprosima::fastcdr::Cdr& scdr, - const XNSim::ATA04::GroundHandling_heartbeat& data) + const XNSim::C909::ATA04::GroundHandling_heartbeat& data) { - using namespace XNSim::ATA04; + using namespace XNSim::C909::ATA04; eprosima::fastcdr::Cdr::state current_state(scdr); scdr.begin_serialize_type(current_state, @@ -1197,9 +1197,9 @@ eProsima_user_DllExport void serialize( template<> eProsima_user_DllExport void deserialize( eprosima::fastcdr::Cdr& cdr, - XNSim::ATA04::GroundHandling_heartbeat& data) + XNSim::C909::ATA04::GroundHandling_heartbeat& data) { - using namespace XNSim::ATA04; + using namespace XNSim::C909::ATA04; cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : @@ -1223,9 +1223,9 @@ eProsima_user_DllExport void deserialize( void serialize_key( eprosima::fastcdr::Cdr& scdr, - const XNSim::ATA04::GroundHandling_heartbeat& data) + const XNSim::C909::ATA04::GroundHandling_heartbeat& data) { - using namespace XNSim::ATA04; + using namespace XNSim::C909::ATA04; static_cast(scdr); static_cast(data); @@ -1241,5 +1241,5 @@ void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // FAST_DDS_GENERATED__XNSIM_ATA04_XNGROUNDHANDLINGCDRAUX_IPP +#endif // FAST_DDS_GENERATED__XNSIM_C909_ATA04_XNGROUNDHANDLINGCDRAUX_IPP diff --git a/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandlingInterface.cxx b/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandlingInterface.cxx index 4c6da11..5d054db 100755 --- a/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandlingInterface.cxx +++ b/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandlingInterface.cxx @@ -1,124 +1,196 @@ #include "XNGroundHandlingInterface.hpp" -namespace XNSim +namespace XNSim::C909::ATA04 { -namespace ATA04 +GroundHandling_input_Interface::GroundHandling_input_Interface() { - GroundHandling_input_Interface::GroundHandling_input_Interface() - { - MAP_GET_DATA_FUNC(l_04_i_gdcomac_frz_l1); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_chocks_l1); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_alt_agl_f8); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_frzflt_l1); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_p_f8); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_q_f8); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_r_f8); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_ug_f8); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_vg_f8); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_wg_f8); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_blcg_f8); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_bscg_f8); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_wlcg_f8); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_pb_active_l1); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_brake_torq_f8); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_gear_f8); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_gsteer_f8); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_tire_pres_f8); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_onjax_l1); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_contdep_f8); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_thetag_f8); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_phig_f8); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_rwyrgh_i2); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_rwyhdg_f8); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_reset_braketemp_l1); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_reset_tirepress_l1); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_temp_c_f8); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_brake_temp_f8); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_tire_tburst_l1); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_tire_tflat_l1); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_brk_reset_tpres_l1); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_rcon_ci_f8); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_pb_towforce_f8); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_gsteer_state_i4); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_trim_active_l1); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_phi_deg_f8); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_theta_deg_f8); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_psi_deg_f8); - MAP_GET_DATA_FUNC(l_04_i_gdcomac_resetint_l1); - } + MAP_DATA_FUNC(l_04_i_gdcomac_frz_l1); + MAP_DATA_FUNC(l_04_i_gdcomac_chocks_l1); + MAP_DATA_FUNC(l_04_i_gdcomac_alt_agl_f8); + MAP_DATA_FUNC(l_04_i_gdcomac_frzflt_l1); + MAP_DATA_FUNC(l_04_i_gdcomac_p_f8); + MAP_DATA_FUNC(l_04_i_gdcomac_q_f8); + MAP_DATA_FUNC(l_04_i_gdcomac_r_f8); + MAP_DATA_FUNC(l_04_i_gdcomac_ug_f8); + MAP_DATA_FUNC(l_04_i_gdcomac_vg_f8); + MAP_DATA_FUNC(l_04_i_gdcomac_wg_f8); + MAP_DATA_FUNC(l_04_i_gdcomac_blcg_f8); + MAP_DATA_FUNC(l_04_i_gdcomac_bscg_f8); + MAP_DATA_FUNC(l_04_i_gdcomac_wlcg_f8); + MAP_DATA_FUNC(l_04_i_gdcomac_pb_active_l1); + MAP_DATA_FUNC(l_04_i_gdcomac_brake_torq_f8); + MAP_DATA_FUNC(l_04_i_gdcomac_gear_f8); + MAP_DATA_FUNC(l_04_i_gdcomac_gsteer_f8); + MAP_DATA_FUNC(l_04_i_gdcomac_tire_pres_f8); + MAP_DATA_FUNC(l_04_i_gdcomac_onjax_l1); + MAP_DATA_FUNC(l_04_i_gdcomac_contdep_f8); + MAP_DATA_FUNC(l_04_i_gdcomac_thetag_f8); + MAP_DATA_FUNC(l_04_i_gdcomac_phig_f8); + MAP_DATA_FUNC(l_04_i_gdcomac_rwyrgh_i2); + MAP_DATA_FUNC(l_04_i_gdcomac_rwyhdg_f8); + MAP_DATA_FUNC(l_04_i_gdcomac_reset_braketemp_l1); + MAP_DATA_FUNC(l_04_i_gdcomac_reset_tirepress_l1); + MAP_DATA_FUNC(l_04_i_gdcomac_temp_c_f8); + MAP_DATA_FUNC(l_04_i_gdcomac_brake_temp_f8); + MAP_DATA_FUNC(l_04_i_gdcomac_tire_tburst_l1); + MAP_DATA_FUNC(l_04_i_gdcomac_tire_tflat_l1); + MAP_DATA_FUNC(l_04_i_gdcomac_brk_reset_tpres_l1); + MAP_DATA_FUNC(l_04_i_gdcomac_rcon_ci_f8); + MAP_DATA_FUNC(l_04_i_gdcomac_pb_towforce_f8); + MAP_DATA_FUNC(l_04_i_gdcomac_gsteer_state_i4); + MAP_DATA_FUNC(l_04_i_gdcomac_trim_active_l1); + MAP_DATA_FUNC(l_04_i_gdcomac_phi_deg_f8); + MAP_DATA_FUNC(l_04_i_gdcomac_theta_deg_f8); + MAP_DATA_FUNC(l_04_i_gdcomac_psi_deg_f8); + MAP_DATA_FUNC(l_04_i_gdcomac_resetint_l1); +} - GroundHandling_input_Interface::~GroundHandling_input_Interface() - { - } +GroundHandling_input_Interface::~GroundHandling_input_Interface() +{ +} - void GroundHandling_input_Interface::inputDataListener( - const XNSim::ATA04::GroundHandling_input &input) - { - this->data = input; +void GroundHandling_input_Interface::Initialize(XNFrameworkPtr framework, uint32_t modelId) +{ + auto ddsManager = framework->GetDDSManager(); + if (!ddsManager) { + LOG_ERROR("DDSManager is nullptr"); + return; } + dataWriter = ddsManager->RegisterPublisher( + "XNSim::C909::ATA04::GroundHandling_input", modelId); + ddsManager->RegisterSubscriber( + "XNSim::C909::ATA04::GroundHandling_input", modelId, + std::bind(&GroundHandling_input_Interface::inputDataListener, this, std::placeholders::_1)); +} - GroundHandling_output_Interface::GroundHandling_output_Interface() - { - MAP_GET_DATA_FUNC(l_04_o_gdcomac_frz_l1); - MAP_GET_DATA_FUNC(l_04_o_gdcomac_ac_on_ground_l1); - MAP_GET_DATA_FUNC(l_04_o_gdcomac_ac_stationary_f8); - MAP_GET_DATA_FUNC(l_04_o_gdcomac_alt_tire_f8); - MAP_GET_DATA_FUNC(l_04_o_gdcomac_zcg_to_tire_f8); - MAP_GET_DATA_FUNC(l_04_o_gdcomac_fxb_f8); - MAP_GET_DATA_FUNC(l_04_o_gdcomac_fyb_f8); - MAP_GET_DATA_FUNC(l_04_o_gdcomac_fzb_f8); - MAP_GET_DATA_FUNC(l_04_o_gdcomac_mxb_f8); - MAP_GET_DATA_FUNC(l_04_o_gdcomac_myb_f8); - MAP_GET_DATA_FUNC(l_04_o_gdcomac_mzb_f8); - MAP_GET_DATA_FUNC(l_04_o_gdcomac_fygs_f8); - MAP_GET_DATA_FUNC(l_04_o_gdcomac_mzgs_f8); - MAP_GET_DATA_FUNC(l_04_o_gdcomac_mu_f8); - MAP_GET_DATA_FUNC(l_04_o_gdcomac_dstroke_f8); - MAP_GET_DATA_FUNC(l_04_o_gdcomac_sr_f8); - MAP_GET_DATA_FUNC(l_04_o_gdcomac_sy_f8); - MAP_GET_DATA_FUNC(l_04_o_gdcomac_sx_f8); - MAP_GET_DATA_FUNC(l_04_o_gdcomac_xft_f8); - MAP_GET_DATA_FUNC(l_04_o_gdcomac_yft_f8); - MAP_GET_DATA_FUNC(l_04_o_gdcomac_zft_f8); - MAP_GET_DATA_FUNC(l_04_o_gdcomac_distngrxcg_f8); - MAP_GET_DATA_FUNC(l_04_o_gdcomac_distmgrxcg_f8); - MAP_GET_DATA_FUNC(l_04_o_gdcomac_distmgrzcg_f8); - MAP_GET_DATA_FUNC(l_04_o_gdcomac_tire_vel_f8); - MAP_GET_DATA_FUNC(l_04_o_gdcomac_tire_burst_l1); - MAP_GET_DATA_FUNC(l_04_o_gdcomac_tire_temp_f8); - MAP_GET_DATA_FUNC(l_04_o_gdcomac_wow_l1); - MAP_GET_DATA_FUNC(l_04_o_gdcomac_utirew_f8); - MAP_GET_DATA_FUNC(l_04_o_gdcomac_vtirew_f8); - MAP_GET_DATA_FUNC(l_04_o_gdcomac_whl_omega_f8); - MAP_GET_DATA_FUNC(l_04_o_gdcomac_dstruc_f8); - MAP_GET_DATA_FUNC(l_04_o_gdcomac_wor_par_f8); - MAP_GET_DATA_FUNC(l_04_o_gdcomac_nd_f8); - MAP_GET_DATA_FUNC(l_04_o_gdcomac_vczt_f8); - } +void GroundHandling_input_Interface::clearOutData() +{ + this->out_data = XNSim::C909::ATA04::GroundHandling_input(); +} - GroundHandling_output_Interface::~GroundHandling_output_Interface() - { - } +void GroundHandling_input_Interface::sendOutData() +{ + dataWriter->write(&this->out_data); +} - void GroundHandling_output_Interface::outputDataListener( - const XNSim::ATA04::GroundHandling_output &output) - { - this->data = output; - } +void GroundHandling_input_Interface::inputDataListener( + const XNSim::C909::ATA04::GroundHandling_input &input) +{ + this->data = input; +} - GroundHandling_heartbeat_Interface::GroundHandling_heartbeat_Interface() - { - MAP_GET_DATA_FUNC(groundhandling_model_heartbeat); - } +GroundHandling_output_Interface::GroundHandling_output_Interface() +{ + MAP_DATA_FUNC(l_04_o_gdcomac_frz_l1); + MAP_DATA_FUNC(l_04_o_gdcomac_ac_on_ground_l1); + MAP_DATA_FUNC(l_04_o_gdcomac_ac_stationary_f8); + MAP_DATA_FUNC(l_04_o_gdcomac_alt_tire_f8); + MAP_DATA_FUNC(l_04_o_gdcomac_zcg_to_tire_f8); + MAP_DATA_FUNC(l_04_o_gdcomac_fxb_f8); + MAP_DATA_FUNC(l_04_o_gdcomac_fyb_f8); + MAP_DATA_FUNC(l_04_o_gdcomac_fzb_f8); + MAP_DATA_FUNC(l_04_o_gdcomac_mxb_f8); + MAP_DATA_FUNC(l_04_o_gdcomac_myb_f8); + MAP_DATA_FUNC(l_04_o_gdcomac_mzb_f8); + MAP_DATA_FUNC(l_04_o_gdcomac_fygs_f8); + MAP_DATA_FUNC(l_04_o_gdcomac_mzgs_f8); + MAP_DATA_FUNC(l_04_o_gdcomac_mu_f8); + MAP_DATA_FUNC(l_04_o_gdcomac_dstroke_f8); + MAP_DATA_FUNC(l_04_o_gdcomac_sr_f8); + MAP_DATA_FUNC(l_04_o_gdcomac_sy_f8); + MAP_DATA_FUNC(l_04_o_gdcomac_sx_f8); + MAP_DATA_FUNC(l_04_o_gdcomac_xft_f8); + MAP_DATA_FUNC(l_04_o_gdcomac_yft_f8); + MAP_DATA_FUNC(l_04_o_gdcomac_zft_f8); + MAP_DATA_FUNC(l_04_o_gdcomac_distngrxcg_f8); + MAP_DATA_FUNC(l_04_o_gdcomac_distmgrxcg_f8); + MAP_DATA_FUNC(l_04_o_gdcomac_distmgrzcg_f8); + MAP_DATA_FUNC(l_04_o_gdcomac_tire_vel_f8); + MAP_DATA_FUNC(l_04_o_gdcomac_tire_burst_l1); + MAP_DATA_FUNC(l_04_o_gdcomac_tire_temp_f8); + MAP_DATA_FUNC(l_04_o_gdcomac_wow_l1); + MAP_DATA_FUNC(l_04_o_gdcomac_utirew_f8); + MAP_DATA_FUNC(l_04_o_gdcomac_vtirew_f8); + MAP_DATA_FUNC(l_04_o_gdcomac_whl_omega_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_nd_f8); + MAP_DATA_FUNC(l_04_o_gdcomac_vczt_f8); +} - GroundHandling_heartbeat_Interface::~GroundHandling_heartbeat_Interface() - { - } +GroundHandling_output_Interface::~GroundHandling_output_Interface() +{ +} - void GroundHandling_heartbeat_Interface::heartbeatListener( - const XNSim::ATA04::GroundHandling_heartbeat &heartbeat) - { - this->data = heartbeat; +void GroundHandling_output_Interface::Initialize(XNFrameworkPtr framework, uint32_t modelId) +{ + auto ddsManager = framework->GetDDSManager(); + if (!ddsManager) { + LOG_ERROR("DDSManager is nullptr"); + return; } -} // namespace ATA04 -} // namespace XNSim + dataWriter = ddsManager->RegisterPublisher( + "XNSim::C909::ATA04::GroundHandling_output", modelId); + ddsManager->RegisterSubscriber( + "XNSim::C909::ATA04::GroundHandling_output", modelId, + std::bind(&GroundHandling_output_Interface::outputDataListener, this, + std::placeholders::_1)); +} + +void GroundHandling_output_Interface::clearOutData() +{ + this->out_data = XNSim::C909::ATA04::GroundHandling_output(); +} + +void GroundHandling_output_Interface::sendOutData() +{ + dataWriter->write(&this->out_data); +} + +void GroundHandling_output_Interface::outputDataListener( + const XNSim::C909::ATA04::GroundHandling_output &output) +{ + this->data = output; +} + +GroundHandling_heartbeat_Interface::GroundHandling_heartbeat_Interface() +{ + MAP_DATA_FUNC(groundhandling_model_heartbeat); +} + +GroundHandling_heartbeat_Interface::~GroundHandling_heartbeat_Interface() +{ +} + +void GroundHandling_heartbeat_Interface::Initialize(XNFrameworkPtr framework, uint32_t modelId) +{ + auto ddsManager = framework->GetDDSManager(); + if (!ddsManager) { + LOG_ERROR("DDSManager is nullptr"); + return; + } + dataWriter = + ddsManager->RegisterPublisher( + "XNSim::C909::ATA04::GroundHandling_heartbeat", modelId); + ddsManager->RegisterSubscriber( + "XNSim::C909::ATA04::GroundHandling_heartbeat", modelId, + std::bind(&GroundHandling_heartbeat_Interface::heartbeatListener, this, + std::placeholders::_1)); +} + +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 diff --git a/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandlingInterface.hpp b/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandlingInterface.hpp index ce2c825..761ea08 100755 --- a/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandlingInterface.hpp +++ b/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandlingInterface.hpp @@ -2,132 +2,260 @@ #include "XNGroundHandlingPubSubTypes.hpp" #include "XNCore/XNDDSInterface.h" -namespace XNSim +namespace XNSim::C909::ATA04 { -namespace ATA04 +class GroundHandling_input_Interface final : public XNDDSInterface { - class GroundHandling_input_Interface : public XNDDSInterface +public: + GroundHandling_input_Interface(); + virtual ~GroundHandling_input_Interface(); + + virtual void Initialize(XNFrameworkPtr framework, uint32_t modelId) override; + virtual void clearOutData() override; + virtual void sendOutData() override; + + void inputDataListener(const XNSim::C909::ATA04::GroundHandling_input &input); + template + void getData(T *model_data) { - public: - explicit GroundHandling_input_Interface(); - virtual ~GroundHandling_input_Interface(); - void inputDataListener(const XNSim::ATA04::GroundHandling_input &input); - template - void getData(T *model_data) - { - if (model_data == nullptr) - return; - ASSIGN_VALUE_GET(l_04_i_gdcomac_frz_l1); - ASSIGN_VALUE_GET(l_04_i_gdcomac_chocks_l1); - ASSIGN_VALUE_GET(l_04_i_gdcomac_alt_agl_f8); - ASSIGN_VALUE_GET(l_04_i_gdcomac_frzflt_l1); - ASSIGN_VALUE_GET(l_04_i_gdcomac_p_f8); - ASSIGN_VALUE_GET(l_04_i_gdcomac_q_f8); - ASSIGN_VALUE_GET(l_04_i_gdcomac_r_f8); - ASSIGN_VALUE_GET(l_04_i_gdcomac_ug_f8); - ASSIGN_VALUE_GET(l_04_i_gdcomac_vg_f8); - ASSIGN_VALUE_GET(l_04_i_gdcomac_wg_f8); - ASSIGN_VALUE_GET(l_04_i_gdcomac_blcg_f8); - ASSIGN_VALUE_GET(l_04_i_gdcomac_bscg_f8); - ASSIGN_VALUE_GET(l_04_i_gdcomac_wlcg_f8); - ASSIGN_VALUE_GET(l_04_i_gdcomac_pb_active_l1); - ASSIGN_VALUE_GET(l_04_i_gdcomac_brake_torq_f8); - ASSIGN_VALUE_GET(l_04_i_gdcomac_gear_f8); - ASSIGN_VALUE_GET(l_04_i_gdcomac_gsteer_f8); - ASSIGN_VALUE_GET(l_04_i_gdcomac_tire_pres_f8); - ASSIGN_VALUE_GET(l_04_i_gdcomac_onjax_l1); - ASSIGN_VALUE_GET(l_04_i_gdcomac_contdep_f8); - ASSIGN_VALUE_GET(l_04_i_gdcomac_thetag_f8); - ASSIGN_VALUE_GET(l_04_i_gdcomac_phig_f8); - ASSIGN_VALUE_GET(l_04_i_gdcomac_rwyrgh_i2); - ASSIGN_VALUE_GET(l_04_i_gdcomac_rwyhdg_f8); - ASSIGN_VALUE_GET(l_04_i_gdcomac_reset_braketemp_l1); - ASSIGN_VALUE_GET(l_04_i_gdcomac_reset_tirepress_l1); - ASSIGN_VALUE_GET(l_04_i_gdcomac_temp_c_f8); - ASSIGN_VALUE_GET(l_04_i_gdcomac_brake_temp_f8); - ASSIGN_VALUE_GET(l_04_i_gdcomac_tire_tburst_l1); - ASSIGN_VALUE_GET(l_04_i_gdcomac_tire_tflat_l1); - ASSIGN_VALUE_GET(l_04_i_gdcomac_brk_reset_tpres_l1); - ASSIGN_VALUE_GET(l_04_i_gdcomac_rcon_ci_f8); - ASSIGN_VALUE_GET(l_04_i_gdcomac_pb_towforce_f8); - ASSIGN_VALUE_GET(l_04_i_gdcomac_gsteer_state_i4); - ASSIGN_VALUE_GET(l_04_i_gdcomac_trim_active_l1); - ASSIGN_VALUE_GET(l_04_i_gdcomac_phi_deg_f8); - ASSIGN_VALUE_GET(l_04_i_gdcomac_theta_deg_f8); - ASSIGN_VALUE_GET(l_04_i_gdcomac_psi_deg_f8); - ASSIGN_VALUE_GET(l_04_i_gdcomac_resetint_l1); - } + if (model_data == nullptr) + 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_chocks_l1(), model_data->l_04_i_gdcomac_chocks_l1); + assign_value_get(data.l_04_i_gdcomac_alt_agl_f8(), model_data->l_04_i_gdcomac_alt_agl_f8); + assign_value_get(data.l_04_i_gdcomac_frzflt_l1(), model_data->l_04_i_gdcomac_frzflt_l1); + assign_value_get(data.l_04_i_gdcomac_p_f8(), model_data->l_04_i_gdcomac_p_f8); + assign_value_get(data.l_04_i_gdcomac_q_f8(), model_data->l_04_i_gdcomac_q_f8); + assign_value_get(data.l_04_i_gdcomac_r_f8(), model_data->l_04_i_gdcomac_r_f8); + assign_value_get(data.l_04_i_gdcomac_ug_f8(), model_data->l_04_i_gdcomac_ug_f8); + assign_value_get(data.l_04_i_gdcomac_vg_f8(), model_data->l_04_i_gdcomac_vg_f8); + assign_value_get(data.l_04_i_gdcomac_wg_f8(), model_data->l_04_i_gdcomac_wg_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_wlcg_f8(), model_data->l_04_i_gdcomac_wlcg_f8); + assign_value_get(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_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_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_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_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_rwyhdg_f8(), model_data->l_04_i_gdcomac_rwyhdg_f8); + assign_value_get(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_temp_c_f8(), model_data->l_04_i_gdcomac_temp_c_f8); + assign_value_get(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_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_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_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_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_resetint_l1(), model_data->l_04_i_gdcomac_resetint_l1); + } - template - void setData(T *model_data) - { - if (model_data == nullptr) - return; - ASSIGN_VALUE_SET(l_04_i_gdcomac_frz_l1); - ASSIGN_VALUE_SET(l_04_i_gdcomac_chocks_l1); - ASSIGN_VALUE_SET(l_04_i_gdcomac_alt_agl_f8); - ASSIGN_VALUE_SET(l_04_i_gdcomac_frzflt_l1); - ASSIGN_VALUE_SET(l_04_i_gdcomac_p_f8); - ASSIGN_VALUE_SET(l_04_i_gdcomac_q_f8); - ASSIGN_VALUE_SET(l_04_i_gdcomac_r_f8); - ASSIGN_VALUE_SET(l_04_i_gdcomac_ug_f8); - ASSIGN_VALUE_SET(l_04_i_gdcomac_vg_f8); - ASSIGN_VALUE_SET(l_04_i_gdcomac_wg_f8); - ASSIGN_VALUE_SET(l_04_i_gdcomac_blcg_f8); - ASSIGN_VALUE_SET(l_04_i_gdcomac_bscg_f8); - ASSIGN_VALUE_SET(l_04_i_gdcomac_wlcg_f8); - ASSIGN_VALUE_SET(l_04_i_gdcomac_pb_active_l1); - ASSIGN_VALUE_SET(l_04_i_gdcomac_brake_torq_f8); - ASSIGN_VALUE_SET(l_04_i_gdcomac_gear_f8); - ASSIGN_VALUE_SET(l_04_i_gdcomac_gsteer_f8); - ASSIGN_VALUE_SET(l_04_i_gdcomac_tire_pres_f8); - ASSIGN_VALUE_SET(l_04_i_gdcomac_onjax_l1); - ASSIGN_VALUE_SET(l_04_i_gdcomac_contdep_f8); - ASSIGN_VALUE_SET(l_04_i_gdcomac_thetag_f8); - ASSIGN_VALUE_SET(l_04_i_gdcomac_phig_f8); - ASSIGN_VALUE_SET(l_04_i_gdcomac_rwyrgh_i2); - ASSIGN_VALUE_SET(l_04_i_gdcomac_rwyhdg_f8); - ASSIGN_VALUE_SET(l_04_i_gdcomac_reset_braketemp_l1); - ASSIGN_VALUE_SET(l_04_i_gdcomac_reset_tirepress_l1); - ASSIGN_VALUE_SET(l_04_i_gdcomac_temp_c_f8); - ASSIGN_VALUE_SET(l_04_i_gdcomac_brake_temp_f8); - ASSIGN_VALUE_SET(l_04_i_gdcomac_tire_tburst_l1); - ASSIGN_VALUE_SET(l_04_i_gdcomac_tire_tflat_l1); - ASSIGN_VALUE_SET(l_04_i_gdcomac_brk_reset_tpres_l1); - ASSIGN_VALUE_SET(l_04_i_gdcomac_rcon_ci_f8); - ASSIGN_VALUE_SET(l_04_i_gdcomac_pb_towforce_f8); - ASSIGN_VALUE_SET(l_04_i_gdcomac_gsteer_state_i4); - ASSIGN_VALUE_SET(l_04_i_gdcomac_trim_active_l1); - ASSIGN_VALUE_SET(l_04_i_gdcomac_phi_deg_f8); - ASSIGN_VALUE_SET(l_04_i_gdcomac_theta_deg_f8); - ASSIGN_VALUE_SET(l_04_i_gdcomac_psi_deg_f8); - ASSIGN_VALUE_SET(l_04_i_gdcomac_resetint_l1); - } - - private: - XNSim::ATA04::GroundHandling_input data; - }; - - class GroundHandling_output_Interface : public XNDDSInterface + template + void setData(T *model_data) { - public: - explicit GroundHandling_output_Interface(); - virtual ~GroundHandling_output_Interface(); - void outputDataListener(const XNSim::ATA04::GroundHandling_output &output); + // if (model_data == nullptr) + // return; + // clearOutData(); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_frz_l1); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_chocks_l1); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_alt_agl_f8); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_frzflt_l1); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_p_f8); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_q_f8); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_r_f8); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_ug_f8); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_vg_f8); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_wg_f8); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_blcg_f8); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_bscg_f8); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_wlcg_f8); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_pb_active_l1); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_brake_torq_f8); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_gear_f8); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_gsteer_f8); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_tire_pres_f8); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_onjax_l1); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_contdep_f8); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_thetag_f8); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_phig_f8); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_rwyrgh_i2); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_rwyhdg_f8); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_reset_braketemp_l1); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_reset_tirepress_l1); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_temp_c_f8); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_brake_temp_f8); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_tire_tburst_l1); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_tire_tflat_l1); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_brk_reset_tpres_l1); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_rcon_ci_f8); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_pb_towforce_f8); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_gsteer_state_i4); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_trim_active_l1); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_phi_deg_f8); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_theta_deg_f8); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_psi_deg_f8); + // ASSIGN_VALUE_SET(l_04_i_gdcomac_resetint_l1); + // sendOutData(); + } - private: - XNSim::ATA04::GroundHandling_output data; - }; +private: + XNSim::C909::ATA04::GroundHandling_input data; + XNSim::C909::ATA04::GroundHandling_input out_data; +}; - class GroundHandling_heartbeat_Interface : public XNDDSInterface +class GroundHandling_output_Interface final : public XNDDSInterface +{ +public: + GroundHandling_output_Interface(); + virtual ~GroundHandling_output_Interface(); + virtual void Initialize(XNFrameworkPtr framework, uint32_t modelId) override; + void outputDataListener(const XNSim::C909::ATA04::GroundHandling_output &output); + virtual void clearOutData() override; + virtual void sendOutData() override; + template + void getData(T *model_data) { - public: - explicit GroundHandling_heartbeat_Interface(); - virtual ~GroundHandling_heartbeat_Interface(); - void heartbeatListener(const XNSim::ATA04::GroundHandling_heartbeat &heartbeat); + // if (model_data == nullptr) + // return; + // ASSIGN_VALUE_GET(l_04_o_gdcomac_frz_l1); + // ASSIGN_VALUE_GET(l_04_o_gdcomac_ac_on_ground_l1); + // ASSIGN_VALUE_GET(l_04_o_gdcomac_ac_stationary_f8); + // ASSIGN_VALUE_GET(l_04_o_gdcomac_alt_tire_f8); + // ASSIGN_VALUE_GET(l_04_o_gdcomac_zcg_to_tire_f8); + // ASSIGN_VALUE_GET(l_04_o_gdcomac_fxb_f8); + // ASSIGN_VALUE_GET(l_04_o_gdcomac_fyb_f8); + // ASSIGN_VALUE_GET(l_04_o_gdcomac_fzb_f8); + // ASSIGN_VALUE_GET(l_04_o_gdcomac_mxb_f8); + // ASSIGN_VALUE_GET(l_04_o_gdcomac_myb_f8); + // ASSIGN_VALUE_GET(l_04_o_gdcomac_mzb_f8); + // ASSIGN_VALUE_GET(l_04_o_gdcomac_fygs_f8); + // ASSIGN_VALUE_GET(l_04_o_gdcomac_mzgs_f8); + // ASSIGN_VALUE_GET(l_04_o_gdcomac_mu_f8); + // ASSIGN_VALUE_GET(l_04_o_gdcomac_dstroke_f8); + // ASSIGN_VALUE_GET(l_04_o_gdcomac_sr_f8); + // ASSIGN_VALUE_GET(l_04_o_gdcomac_sy_f8); + // ASSIGN_VALUE_GET(l_04_o_gdcomac_sx_f8); + // ASSIGN_VALUE_GET(l_04_o_gdcomac_xft_f8); + // ASSIGN_VALUE_GET(l_04_o_gdcomac_yft_f8); + // ASSIGN_VALUE_GET(l_04_o_gdcomac_zft_f8); + // ASSIGN_VALUE_GET(l_04_o_gdcomac_distngrxcg_f8); + // ASSIGN_VALUE_GET(l_04_o_gdcomac_distmgrxcg_f8); + // ASSIGN_VALUE_GET(l_04_o_gdcomac_distmgrzcg_f8); + // ASSIGN_VALUE_GET(l_04_o_gdcomac_tire_vel_f8); + // ASSIGN_VALUE_GET(l_04_o_gdcomac_tire_burst_l1); + // ASSIGN_VALUE_GET(l_04_o_gdcomac_tire_temp_f8); + // ASSIGN_VALUE_GET(l_04_o_gdcomac_wow_l1); + // ASSIGN_VALUE_GET(l_04_o_gdcomac_utirew_f8); + // ASSIGN_VALUE_GET(l_04_o_gdcomac_vtirew_f8); + // ASSIGN_VALUE_GET(l_04_o_gdcomac_whl_omega_f8); + // ASSIGN_VALUE_GET(l_04_o_gdcomac_dstruc_f8); + // ASSIGN_VALUE_GET(l_04_o_gdcomac_wor_par_f8); + // ASSIGN_VALUE_GET(l_04_o_gdcomac_nd_f8); + // ASSIGN_VALUE_GET(l_04_o_gdcomac_vczt_f8); + } - private: - XNSim::ATA04::GroundHandling_heartbeat data; - }; -} // namespace ATA04 -} // namespace XNSim + template + void setData(T *model_data) + { + // if (model_data == nullptr) + // return; + // clearOutData(); + // ASSIGN_VALUE_SET(l_04_o_gdcomac_frz_l1); + // ASSIGN_VALUE_SET(l_04_o_gdcomac_ac_on_ground_l1); + // ASSIGN_VALUE_SET(l_04_o_gdcomac_ac_stationary_f8); + // ASSIGN_VALUE_SET(l_04_o_gdcomac_alt_tire_f8); + // ASSIGN_VALUE_SET(l_04_o_gdcomac_zcg_to_tire_f8); + // ASSIGN_VALUE_SET(l_04_o_gdcomac_fxb_f8); + // ASSIGN_VALUE_SET(l_04_o_gdcomac_fyb_f8); + // ASSIGN_VALUE_SET(l_04_o_gdcomac_fzb_f8); + // ASSIGN_VALUE_SET(l_04_o_gdcomac_mxb_f8); + // ASSIGN_VALUE_SET(l_04_o_gdcomac_myb_f8); + // ASSIGN_VALUE_SET(l_04_o_gdcomac_mzb_f8); + // ASSIGN_VALUE_SET(l_04_o_gdcomac_fygs_f8); + // ASSIGN_VALUE_SET(l_04_o_gdcomac_mzgs_f8); + // ASSIGN_VALUE_SET(l_04_o_gdcomac_mu_f8); + // ASSIGN_VALUE_SET(l_04_o_gdcomac_dstroke_f8); + // ASSIGN_VALUE_SET(l_04_o_gdcomac_sr_f8); + // ASSIGN_VALUE_SET(l_04_o_gdcomac_sy_f8); + // ASSIGN_VALUE_SET(l_04_o_gdcomac_sx_f8); + // ASSIGN_VALUE_SET(l_04_o_gdcomac_xft_f8); + // ASSIGN_VALUE_SET(l_04_o_gdcomac_yft_f8); + // ASSIGN_VALUE_SET(l_04_o_gdcomac_zft_f8); + // ASSIGN_VALUE_SET(l_04_o_gdcomac_distngrxcg_f8); + // ASSIGN_VALUE_SET(l_04_o_gdcomac_distmgrxcg_f8); + // ASSIGN_VALUE_SET(l_04_o_gdcomac_distmgrzcg_f8); + // ASSIGN_VALUE_SET(l_04_o_gdcomac_tire_vel_f8); + // ASSIGN_VALUE_SET(l_04_o_gdcomac_tire_burst_l1); + // ASSIGN_VALUE_SET(l_04_o_gdcomac_tire_temp_f8); + // ASSIGN_VALUE_SET(l_04_o_gdcomac_wow_l1); + // ASSIGN_VALUE_SET(l_04_o_gdcomac_utirew_f8); + // ASSIGN_VALUE_SET(l_04_o_gdcomac_vtirew_f8); + // ASSIGN_VALUE_SET(l_04_o_gdcomac_whl_omega_f8); + // ASSIGN_VALUE_SET(l_04_o_gdcomac_dstruc_f8); + // ASSIGN_VALUE_SET(l_04_o_gdcomac_wor_par_f8); + // ASSIGN_VALUE_SET(l_04_o_gdcomac_nd_f8); + // ASSIGN_VALUE_SET(l_04_o_gdcomac_vczt_f8); + // sendOutData(); + } + +private: + XNSim::C909::ATA04::GroundHandling_output data; + XNSim::C909::ATA04::GroundHandling_output out_data; +}; + +class GroundHandling_heartbeat_Interface final : public XNDDSInterface +{ +public: + GroundHandling_heartbeat_Interface(); + virtual ~GroundHandling_heartbeat_Interface(); + virtual void Initialize(XNFrameworkPtr framework, uint32_t modelId) override; + void heartbeatListener(const XNSim::C909::ATA04::GroundHandling_heartbeat &heartbeat); + virtual void clearOutData() override; + virtual void sendOutData() override; + template + void getData(T *model_data) + { + // if (model_data == nullptr) + // return; + // ASSIGN_VALUE_GET(groundhandling_model_heartbeat); + } + + template + void setData(T *model_data) + { + // if (model_data == nullptr) + // return; + // clearOutData(); + // ASSIGN_VALUE_SET(groundhandling_model_heartbeat); + // sendOutData(); + } + +private: + XNSim::C909::ATA04::GroundHandling_heartbeat data; + XNSim::C909::ATA04::GroundHandling_heartbeat out_data; +}; +} // namespace XNSim::C909::ATA04 diff --git a/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandlingPubSubTypes.cxx b/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandlingPubSubTypes.cxx index 4bfdba6..f50b982 100755 --- a/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandlingPubSubTypes.cxx +++ b/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandlingPubSubTypes.cxx @@ -32,554 +32,557 @@ using InstanceHandle_t = eprosima::fastdds::rtps::InstanceHandle_t; using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; namespace XNSim { - namespace ATA04 { - GroundHandling_inputPubSubType::GroundHandling_inputPubSubType() - { - set_name("XNSim::ATA04::GroundHandling_input"); - uint32_t type_size = XNSim_ATA04_GroundHandling_input_max_cdr_typesize; - type_size += static_cast(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_ATA04_GroundHandling_input_max_key_cdr_typesize > 16 ? XNSim_ATA04_GroundHandling_input_max_key_cdr_typesize : 16; - key_buffer_ = reinterpret_cast(malloc(key_length)); - memset(key_buffer_, 0, key_length); - } - - GroundHandling_inputPubSubType::~GroundHandling_inputPubSubType() - { - if (key_buffer_ != nullptr) + namespace C909 { + namespace ATA04 { + GroundHandling_inputPubSubType::GroundHandling_inputPubSubType() { - free(key_buffer_); - } - } - - bool GroundHandling_inputPubSubType::serialize( - const void* const data, - SerializedPayload_t& payload, - DataRepresentationId_t data_representation) - { - const GroundHandling_input* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(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; + set_name("XNSim::C909::ATA04::GroundHandling_input"); + uint32_t type_size = XNSim_C909_ATA04_GroundHandling_input_max_cdr_typesize; + type_size += static_cast(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_GroundHandling_input_max_key_cdr_typesize > 16 ? XNSim_C909_ATA04_GroundHandling_input_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); } - // Get the serialized length - payload.length = static_cast(ser.get_serialized_data_length()); - return true; - } - - bool GroundHandling_inputPubSubType::deserialize( - SerializedPayload_t& payload, - void* data) - { - try + GroundHandling_inputPubSubType::~GroundHandling_inputPubSubType() { - // Convert DATA to pointer of your type - GroundHandling_input* p_type = static_cast(data); + if (key_buffer_ != nullptr) + { + free(key_buffer_); + } + } + + bool GroundHandling_inputPubSubType::serialize( + const void* const data, + SerializedPayload_t& payload, + DataRepresentationId_t data_representation) + { + const GroundHandling_input* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(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 GroundHandling_inputPubSubType::calculate_serialized_size( - const void* const data, - DataRepresentationId_t data_representation) - { - try - { - eprosima::fastcdr::CdrSizeCalculator calculator( + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(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::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); - size_t current_alignment {0}; - return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + - 4u /*encapsulation*/; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return 0; - } - } + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); - void* GroundHandling_inputPubSubType::create_data() - { - return reinterpret_cast(new GroundHandling_input()); - } - - void GroundHandling_inputPubSubType::delete_data( - void* data) - { - delete(reinterpret_cast(data)); - } - - bool GroundHandling_inputPubSubType::compute_key( - SerializedPayload_t& payload, - InstanceHandle_t& handle, - bool force_md5) - { - if (!is_compute_key_provided) - { - return false; - } - - GroundHandling_input data; - if (deserialize(payload, static_cast(&data))) - { - return compute_key(static_cast(&data), handle, force_md5); - } - - return false; - } - - bool GroundHandling_inputPubSubType::compute_key( - const void* const data, - InstanceHandle_t& handle, - bool force_md5) - { - if (!is_compute_key_provided) - { - return false; - } - - const GroundHandling_input* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), - XNSim_ATA04_GroundHandling_input_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_ATA04_GroundHandling_input_max_key_cdr_typesize > 16) - { - md5_.init(); - md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); - md5_.finalize(); - for (uint8_t i = 0; i < 16; ++i) + try { - handle.value[i] = md5_.digest[i]; + // 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(ser.get_serialized_data_length()); + return true; + } + + bool GroundHandling_inputPubSubType::deserialize( + SerializedPayload_t& payload, + void* data) + { + try + { + // Convert DATA to pointer of your type + GroundHandling_input* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(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 GroundHandling_inputPubSubType::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(calculator.calculate_serialized_size( + *static_cast(data), current_alignment)) + + 4u /*encapsulation*/; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return 0; } } - else + + void* GroundHandling_inputPubSubType::create_data() { - for (uint8_t i = 0; i < 16; ++i) + return reinterpret_cast(new GroundHandling_input()); + } + + void GroundHandling_inputPubSubType::delete_data( + void* data) + { + delete(reinterpret_cast(data)); + } + + bool GroundHandling_inputPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) + { + if (!is_compute_key_provided) { - handle.value[i] = key_buffer_[i]; + return false; } - } - return true; - } - void GroundHandling_inputPubSubType::register_type_object_representation() - { - register_GroundHandling_input_type_identifier(type_identifiers_); - } + GroundHandling_input data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } - GroundHandling_outputPubSubType::GroundHandling_outputPubSubType() - { - set_name("XNSim::ATA04::GroundHandling_output"); - uint32_t type_size = XNSim_ATA04_GroundHandling_output_max_cdr_typesize; - type_size += static_cast(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_ATA04_GroundHandling_output_max_key_cdr_typesize > 16 ? XNSim_ATA04_GroundHandling_output_max_key_cdr_typesize : 16; - key_buffer_ = reinterpret_cast(malloc(key_length)); - memset(key_buffer_, 0, key_length); - } - - GroundHandling_outputPubSubType::~GroundHandling_outputPubSubType() - { - if (key_buffer_ != nullptr) - { - free(key_buffer_); - } - } - - bool GroundHandling_outputPubSubType::serialize( - const void* const data, - SerializedPayload_t& payload, - DataRepresentationId_t data_representation) - { - const GroundHandling_output* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(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(ser.get_serialized_data_length()); - return true; - } - - bool GroundHandling_outputPubSubType::deserialize( - SerializedPayload_t& payload, - void* data) - { - try + bool GroundHandling_inputPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, + bool force_md5) { - // Convert DATA to pointer of your type - GroundHandling_output* p_type = static_cast(data); + if (!is_compute_key_provided) + { + return false; + } + + const GroundHandling_input* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.length); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), + XNSim_C909_ATA04_GroundHandling_input_max_key_cdr_typesize); - // 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 GroundHandling_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(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + - 4u /*encapsulation*/; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return 0; - } - } - - void* GroundHandling_outputPubSubType::create_data() - { - return reinterpret_cast(new GroundHandling_output()); - } - - void GroundHandling_outputPubSubType::delete_data( - void* data) - { - delete(reinterpret_cast(data)); - } - - bool GroundHandling_outputPubSubType::compute_key( - SerializedPayload_t& payload, - InstanceHandle_t& handle, - bool force_md5) - { - if (!is_compute_key_provided) - { - return false; - } - - GroundHandling_output data; - if (deserialize(payload, static_cast(&data))) - { - return compute_key(static_cast(&data), handle, force_md5); - } - - return false; - } - - bool GroundHandling_outputPubSubType::compute_key( - const void* const data, - InstanceHandle_t& handle, - bool force_md5) - { - if (!is_compute_key_provided) - { - return false; - } - - const GroundHandling_output* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), - XNSim_ATA04_GroundHandling_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_ATA04_GroundHandling_output_max_key_cdr_typesize > 16) - { - md5_.init(); - md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); - md5_.finalize(); - for (uint8_t i = 0; i < 16; ++i) + // 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_GroundHandling_input_max_key_cdr_typesize > 16) { - handle.value[i] = md5_.digest[i]; + md5_.init(); + md5_.update(key_buffer_, static_cast(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 GroundHandling_inputPubSubType::register_type_object_representation() + { + register_GroundHandling_input_type_identifier(type_identifiers_); + } + + GroundHandling_outputPubSubType::GroundHandling_outputPubSubType() + { + set_name("XNSim::C909::ATA04::GroundHandling_output"); + uint32_t type_size = XNSim_C909_ATA04_GroundHandling_output_max_cdr_typesize; + type_size += static_cast(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_GroundHandling_output_max_key_cdr_typesize > 16 ? XNSim_C909_ATA04_GroundHandling_output_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); + } + + GroundHandling_outputPubSubType::~GroundHandling_outputPubSubType() + { + if (key_buffer_ != nullptr) + { + free(key_buffer_); } } - else + + bool GroundHandling_outputPubSubType::serialize( + const void* const data, + SerializedPayload_t& payload, + DataRepresentationId_t data_representation) { - for (uint8_t i = 0; i < 16; ++i) - { - handle.value[i] = key_buffer_[i]; - } - } - return true; - } - - void GroundHandling_outputPubSubType::register_type_object_representation() - { - register_GroundHandling_output_type_identifier(type_identifiers_); - } - - GroundHandling_heartbeatPubSubType::GroundHandling_heartbeatPubSubType() - { - set_name("XNSim::ATA04::GroundHandling_heartbeat"); - uint32_t type_size = XNSim_ATA04_GroundHandling_heartbeat_max_cdr_typesize; - type_size += static_cast(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_ATA04_GroundHandling_heartbeat_max_key_cdr_typesize > 16 ? XNSim_ATA04_GroundHandling_heartbeat_max_key_cdr_typesize : 16; - key_buffer_ = reinterpret_cast(malloc(key_length)); - memset(key_buffer_, 0, key_length); - } - - GroundHandling_heartbeatPubSubType::~GroundHandling_heartbeatPubSubType() - { - if (key_buffer_ != nullptr) - { - free(key_buffer_); - } - } - - bool GroundHandling_heartbeatPubSubType::serialize( - const void* const data, - SerializedPayload_t& payload, - DataRepresentationId_t data_representation) - { - const GroundHandling_heartbeat* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(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(ser.get_serialized_data_length()); - return true; - } - - bool GroundHandling_heartbeatPubSubType::deserialize( - SerializedPayload_t& payload, - void* data) - { - try - { - // Convert DATA to pointer of your type - GroundHandling_heartbeat* p_type = static_cast(data); + const GroundHandling_output* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(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 GroundHandling_heartbeatPubSubType::calculate_serialized_size( - const void* const data, - DataRepresentationId_t data_representation) - { - try - { - eprosima::fastcdr::CdrSizeCalculator calculator( + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(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::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); - size_t current_alignment {0}; - return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + - 4u /*encapsulation*/; + 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(ser.get_serialized_data_length()); + return true; } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) + + bool GroundHandling_outputPubSubType::deserialize( + SerializedPayload_t& payload, + void* data) { - return 0; + try + { + // Convert DATA to pointer of your type + GroundHandling_output* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(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; } - } - void* GroundHandling_heartbeatPubSubType::create_data() - { - return reinterpret_cast(new GroundHandling_heartbeat()); - } - - void GroundHandling_heartbeatPubSubType::delete_data( - void* data) - { - delete(reinterpret_cast(data)); - } - - bool GroundHandling_heartbeatPubSubType::compute_key( - SerializedPayload_t& payload, - InstanceHandle_t& handle, - bool force_md5) - { - if (!is_compute_key_provided) + uint32_t GroundHandling_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(calculator.calculate_serialized_size( + *static_cast(data), current_alignment)) + + 4u /*encapsulation*/; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return 0; + } + } + + void* GroundHandling_outputPubSubType::create_data() + { + return reinterpret_cast(new GroundHandling_output()); + } + + void GroundHandling_outputPubSubType::delete_data( + void* data) + { + delete(reinterpret_cast(data)); + } + + bool GroundHandling_outputPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) + { + if (!is_compute_key_provided) + { + return false; + } + + GroundHandling_output data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + return false; } - GroundHandling_heartbeat data; - if (deserialize(payload, static_cast(&data))) + bool GroundHandling_outputPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, + bool force_md5) { - return compute_key(static_cast(&data), handle, force_md5); + if (!is_compute_key_provided) + { + return false; + } + + const GroundHandling_output* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), + XNSim_C909_ATA04_GroundHandling_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_GroundHandling_output_max_key_cdr_typesize > 16) + { + md5_.init(); + md5_.update(key_buffer_, static_cast(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; } - return false; - } - - bool GroundHandling_heartbeatPubSubType::compute_key( - const void* const data, - InstanceHandle_t& handle, - bool force_md5) - { - if (!is_compute_key_provided) + void GroundHandling_outputPubSubType::register_type_object_representation() { + register_GroundHandling_output_type_identifier(type_identifiers_); + } + + GroundHandling_heartbeatPubSubType::GroundHandling_heartbeatPubSubType() + { + set_name("XNSim::C909::ATA04::GroundHandling_heartbeat"); + uint32_t type_size = XNSim_C909_ATA04_GroundHandling_heartbeat_max_cdr_typesize; + type_size += static_cast(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_GroundHandling_heartbeat_max_key_cdr_typesize > 16 ? XNSim_C909_ATA04_GroundHandling_heartbeat_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); + } + + GroundHandling_heartbeatPubSubType::~GroundHandling_heartbeatPubSubType() + { + if (key_buffer_ != nullptr) + { + free(key_buffer_); + } + } + + bool GroundHandling_heartbeatPubSubType::serialize( + const void* const data, + SerializedPayload_t& payload, + DataRepresentationId_t data_representation) + { + const GroundHandling_heartbeat* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(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(ser.get_serialized_data_length()); + return true; + } + + bool GroundHandling_heartbeatPubSubType::deserialize( + SerializedPayload_t& payload, + void* data) + { + try + { + // Convert DATA to pointer of your type + GroundHandling_heartbeat* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(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 GroundHandling_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(calculator.calculate_serialized_size( + *static_cast(data), current_alignment)) + + 4u /*encapsulation*/; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return 0; + } + } + + void* GroundHandling_heartbeatPubSubType::create_data() + { + return reinterpret_cast(new GroundHandling_heartbeat()); + } + + void GroundHandling_heartbeatPubSubType::delete_data( + void* data) + { + delete(reinterpret_cast(data)); + } + + bool GroundHandling_heartbeatPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) + { + if (!is_compute_key_provided) + { + return false; + } + + GroundHandling_heartbeat data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + return false; } - const GroundHandling_heartbeat* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), - XNSim_ATA04_GroundHandling_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_ATA04_GroundHandling_heartbeat_max_key_cdr_typesize > 16) + bool GroundHandling_heartbeatPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, + bool force_md5) { - md5_.init(); - md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); - md5_.finalize(); - for (uint8_t i = 0; i < 16; ++i) + if (!is_compute_key_provided) { - handle.value[i] = md5_.digest[i]; + return false; } + + const GroundHandling_heartbeat* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), + XNSim_C909_ATA04_GroundHandling_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_GroundHandling_heartbeat_max_key_cdr_typesize > 16) + { + md5_.init(); + md5_.update(key_buffer_, static_cast(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; } - else + + void GroundHandling_heartbeatPubSubType::register_type_object_representation() { - for (uint8_t i = 0; i < 16; ++i) - { - handle.value[i] = key_buffer_[i]; - } + register_GroundHandling_heartbeat_type_identifier(type_identifiers_); } - return true; - } - void GroundHandling_heartbeatPubSubType::register_type_object_representation() - { - register_GroundHandling_heartbeat_type_identifier(type_identifiers_); - } + } // namespace ATA04 - } // namespace ATA04 + } // namespace C909 } // namespace XNSim diff --git a/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandlingPubSubTypes.hpp b/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandlingPubSubTypes.hpp index 29782d9..f9ac49a 100755 --- a/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandlingPubSubTypes.hpp +++ b/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandlingPubSubTypes.hpp @@ -20,8 +20,8 @@ */ -#ifndef FAST_DDS_GENERATED__XNSIM_ATA04_XNGROUNDHANDLING_PUBSUBTYPES_HPP -#define FAST_DDS_GENERATED__XNSIM_ATA04_XNGROUNDHANDLING_PUBSUBTYPES_HPP +#ifndef FAST_DDS_GENERATED__XNSIM_C909_ATA04_XNGROUNDHANDLING_PUBSUBTYPES_HPP +#define FAST_DDS_GENERATED__XNSIM_C909_ATA04_XNGROUNDHANDLING_PUBSUBTYPES_HPP #include #include @@ -39,253 +39,256 @@ namespace XNSim { - namespace ATA04 + namespace C909 { - - /*! - * @brief This class represents the TopicDataType of the type GroundHandling_input defined by the user in the IDL file. - * @ingroup XNGroundHandling - */ - class GroundHandling_inputPubSubType : public eprosima::fastdds::dds::TopicDataType + namespace ATA04 { - public: - typedef GroundHandling_input type; - - eProsima_user_DllExport GroundHandling_inputPubSubType(); - - eProsima_user_DllExport ~GroundHandling_inputPubSubType() 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 + /*! + * @brief This class represents the TopicDataType of the type GroundHandling_input defined by the user in the IDL file. + * @ingroup XNGroundHandling + */ + class GroundHandling_inputPubSubType : public eprosima::fastdds::dds::TopicDataType { - return true; - } + public: - #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + typedef GroundHandling_input type; - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + eProsima_user_DllExport GroundHandling_inputPubSubType(); - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + eProsima_user_DllExport ~GroundHandling_inputPubSubType() 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(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(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_output defined by the user in the IDL file. + * @ingroup XNGroundHandling + */ + class GroundHandling_outputPubSubType : public eprosima::fastdds::dds::TopicDataType { - static_cast(data_representation); - return false; - } + public: - #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + typedef GroundHandling_output type; - #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override + eProsima_user_DllExport GroundHandling_outputPubSubType(); + + eProsima_user_DllExport ~GroundHandling_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(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(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_heartbeat defined by the user in the IDL file. + * @ingroup XNGroundHandling + */ + class GroundHandling_heartbeatPubSubType : public eprosima::fastdds::dds::TopicDataType { - static_cast(memory); - return false; - } + public: - #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + typedef GroundHandling_heartbeat type; - private: + eProsima_user_DllExport GroundHandling_heartbeatPubSubType(); - eprosima::fastdds::MD5 md5_; - unsigned char* key_buffer_; + eProsima_user_DllExport ~GroundHandling_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; - /*! - * @brief This class represents the TopicDataType of the type GroundHandling_output defined by the user in the IDL file. - * @ingroup XNGroundHandling - */ - class GroundHandling_outputPubSubType : public eprosima::fastdds::dds::TopicDataType - { - public: + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; - typedef GroundHandling_output type; + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - eProsima_user_DllExport GroundHandling_outputPubSubType(); + 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 ~GroundHandling_outputPubSubType() 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 bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t& payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + eProsima_user_DllExport void* create_data() override; - eProsima_user_DllExport bool deserialize( - eprosima::fastdds::rtps::SerializedPayload_t& payload, - void* data) override; + eProsima_user_DllExport void delete_data( + void* data) override; - eProsima_user_DllExport uint32_t calculate_serialized_size( - const void* const data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_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; + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return true; + } - eProsima_user_DllExport bool compute_key( - const void* const data, - eprosima::fastdds::rtps::InstanceHandle_t& ihandle, - bool force_md5 = false) override; + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport void* create_data() override; + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport void delete_data( - void* data) override; + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } - //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() override; + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } - #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + private: - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - static_cast(data_representation); - return false; - } + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; - #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(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_heartbeat defined by the user in the IDL file. - * @ingroup XNGroundHandling - */ - class GroundHandling_heartbeatPubSubType : public eprosima::fastdds::dds::TopicDataType - { - public: - - typedef GroundHandling_heartbeat type; - - eProsima_user_DllExport GroundHandling_heartbeatPubSubType(); - - eProsima_user_DllExport ~GroundHandling_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(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(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 XNSim -#endif // FAST_DDS_GENERATED__XNSIM_ATA04_XNGROUNDHANDLING_PUBSUBTYPES_HPP +#endif // FAST_DDS_GENERATED__XNSIM_C909_ATA04_XNGROUNDHANDLING_PUBSUBTYPES_HPP diff --git a/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandlingTypeObjectSupport.cxx b/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandlingTypeObjectSupport.cxx index 5ef8935..ace864c 100755 --- a/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandlingTypeObjectSupport.cxx +++ b/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandlingTypeObjectSupport.cxx @@ -39,6 +39,7 @@ using namespace eprosima::fastdds::dds::xtypes; namespace XNSim { +namespace C909 { namespace ATA04 { // TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method void register_GroundHandling_input_type_identifier( @@ -48,12 +49,12 @@ void register_GroundHandling_input_type_identifier( ReturnCode_t return_code_GroundHandling_input {eprosima::fastdds::dds::RETCODE_OK}; return_code_GroundHandling_input = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "XNSim::ATA04::GroundHandling_input", type_ids_GroundHandling_input); + "XNSim::C909::ATA04::GroundHandling_input", type_ids_GroundHandling_input); if (eprosima::fastdds::dds::RETCODE_OK != return_code_GroundHandling_input) { StructTypeFlag struct_flags_GroundHandling_input = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, false, false); - QualifiedTypeName type_name_GroundHandling_input = "XNSim::ATA04::GroundHandling_input"; + QualifiedTypeName type_name_GroundHandling_input = "XNSim::C909::ATA04::GroundHandling_input"; eprosima::fastcdr::optional type_ann_builtin_GroundHandling_input; eprosima::fastcdr::optional ann_custom_GroundHandling_input; CompleteTypeDetail detail_GroundHandling_input = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_GroundHandling_input, ann_custom_GroundHandling_input, type_name_GroundHandling_input.to_string()); @@ -2058,7 +2059,7 @@ void register_GroundHandling_input_type_identifier( TypeObjectUtils::build_and_register_struct_type_object(struct_type_GroundHandling_input, type_name_GroundHandling_input.to_string(), type_ids_GroundHandling_input)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "XNSim::ATA04::GroundHandling_input already registered in TypeObjectRegistry for a different type."); + "XNSim::C909::ATA04::GroundHandling_input already registered in TypeObjectRegistry for a different type."); } } } @@ -2070,12 +2071,12 @@ void register_GroundHandling_output_type_identifier( ReturnCode_t return_code_GroundHandling_output {eprosima::fastdds::dds::RETCODE_OK}; return_code_GroundHandling_output = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "XNSim::ATA04::GroundHandling_output", type_ids_GroundHandling_output); + "XNSim::C909::ATA04::GroundHandling_output", type_ids_GroundHandling_output); if (eprosima::fastdds::dds::RETCODE_OK != return_code_GroundHandling_output) { StructTypeFlag struct_flags_GroundHandling_output = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, false, false); - QualifiedTypeName type_name_GroundHandling_output = "XNSim::ATA04::GroundHandling_output"; + QualifiedTypeName type_name_GroundHandling_output = "XNSim::C909::ATA04::GroundHandling_output"; eprosima::fastcdr::optional type_ann_builtin_GroundHandling_output; eprosima::fastcdr::optional ann_custom_GroundHandling_output; CompleteTypeDetail detail_GroundHandling_output = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_GroundHandling_output, ann_custom_GroundHandling_output, type_name_GroundHandling_output.to_string()); @@ -4292,7 +4293,7 @@ void register_GroundHandling_output_type_identifier( TypeObjectUtils::build_and_register_struct_type_object(struct_type_GroundHandling_output, type_name_GroundHandling_output.to_string(), type_ids_GroundHandling_output)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "XNSim::ATA04::GroundHandling_output already registered in TypeObjectRegistry for a different type."); + "XNSim::C909::ATA04::GroundHandling_output already registered in TypeObjectRegistry for a different type."); } } } @@ -4304,12 +4305,12 @@ void register_GroundHandling_heartbeat_type_identifier( ReturnCode_t return_code_GroundHandling_heartbeat {eprosima::fastdds::dds::RETCODE_OK}; return_code_GroundHandling_heartbeat = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "XNSim::ATA04::GroundHandling_heartbeat", type_ids_GroundHandling_heartbeat); + "XNSim::C909::ATA04::GroundHandling_heartbeat", type_ids_GroundHandling_heartbeat); if (eprosima::fastdds::dds::RETCODE_OK != return_code_GroundHandling_heartbeat) { StructTypeFlag struct_flags_GroundHandling_heartbeat = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, false, false); - QualifiedTypeName type_name_GroundHandling_heartbeat = "XNSim::ATA04::GroundHandling_heartbeat"; + QualifiedTypeName type_name_GroundHandling_heartbeat = "XNSim::C909::ATA04::GroundHandling_heartbeat"; eprosima::fastcdr::optional type_ann_builtin_GroundHandling_heartbeat; eprosima::fastcdr::optional ann_custom_GroundHandling_heartbeat; CompleteTypeDetail detail_GroundHandling_heartbeat = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_GroundHandling_heartbeat, ann_custom_GroundHandling_heartbeat, type_name_GroundHandling_heartbeat.to_string()); @@ -4364,12 +4365,14 @@ void register_GroundHandling_heartbeat_type_identifier( TypeObjectUtils::build_and_register_struct_type_object(struct_type_GroundHandling_heartbeat, type_name_GroundHandling_heartbeat.to_string(), type_ids_GroundHandling_heartbeat)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "XNSim::ATA04::GroundHandling_heartbeat already registered in TypeObjectRegistry for a different type."); + "XNSim::C909::ATA04::GroundHandling_heartbeat already registered in TypeObjectRegistry for a different type."); } } } } // namespace ATA04 +} // namespace C909 + } // namespace XNSim diff --git a/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandlingTypeObjectSupport.hpp b/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandlingTypeObjectSupport.hpp index 7014822..b95411b 100755 --- a/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandlingTypeObjectSupport.hpp +++ b/XNModels/XNGroundHandling/XNGroundHandlingInterface/XNGroundHandlingTypeObjectSupport.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef FAST_DDS_GENERATED__XNSIM_ATA04_XNGROUNDHANDLING_TYPE_OBJECT_SUPPORT_HPP -#define FAST_DDS_GENERATED__XNSIM_ATA04_XNGROUNDHANDLING_TYPE_OBJECT_SUPPORT_HPP +#ifndef FAST_DDS_GENERATED__XNSIM_C909_ATA04_XNGROUNDHANDLING_TYPE_OBJECT_SUPPORT_HPP +#define FAST_DDS_GENERATED__XNSIM_C909_ATA04_XNGROUNDHANDLING_TYPE_OBJECT_SUPPORT_HPP #include @@ -38,6 +38,7 @@ #ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC namespace XNSim { +namespace C909 { namespace ATA04 { /** * @brief Register GroundHandling_input related TypeIdentifier. @@ -80,9 +81,11 @@ eProsima_user_DllExport void register_GroundHandling_heartbeat_type_identifier( } // namespace ATA04 +} // namespace C909 + } // namespace XNSim #endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC -#endif // FAST_DDS_GENERATED__XNSIM_ATA04_XNGROUNDHANDLING_TYPE_OBJECT_SUPPORT_HPP +#endif // FAST_DDS_GENERATED__XNSIM_C909_ATA04_XNGROUNDHANDLING_TYPE_OBJECT_SUPPORT_HPP