lordgamez commented on code in PR #2259:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2259#discussion_r3980756135
##########
extensions/opc/tests/OpcUaTestServer.h:
##########
@@ -134,17 +212,148 @@ class OpcUaTestServer {
}
private:
- UA_NodeId addObject(const char *name, UA_NodeId parent) {
+ static std::string nodeIdToString(const UA_NodeId& id) {
+ if (id.identifierType == UA_NODEIDTYPE_STRING) {
+ return std::string(reinterpret_cast<const
char*>(id.identifier.string.data), id.identifier.string.length);
+ } else if (id.identifierType == UA_NODEIDTYPE_NUMERIC) {
+ return std::to_string(id.identifier.numeric);
+ } else if (id.identifierType == UA_NODEIDTYPE_GUID) {
+ char guid_str[37];
+ snprintf(guid_str,
+ sizeof(guid_str),
+ "%08x-%04x-%04x-%04x-%012" PRIx64,
+ id.identifier.guid.data1,
+ id.identifier.guid.data2,
+ id.identifier.guid.data3,
+ (id.identifier.guid.data4[0] << 8) | id.identifier.guid.data4[1],
+ (gsl::narrow<uint64_t>(id.identifier.guid.data4[2]) << 40) |
(gsl::narrow<uint64_t>(id.identifier.guid.data4[3]) << 32) |
+ (gsl::narrow<uint64_t>(id.identifier.guid.data4[2]) << 40) |
(gsl::narrow<uint64_t>(id.identifier.guid.data4[3]) << 32) |
+ (gsl::narrow<uint64_t>(id.identifier.guid.data4[4]) << 24) |
(gsl::narrow<uint64_t>(id.identifier.guid.data4[5]) << 16) |
+ (gsl::narrow<uint64_t>(id.identifier.guid.data4[6]) << 8) |
gsl::narrow<uint64_t>(id.identifier.guid.data4[7]));
Review Comment:
Added proper GUID support in
https://github.com/apache/nifi-minifi-cpp/pull/2259/commits/4744af4d3d02f1d747ede09b61156aec440f3998
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]