23 #include "ros_opcua_msgs/Address.h" 24 #include "ros_opcua_msgs/TypeValue.h" 142 ros_opcua_msgs::TypeValue typeValue;
146 if (typeValue.type ==
"bool") {
147 typeValue.bool_d = (bool)variant;
149 else if (typeValue.type ==
"int8") {
150 typeValue.int8_d = (int8_t)variant;
152 else if (typeValue.type ==
"uint8") {
153 typeValue.uint8_d = (uint8_t)variant;
155 else if (typeValue.type ==
"int16") {
156 typeValue.int16_d = (int16_t)variant;
158 else if (typeValue.type ==
"uint16") {
159 typeValue.uint16_d = (uint16_t)variant;
161 else if (typeValue.type ==
"int32") {
162 typeValue.int32_d = (int32_t)variant;
164 else if (typeValue.type ==
"uint32") {
165 typeValue.uint32_d = (uint32_t)variant;
167 else if (typeValue.type ==
"int64") {
168 typeValue.int64_d = (int64_t)variant;
170 else if (typeValue.type ==
"uint64") {
171 typeValue.uint64_d = (uint64_t)variant;
173 else if (typeValue.type ==
"float" || typeValue.type ==
"float32") {
174 typeValue.float_d = (float)variant;
176 else if (typeValue.type ==
"double" || typeValue.type ==
"float64") {
177 typeValue.double_d = (double)variant;
179 else if (typeValue.type ==
"string") {
183 typeValue.type =
"Unknown";
198 if (typeValue.type ==
"bool") {
199 variant = bool(typeValue.bool_d);
201 else if (typeValue.type ==
"int8") {
202 variant = typeValue.int8_d;
204 else if (typeValue.type ==
"uint8") {
205 variant = typeValue.uint8_d;
207 else if (typeValue.type ==
"int16") {
208 variant = typeValue.int16_d;
210 else if (typeValue.type ==
"uint16") {
211 variant = typeValue.uint16_d;
213 else if (typeValue.type ==
"int32") {
214 variant = typeValue.int32_d;
216 else if (typeValue.type ==
"uint32") {
217 variant = typeValue.uint32_d;
219 else if (typeValue.type ==
"int64") {
220 variant = typeValue.int64_d;
222 else if (typeValue.type ==
"uint64") {
223 variant = typeValue.uint64_d;
225 else if (typeValue.type ==
"float" || typeValue.type ==
"float32") {
226 variant = typeValue.float_d;
228 else if (typeValue.type ==
"double" || typeValue.type ==
"float64") {
229 variant = typeValue.double_d;
231 else if (typeValue.type ==
"string") {
232 variant = typeValue.string_d;
std::map< int, std::string > _TypeToStringMap
Remapping between ROS types and OpenOpcUa types.
ros_opcua_msgs::TypeValue convertVariantToTypeValue(const OpcUa::Variant &variant)
OpcUa::Variant convertTypeValueToVariant(ros_opcua_msgs::TypeValue &typeValue)