Node — darra::opcua::Node
Node Yes NodeCollection The wrapper object returned by the indexer represents a remote node. Lazy Load — Only access methods trigger RPC.
Prerequisite Reading
- For the entry point, see NodeCollection.
- To avoid multiple lookups in a chained index, use RPC TranslateBrowsePaths Parse the path once.
Public Methods (Accessors)
| Category | Property | Type | Access | Description |
|---|---|---|---|---|
| Tags (None RPC) | NodeId() | std::string const& | R | Node ID string |
| Data (Trigger RPC) | Value() | DataValue | R | Current value — triggers Read(Value) |
DisplayName() | std::string | R | Display name — triggers Read(DisplayName) | |
BrowseName() | std::string | R | View name — triggers Read(BrowseName) | |
Description() | std::string | R | Description — Triggers Read(Description) | |
GetNodeClass() | NodeClass | R | Node class — triggers Read(NodeClass) | |
IsReadable() | bool | R | AccessLevel bit 0 — triggers Read(AccessLevel) | |
IsWritable() | bool | R | AccessLevel bit 1 — triggers Read(AccessLevel) | |
| Owner | Owner() | Session& | R | Reference to the associated Session |
Indexer
| Index | Return | Note |
|---|---|---|
| node[std::string const& browse_name] | Node | Child Nodes (Browse BrowseName by) |
Public Methods
| Methods | Note |
|---|---|
| ReadAttribute(attr) | Reads the specified attribute and returns DataValue |
| Write(variant) | Write the Value property |
| WriteAttribute(attr, variant) | Write a Specified Attribute |
| Children(filter = Unspecified) | Iterate through child nodes; return std::vector<Reference> |
| Resolve(path) | Click for an in-depth BrowsePath analysis |
| Call(parent_obj_id, inputs) | Call this node as a method (this node must be of type Method) |
Examples
// 1. Get Node (None RPC)
auto temp = s.Nodes()["ns=2;s=Temperature"];
// 2. Read the basic information (1 RPC each)
std::cout << "NodeId = " << temp.NodeId() << "\n";
std::cout << "DisplayName = " << temp.DisplayName() << "\n";
std::cout << "NodeClass = " << static_cast<int>(temp.GetNodeClass()) << "\n";
// 3. Read the value
auto dv = temp.Value();
double t = 0; dv.Value().TryGetDouble(t);
std::cout << "Value = " << t << " degC ft=" << dv.SourceTimestamp() << "\n";
// 4. Write
Variant v; v.SetDouble(25.5);
temp.Write(v);
// 5. Browse Subnodes
for (auto const& child : temp.Children()) {
std::cout << " " << child.browse_name << " -> " << child.node_id << "\n";
}
// 6. Chained Access (Server.ServerStatus.CurrentTime)
auto time = s.Nodes().Server()["ServerStatus"]["CurrentTime"].Value();
std::cout << "Server time ft=" << time.Value().AsFileTime() << "\n";
Important Notes
- All methods RPC that are triggered follow a "read-once, return-once" pattern, Do not cache. I want to cache a variable I've stored myself
- Chain-based access: One access
a["b"]["c"]per segment Browse RPC, for a total of N accesses DataValueIt is a stack object; when it goes out of scope, it is automatically destroyed and the memory is released.NodeIt only holds a string NodeId and a pointerSession, but every method must go through the Session to reach the C layer, SDK None Do not make any thread-safety guarantees—if the same resource is shared across threadsSession, youNodemust lock it yourself.
Comparison with Resolve
Resolve Corresponds to Side C DarraUa_Session_ResolveBrowsePath — Send once for each path Browse, rather than RPC solving the entire path in a single pass (by Browse traversing the path continuously, without using the service TranslateBrowsePaths ).
// Method A: Linked Indexer - 3 operations RPC (2 operations Browse + 1 read)
auto time = s.Nodes().Server()["ServerStatus"]["CurrentTime"].Value();
// Browse #1 Browse #2 Read #3
// Method B: Path Resolution—5 times RPC (4 path segments = 4 times Browse, plus 1 Read)
auto node = s.Resolve("/Objects/Server/ServerStatus/CurrentTime"); // 4 times Browse
auto time = node.Value(); // 1 view
// Method C: Directly NodeId - 1 time RPC
auto time = s.Read("i=2258");
To RPC solve multiple paths at once, use TranslateBrowsePaths (Batch, Single RPC). Known path → Method C; Exploratory development → Method A.