DVSenseDriver  1.0.1
The SDK for dvsense products.
ToolInfo.h
1 #ifndef __TOOLINFO_H__
2 #define __TOOLINFO_H__
3 
4 #include <vector>
5 #include <string>
6 
7 #ifdef _WIN32
8 #define DVSENSE_API __declspec(dllexport)
9 #else
10 #define DVSENSE_API
11 #endif // _WIN32
12 
13 
14 
15 namespace dvsense
16 {
22  enum class DVSENSE_API ToolType
23  {
24  BIAS,
25  };
26 
31  struct DVSENSE_API ToolInfo
32  {
33  ToolType tool_type;
34  std::vector<std::string> parameter_names;
35  std::string description;
36  };
37 
42  enum class DVSENSE_API ToolParameterType
43  {
44  INT,
45  FLOAT,
46  BOOL,
47  STRING,
48  ENUM
49  };
50 
60  std::string DVSENSE_API ToolParameterTypeToString(ToolParameterType type);
61 
69  struct DVSENSE_API BasicParameterInfo {
70  std::string name;
71  std::string description;
72  ToolParameterType type;
73  std::string toString() {
74  return "Name: " + name + " Description: " + description + " Type: " + ToolParameterTypeToString(type);
75  }
76  };
77 
83  struct DVSENSE_API IntParameterInfo {
84  int min;
85  int max;
87  std::string unit;
88  std::string toString() {
89  return "Min: " + std::to_string(min) + " Max: " + std::to_string(max) + " Default: " + std::to_string(default_value) + " Unit: " + unit;
90  }
91  int constraintValue(int value) {
92  if (value < min) {
93  return min;
94  }
95  if (value > max) {
96  return max;
97  }
98  return value;
99  }
100  };
101 
107  struct DVSENSE_API FloatParameterInfo {
108  float min;
109  float max;
111  std::string unit;
112  std::string toString() {
113  return "Min: " + std::to_string(min) + " Max: " + std::to_string(max) + " Default: " + std::to_string(default_value) + " Unit: " + unit;
114  }
115  float constraintValue(float value) {
116  if (value < min) {
117  return min;
118  }
119  if (value > max) {
120  return max;
121  }
122  return value;
123  }
124  };
125 
131  struct DVSENSE_API BoolParameterInfo {
133  std::string toString() {
134  return "Default: " + std::to_string(default_value);
135  }
136  };
137 
143  struct DVSENSE_API EnumParameterInfo {
144  std::vector<std::string> options;
145  std::string default_value;
146  std::string toString() {
147  return "Options: " + std::to_string(options.size()) + " Default: " + default_value;
148  }
149  };
150 
151 } // namespace dvsense
152 
153 
154 #endif
Definition: TypeUtils.hpp:7
std::string description
Definition: ToolInfo.h:35
ToolType tool_type
Definition: ToolInfo.h:33
std::vector< std::string > parameter_names
Definition: ToolInfo.h:34
std::string DVSENSE_API ToolParameterTypeToString(ToolParameterType type)
将 ToolParameterType 转换为字符串。
工具的信息,包括类型、可以更改的参数名称和描述。
Definition: ToolInfo.h:32
参数的基本信息,包括名称、描述和类型。\ 要获取详细信息,请参考 CameraTool::getParamInfo 。
Definition: ToolInfo.h:69
ToolParameterType type
Definition: ToolInfo.h:72
std::string toString()
Definition: ToolInfo.h:73
std::string name
Definition: ToolInfo.h:70
std::string description
Definition: ToolInfo.h:71
布尔参数的详细信息。
Definition: ToolInfo.h:131
std::string toString()
Definition: ToolInfo.h:133
bool default_value
Definition: ToolInfo.h:132
枚举参数的详细信息。
Definition: ToolInfo.h:143
std::string toString()
Definition: ToolInfo.h:146
std::vector< std::string > options
Definition: ToolInfo.h:144
std::string default_value
Definition: ToolInfo.h:145
浮点数参数的详细信息。
Definition: ToolInfo.h:107
std::string unit
Definition: ToolInfo.h:111
float default_value
Definition: ToolInfo.h:110
std::string toString()
Definition: ToolInfo.h:112
float max
Definition: ToolInfo.h:109
float min
Definition: ToolInfo.h:108
float constraintValue(float value)
Definition: ToolInfo.h:115
整数参数的详细信息。
Definition: ToolInfo.h:83
int max
Definition: ToolInfo.h:85
std::string toString()
Definition: ToolInfo.h:88
int min
Definition: ToolInfo.h:84
std::string unit
Definition: ToolInfo.h:87
int constraintValue(int value)
Definition: ToolInfo.h:91
int default_value
Definition: ToolInfo.h:86