41 lines
1.3 KiB
C++
41 lines
1.3 KiB
C++
#pragma once
|
|
#include "../C909_V1PubSubTypes.hpp"
|
|
#include "XNCore/XNDDSInterface.h"
|
|
namespace XNSim::C909::ATA04
|
|
{
|
|
class WeightBalance_heartbeat_Interface : public XNDDSInterface
|
|
{
|
|
public:
|
|
using DDSType = XNSim::C909::ATA04::WeightBalance_heartbeat;
|
|
using DDSPubSubType = XNSim::C909::ATA04::WeightBalance_heartbeatPubSubType;
|
|
static const std::string topic_name;
|
|
WeightBalance_heartbeat_Interface();
|
|
virtual ~WeightBalance_heartbeat_Interface();
|
|
virtual void Initialize(XNFrameworkPtr framework, uint32_t modelId, uint32_t DDS_type) override;
|
|
virtual void clearOutData() override;
|
|
virtual void sendOutData() override;
|
|
void inputDataListener(const XNSim::C909::ATA04::WeightBalance_heartbeat &input);
|
|
template <typename T>
|
|
void getData(T *model_data)
|
|
{
|
|
std::lock_guard<std::mutex> lock(dataMutex);
|
|
if(model_data == nullptr)
|
|
return;
|
|
assign_value_get(data.weightbody_model_heartbeat(), model_data->weightbody_model_heartbeat);
|
|
}
|
|
template <typename T>
|
|
void setData(T *model_data)
|
|
{
|
|
if(model_data == nullptr)
|
|
return;
|
|
std::lock_guard<std::mutex> lock(outDataMutex);
|
|
clearOutData();
|
|
assign_value_set(out_data.weightbody_model_heartbeat(), model_data->weightbody_model_heartbeat);
|
|
sendOutData();
|
|
}
|
|
protected:
|
|
DDSType data;
|
|
DDSType out_data;
|
|
};
|
|
}
|