#include <iomanip>
#include <iostream>
#include <string_view>
switch (nodeClass) {
return "Object";
return "Variable";
return "Method";
return "ObjectType";
return "VariableType";
return "ReferenceType";
return "DataType";
return "View";
default:
return "Unknown";
}
}
for (auto&& child : node.browseChildren()) {
std::cout << std::setw(indent) << "- " << child.readBrowseName().getName() << " ("
<< getEnumName(child.readNodeClass()) << ")\n";
printNodeTree(child, indent + 2);
}
}
int main() {
client.
connect(
"opc.tcp://localhost:4840");
printNodeTree(nodeRoot, 0);
auto nodeServer = nodeRoot.browseChild({{0, "Objects"}, {0, "Server"}});
auto nodeServerParent = nodeServer.browseParent();
std::cout << nodeServer.readDisplayName().getText() << "'s parent node is "
<< nodeServerParent.readDisplayName().getText() << "\n";
}
void connect(std::string_view endpointUrl)
Connect to the selected server.
High-level node class to access node attribute, browse and populate address space.