| 477 | } |
| 478 | |
| 479 | std::string nodeValue2String(const NodeData& nd) { |
| 480 | std::string ret_val; |
| 481 | switch (nd.dataTypeID) { |
| 482 | case UA_TYPES_STRING: |
| 483 | case UA_TYPES_LOCALIZEDTEXT: |
| 484 | case UA_TYPES_BYTESTRING: { |
| 485 | UA_String value = *(UA_String *)(nd.var_->data); |
| 486 | ret_val = std::string(reinterpret_cast<const char *>(value.data), value.length); |
| 487 | break; |
| 488 | } |
| 489 | case UA_TYPES_BOOLEAN: |
| 490 | bool b; |
| 491 | memcpy(&b, nd.data.data(), sizeof(bool)); |
| 492 | ret_val = b ? "True" : "False"; |
| 493 | break; |
| 494 | case UA_TYPES_SBYTE: |
| 495 | int8_t i8t; |
| 496 | memcpy(&i8t, nd.data.data(), sizeof(i8t)); |
| 497 | ret_val = std::to_string(i8t); |
| 498 | break; |
| 499 | case UA_TYPES_BYTE: |
| 500 | uint8_t ui8t; |
| 501 | memcpy(&ui8t, nd.data.data(), sizeof(ui8t)); |
| 502 | ret_val = std::to_string(ui8t); |
| 503 | break; |
| 504 | case UA_TYPES_INT16: |
| 505 | int16_t i16t; |
| 506 | memcpy(&i16t, nd.data.data(), sizeof(i16t)); |
| 507 | ret_val = std::to_string(i16t); |
| 508 | break; |
| 509 | case UA_TYPES_UINT16: |
| 510 | uint16_t ui16t; |
| 511 | memcpy(&ui16t, nd.data.data(), sizeof(ui16t)); |
| 512 | ret_val = std::to_string(ui16t); |
| 513 | break; |
| 514 | case UA_TYPES_INT32: |
| 515 | int32_t i32t; |
| 516 | memcpy(&i32t, nd.data.data(), sizeof(i32t)); |
| 517 | ret_val = std::to_string(i32t); |
| 518 | break; |
| 519 | case UA_TYPES_UINT32: |
| 520 | uint32_t ui32t; |
| 521 | memcpy(&ui32t, nd.data.data(), sizeof(ui32t)); |
| 522 | ret_val = std::to_string(ui32t); |
| 523 | break; |
| 524 | case UA_TYPES_INT64: |
| 525 | int64_t i64t; |
| 526 | memcpy(&i64t, nd.data.data(), sizeof(i64t)); |
| 527 | ret_val = std::to_string(i64t); |
| 528 | break; |
| 529 | case UA_TYPES_UINT64: |
| 530 | uint64_t ui64t; |
| 531 | memcpy(&ui64t, nd.data.data(), sizeof(ui64t)); |
| 532 | ret_val = std::to_string(ui64t); |
| 533 | break; |
| 534 | case UA_TYPES_FLOAT: |
| 535 | if(sizeof(float) == 4 && std::numeric_limits<float>::is_iec559){ |
| 536 | float f; |
no test coverage detected