#pragma once #include #include #include #include #include "data/Data.h" /* * 结构类型数据 *TorqueMode * */ // 扭矩参数 class Param { public: Param(std::string name, int value) : m_name(name), m_value(value) {}; virtual ~Param() {}; std::string getName() { return m_name; } int getValue() { return m_value; } private: const std::string m_name; const int m_value; }; typedef struct { unsigned char type; // 设置类型 // 名称,系数 //std::map datas; std::list datas; }tagParam; class StructData : public Data { public: StructData(); StructData(tagParam *data); virtual ~StructData() {}; Data* clone() override; void copy(Data* data) override; void copy(Data& data) override; int length() override; // 转换为字符串格式 virtual std::string toStr() override; // 转换为Byte字符串 virtual std::string toByteStr() override; // 转换为十六进制字符串 virtual std::string toHexStr() override; // 根据Byte字符串解析数据 virtual bool fromByteStr(std::string str = "") override; tagParam& getData() { return m_data; } void setData(tagParam& data); private: tagParam m_data; };