You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
1.3 KiB
C

1 year ago
#pragma once
#include <string>
#include <vector>
#include <map>
#include <list>
#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<std::string, int> datas;
std::list<Param> 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;
};