Address space

The node/reference graph model, instantiation engine, conditions, and NodeSet helpers.

ua::ConditionBranch

struct

A prior condition state that was retained because it still needs operator attention.

A branch is created when the trunk transitions while an unacknowledged or unconfirmed state is outstanding, so the earlier state is not lost. The snapshot is a polymorphic BaseEvent captured via build_event() at branch-creation time; acknowledgement and confirmation are tracked by mutating the snapshot's fields in place.

Public attributes

NodeId branchId

Non-null Guid NodeId identifying this branch.

ByteString eventId

EventId of the branch's last emitted event; assigned by the shell after emission.

std::unique_ptr< BaseEvent > snapshot

Owned snapshot of the full event state at branch-creation time.

ua::AcknowledgeableConditionLogic

class

Pure state machine for the OPC UA AcknowledgeableConditionType (Part 9).

Extends ConditionLogic with AckedState and an optional ConfirmedState, and tracks any outstanding branches. The retain computation accounts for acknowledgement and confirmation in addition to enable state. Like its base, this holds state only: no I/O, no address space, no strands. A strand-serialized shell drives async work and feeds results back via the setters.

Functions

~AcknowledgeableConditionLogic() override=default
AcknowledgeableConditionLogic()=default

Default constructor: the deleted copy/move members above suppress the implicit default ctor; this concrete logic type is default-constructed directly and by subclasses.

ConditionStateTransition acknowledge(const ByteString &eventId, const LocalizedText &comment)

Acknowledges the condition (or branch) identified by an EventId.

  • eventId (const ByteString &) - EventId of the trunk or branch event being acknowledged.
  • comment (const LocalizedText &) - Operator comment to attach to the acknowledgement.

Returns: The resulting transition. Its status is BadEventIdUnknown if eventId matches no outstanding event, or BadConditionBranchAlreadyAcked if it is already acknowledged.

ConditionStateTransition add_comment(const ByteString &eventId, const LocalizedText &comment) override

Adds a comment to the condition or one of its branches.

  • eventId (const ByteString &) - EventId of the trunk or branch event to comment on.
  • comment (const LocalizedText &) - Comment to attach.

Returns: The resulting transition; its status is BadEventIdUnknown if eventId matches no outstanding event.

ConditionStateTransition confirm(const ByteString &eventId, const LocalizedText &comment)

Confirms the condition (or branch) identified by an EventId.

  • eventId (const ByteString &) - EventId of the trunk or branch event being confirmed.
  • comment (const LocalizedText &) - Operator comment to attach to the confirmation.

Returns: The resulting transition. Its status is BadEventIdUnknown if eventId matches no outstanding event, or BadConditionBranchAlreadyConfirmed if it is already confirmed or if confirmation is not supported.

bool supports_confirm() const

Returns whether ConfirmedState is supported.

Returns: true if ConfirmedState is supported.

void set_supports_confirm(bool value)

Enables or disables ConfirmedState support.

  • value (bool) - true to enable ConfirmedState support; false to disable it.
void set_supports_branches(bool value)

Enables or disables branch support (optional per Part 9 4.2).

  • value (bool) - true to enable branch support; false to disable it.
void set_max_branches(size_t maxBranches)

Sets the maximum number of live ConditionBranches retained at once (memory bound).

  • maxBranches (size_t) - Maximum number of live ConditionBranches to retain at once; clamped to a minimum of 1.
const std::vector< ConditionBranch > & branches() const

Returns read-only access to the live branches.

Returns: The live branches; the reference stays valid only until the next mutation of this logic object.

void set_branch_event_id(const NodeId &branchId, ByteString eventId)

Records the EventId assigned by the EventBus after emitting a branch event.

  • branchId (const NodeId &) - Identifier of the branch to update.
  • eventId (ByteString) - EventId assigned to the branch's most recent event.
void remove_branch(const NodeId &branchId)

Removes a resolved branch.

  • branchId (const NodeId &) - Identifier of the branch to remove.
std::unique_ptr< BaseEvent > build_branch_event(const NodeId &branchId, bool retain) const

Builds a clone of a branch's snapshot event with its branch_id and Retain flag set.

  • branchId (const NodeId &) - Identifier of the branch to clone.
  • retain (bool) - Value to set on the cloned event's Retain field.

Returns: An owned clone of the branch's snapshot, or nullptr if no branch matches branchId.

void set_last_event_id(ByteString eventId) override

Records the EventId assigned after emitting the trunk event.

  • eventId (ByteString) - EventId assigned to the most recently emitted trunk event.
void set_initial_acked(bool acked)

Sets the initial acknowledged state without triggering transitions or events.

  • acked (bool) - Initial AckedState.Id value.
void set_initial_confirmed(bool confirmed)

Sets the initial confirmed state without triggering transitions or events.

  • confirmed (bool) - Initial ConfirmedState.Id value.
std::unique_ptr< BaseEvent > build_event() const override

Builds an AcknowledgeableConditionType event struct from the current state.

Returns: An owned event carrying the current condition state.

ua::AlarmConditionLogic

class

Pure state machine for the OPC UA AlarmConditionType (Part 9).

Extends AcknowledgeableConditionLogic with ActiveState plus the optional alarm sub-states: shelving, suppression, out-of-service, silence, latching, and on/off delay behaviour. Like its base classes this is a pure logic object: it performs no I/O, owns no address space, and is not strand-serialized. Each mutator returns a ConditionStateTransition that a strand-serialized shell inspects to drive event emission and timer commands; none of these methods throw.

Functions

~AlarmConditionLogic() override=default
AlarmConditionLogic()=default

Default constructor: the deleted copy/move members above suppress the implicit default ctor; this concrete logic type is default-constructed directly and by subclasses.

ConditionStateTransition activate(uint16_t severity)

Activates the alarm.

  • severity (uint16_t) - New alarm severity, 1..1000 per Part 8.

Returns: The resulting state transition for the shell to apply.

ConditionStateTransition deactivate()

Deactivates the alarm.

Returns: The resulting state transition for the shell to apply.

ConditionStateTransition suppress()

Sets SuppressedState to suppressed.

Returns: The resulting state transition. No-op unless suppression is supported.

ConditionStateTransition suppress(const LocalizedText &comment)

Suppresses the alarm and records a comment against it (Suppress2, OPC 10000-9 5.8.9).

  • comment (const LocalizedText &) - Comment to apply; a NULL comment leaves any existing one unchanged.

Returns: The resulting state transition, identical to suppress().

ConditionStateTransition unsuppress()

Clears SuppressedState back to unsuppressed.

Returns: The resulting state transition. No-op unless suppression is supported.

ConditionStateTransition unsuppress(const LocalizedText &comment)

Unsuppresses the alarm and records a comment against it (Unsuppress2, OPC 10000-9 5.8.11).

  • comment (const LocalizedText &) - Comment to apply; a NULL comment leaves any existing one unchanged.

Returns: The resulting state transition, identical to unsuppress().

ConditionStateTransition remove_from_service()

Sets OutOfServiceState to out-of-service.

Returns: The resulting state transition. No-op unless out-of-service is supported.

ConditionStateTransition remove_from_service(const LocalizedText &comment)

Takes the alarm out of service and records a comment against it (RemoveFromService2, OPC 10000-9 5.8.13).

  • comment (const LocalizedText &) - Comment to apply; a NULL comment leaves any existing one unchanged.

Returns: The resulting state transition, identical to remove_from_service().

ConditionStateTransition place_in_service()

Clears OutOfServiceState back to in-service.

Returns: The resulting state transition. No-op unless out-of-service is supported.

ConditionStateTransition place_in_service(const LocalizedText &comment)

Returns the alarm to service and records a comment against it (PlaceInService2, OPC 10000-9 5.8.15).

  • comment (const LocalizedText &) - Comment to apply; a NULL comment leaves any existing one unchanged.

Returns: The resulting state transition, identical to place_in_service().

ConditionStateTransition silence()

Sets SilenceState to silenced.

Returns: The resulting state transition. No-op unless silence is supported.

ConditionStateTransition timed_shelve(double durationMs)

Shelves the alarm for a fixed duration (TimedShelved).

  • durationMs (double) - Shelve duration in milliseconds. Refused with Bad_ShelvingTimeOutOfRange when negative, NaN or past a configured MaxTimeShelved.

Returns: The resulting state transition, including a start-shelve-timer command for the shell.

ConditionStateTransition timed_shelve(double durationMs, const LocalizedText &comment)

Shelves the alarm for a fixed duration and records a comment against it (TimedShelve2, OPC 10000-9 5.8.17.5).

  • durationMs (double) - Shelve duration in milliseconds.
  • comment (const LocalizedText &) - Comment to apply; a NULL comment leaves any existing one unchanged.

Returns: The resulting state transition, identical to timed_shelve(double).

ConditionStateTransition one_shot_shelve()

Shelves the alarm until it next deactivates and reactivates (OneShotShelved).

Returns: The resulting state transition.

ConditionStateTransition one_shot_shelve(const LocalizedText &comment)

One-shot shelves the alarm and records a comment against it (OneShotShelve2, OPC 10000-9 5.8.17.7).

  • comment (const LocalizedText &) - Comment to apply; a NULL comment leaves any existing one unchanged.

Returns: The resulting state transition, identical to one_shot_shelve().

ConditionStateTransition unshelve()

Returns the alarm to the Unshelved state.

Returns: The resulting state transition, including a cancel-shelve-timer command for the shell.

ConditionStateTransition unshelve(const LocalizedText &comment)

Unshelves the alarm and records a comment against it (Unshelve2, OPC 10000-9 5.8.17.3).

  • comment (const LocalizedText &) - Comment to apply; a NULL comment leaves any existing one unchanged.

Returns: The resulting state transition, identical to unshelve().

ConditionStateTransition on_shelve_timer_expired()

Handles expiry of the shelve timer started by timed_shelve.

Returns: The resulting state transition.

ConditionStateTransition on_delay_expired()

Handles expiry of the on-delay timer, committing a delayed activation.

Returns: The resulting state transition.

ConditionStateTransition off_delay_expired()

Handles expiry of the off-delay timer, committing a delayed deactivation.

Returns: The resulting state transition.

ConditionStateTransition on_re_alarm_timer_expired()

Handles expiry of the configured ReAlarmTime while the Alarm remains active.

Returns: The resulting state transition, or a no-op when disabled, inactive, or unconfigured.

ConditionStateTransition evaluate_input(const Variant &value, DateTime timestamp)

Evaluates a new input sample and updates alarm state accordingly.

  • value (const Variant &) - The newly sampled input value.
  • timestamp (DateTime) - Source timestamp of the sample.

Returns: The resulting state transition for the shell to apply.

ConditionStateTransition reset()

Resets a latched alarm whose input has already cleared.

Returns: The resulting state transition. No-op unless latching is supported.

ConditionStateTransition reset(const LocalizedText &comment)

Resets a latched alarm and records a comment against it (Reset2, OPC 10000-9 5.8.6).

  • comment (const LocalizedText &) - Comment to apply; a NULL comment leaves any existing one unchanged.

Returns: The resulting state transition, identical to reset().

void set_initial_active(bool active, uint16_t severity)

Sets the initial active state without triggering transitions or events.

  • active (bool) - Initial ActiveState value.
  • severity (uint16_t) - Initial severity, 1..1000.
void set_initial_acked(bool acked)

Seeds AckedState and, when SilenceState was not independently recovered, uses it as the required recovery fallback for SilenceState.

  • acked (bool) - Initial AckedState value: true for a condition recovered as acknowledged. When the alarm carries the optional SilenceState and no initial silence was set, this value also seeds SilenceState (silenced when acknowledged), which is the recovery fallback rather than an equivalence between the two states.
void set_initial_suppressed(bool suppressed)

Sets the initial suppressed state without triggering transitions or events.

  • suppressed (bool) - Initial SuppressedState value.
void set_initial_out_of_service(bool outOfService)

Sets the initial out-of-service state without triggering transitions or events.

  • outOfService (bool) - Initial OutOfServiceState value.
void set_initial_silenced(bool silenced)

Sets the initial silence state without triggering transitions or events.

  • silenced (bool) - Initial SilenceState value.
void set_initial_latched(bool latched)

Sets the initial latched state without triggering transitions or events.

  • latched (bool) - Initial LatchedState value.
void set_initial_shelved(ShelveState state)

Sets the initial shelve state without triggering transitions or events.

  • state (ShelveState) - Initial ShelveState.
void set_input_node(NodeId nodeId)

Sets the NodeId of the input source whose samples drive this alarm.

  • nodeId (NodeId) - NodeId of the input source whose samples drive this alarm.
void set_max_time_shelved(double ms)

Sets the maximum permitted shelve duration in milliseconds (MaxTimeShelved).

  • ms (double) - Upper bound applied to timed_shelve durations; 0 disables the cap.
double max_time_shelved() const noexcept

The configured MaxTimeShelved in milliseconds, or 0 when the alarm imposes no maximum.

Returns: The configured maximum duration in milliseconds, or zero when uncapped.

void set_on_delay(double ms)

Sets the on-delay in milliseconds applied before a pending activation takes effect.

  • ms (double) - Delay duration in milliseconds; 0 disables the delay.
void set_off_delay(double ms)

Sets the off-delay in milliseconds applied before a pending deactivation takes effect.

  • ms (double) - Delay duration in milliseconds; 0 disables the delay.
void set_re_alarm_time(double ms)

Sets the re-alarm interval in milliseconds (ReAlarmTime).

  • ms (double) - Repeat interval in milliseconds; a non-positive value disables re-alarming.
void set_supports_suppressed(bool value)

Enables or disables the optional SuppressedState sub-state.

  • value (bool) - true to enable the SuppressedState sub-state; false to disable it.
void set_supports_out_of_service(bool value)

Enables or disables the optional OutOfServiceState sub-state.

  • value (bool) - true to enable the OutOfServiceState sub-state; false to disable it.
void set_supports_silence(bool value)

Enables or disables the optional SilenceState sub-state.

  • value (bool) - true to enable the SilenceState sub-state; false to disable it.
void set_supports_latched(bool value)

Enables or disables the optional LatchedState sub-state.

  • value (bool) - true to enable the LatchedState sub-state; false to disable it.
bool supports_suppressed() const

Returns whether the SuppressedState sub-state is supported.

Returns: true if the SuppressedState sub-state is supported.

bool supports_out_of_service() const

Returns whether the OutOfServiceState sub-state is supported.

Returns: true if the OutOfServiceState sub-state is supported.

bool supports_silence() const

Returns whether the SilenceState sub-state is supported.

Returns: true if the SilenceState sub-state is supported.

bool supports_latched() const

Returns whether the LatchedState sub-state is supported.

Returns: true if the LatchedState sub-state is supported.

std::unique_ptr< BaseEvent > build_event() const override

Builds an alarm event snapshot from the current state.

Returns: A newly allocated event whose ownership transfers to the caller.

ShelveState shelve_state() const

Returns the current ShelveState.

Returns: The current ShelveState.

UnshelveClock unshelve_clock() const

The clock ShelvingState/UnshelveTime is read from; see UnshelveClock.

Returns: A value snapshot used to evaluate UnshelveTime.

Static attributes

constexpr double longestShelvingTimeMs

The longest a condition timer runs, in milliseconds: ten years.

ua::CertificateExpirationAlarmLogic

class

State machine for the OPC UA CertificateExpirationAlarmType (Part 9, 5.8.24.7).

Monitors a certificate's expiration. The alarm activates once the current time plus the configured expiration limit reaches or passes the certificate's expiration date, signalling that the certificate is due for renewal before it expires. Extends OffNormalAlarmLogic.

This is a synchronous in-memory state machine: callers drive it from the owning condition's serialization context and inspect the returned ConditionStateTransition to decide what events and timer commands to run. It performs no I/O and never blocks.

Functions

~CertificateExpirationAlarmLogic() override=default
CertificateExpirationAlarmLogic()=default

Default constructor: the deleted copy/move members above suppress the implicit default ctor; this concrete logic type is default-constructed directly and by subclasses.

void set_expiration_date(DateTime expirationDate)

Sets the certificate's expiration date used by evaluate_expiration.

  • expirationDate (DateTime) - Absolute time at which the monitored certificate expires.
void set_expiration_limit(double ms)

Sets how far before expiry the alarm activates.

  • ms (double) - Lead time before the expiration date, in milliseconds. Defaults to two weeks (1209600000 ms) until overridden.
void set_certificate_type(NodeId certType)

Sets the NodeId of the certificate type this alarm reports.

  • certType (NodeId) - NodeId identifying the certificate's type (e.g. application instance certificate). Surfaced on the emitted event.
void set_certificate(ByteString cert)

Sets the DER-encoded certificate this alarm reports.

  • cert (ByteString) - The monitored certificate as a DER byte string. Surfaced on the emitted event.
ConditionStateTransition evaluate_expiration(DateTime now)

Evaluates whether the certificate is within its expiration limit.

  • now (DateTime) - The current time to evaluate against.

Returns: The resulting ConditionStateTransition. The shell inspects it to decide whether to emit an event and which timer commands to run.

std::unique_ptr< BaseEvent > build_event() const override

Builds the event for the current alarm state.

Returns: A newly constructed event describing the current state. Ownership transfers to the caller.

ua::TimerCommand

struct

A timer operation that the Condition shell must execute after a state transition.

Produced by the pure ConditionStateTransition logic and replayed by the owning Condition instance, which schedules or cancels the corresponding alarm timer (on/off delay, shelving, or re-alarm) on its strand.

Member types

Kind (enum)

The timer and operation a command refers to.

Public attributes

Kind kind

Which timer to act on, and whether to start or cancel it.

double durationMs

Delay before the timer fires, in milliseconds; ignored for cancel kinds.

ua::BranchEventData

struct

A branch event that the Condition shell must emit after a state transition.

Each entry corresponds to one ConditionBranch whose state changed and must be reported to subscribers via an event.

Public attributes

NodeId branchId

Identifier of the ConditionBranch the event reports on.

bool retain

true to emit a normal branch event; false to emit the final event (Retain=False) that deletes the branch.

ua::ConditionStateTransition

struct

The outcome of a ConditionLogic state mutation.

Returned by the pure Condition logic and inspected by the owning Condition instance (the "shell"), which decides whether to emit the condition event, replay the timer commands, emit any branch events, and what status to report back to the caller. This is a plain value with no ownership or threading semantics of its own.

Public attributes

bool changed

true if the mutation altered any condition state.

bool emitEvent

true if the shell must emit the main condition event.

StatusCode status

Status to report back to the caller of the mutation.

std::vector< TimerCommand > timerCommands

Timer operations to execute, in order.

std::vector< BranchEventData > branchEvents

Branch events to emit, in order.

ua::ConditionLogic

class

Pure state machine for the OPC UA ConditionType (Part 9).

Holds all condition state and exposes deterministic, side-effect-free transitions. Performs no I/O, holds no address-space references, and is not strand-serialized - every method runs synchronously on the caller's thread and never blocks. Intended for the Logic/Shell split pattern: a strand-serialized shell component owns this object, drives the async operations it describes (event emission, timer commands), and feeds the results back in.

State mutations return a ConditionStateTransition that tells the shell whether an event must be emitted, which timer commands to run, and the status to report to the caller; the logic object itself never emits events.

Subclasses (AcknowledgeableConditionLogic, AlarmConditionLogic, etc.) override the protected extension points - compute_retain(), on_enabled(), on_disabled() - to add their type-specific behavior.

Not thread-safe. The owning shell must serialize all access (its strand provides this).

Functions

~ConditionLogic()=default
ConditionLogic()=default

Default constructor: the deleted copy/move members above suppress the implicit default ctor; this concrete logic type is default-constructed directly and by subclasses.

ConditionStateTransition enable()

Enables the condition.

Returns: The resulting transition. Carries status BadConditionAlreadyEnabled (and no change) when the condition was already enabled.

ConditionStateTransition disable()

Disables the condition.

Returns: The resulting transition. Carries status BadConditionAlreadyDisabled (and no change) when the condition was already disabled.

ConditionStateTransition add_comment(const ByteString &eventId, const LocalizedText &comment)

Adds a comment to the condition or one of its branches.

  • eventId (const ByteString &) - EventId of the event the comment refers to, used to select the target branch.
  • comment (const LocalizedText &) - Comment text to record.

Returns: The resulting transition.

ConditionStateTransition set_quality(StatusCode quality)

Updates the condition quality.

Returns: The resulting transition; requests an event emission when the condition is retained.

ConditionStateTransition set_severity(uint16_t severity)

Updates the condition severity.

  • severity (uint16_t) - New severity, in OPC UA severity units (1-1000).

Returns: The resulting transition; requests an event emission when the condition is retained.

void set_initial_enabled(bool enabled)

Sets the initial enabled state without triggering any transition or event.

  • enabled (bool) - Initial enabled flag.
void set_source(NodeId sourceNode, String sourceName)

Sets the source node and source name reported in emitted events.

  • sourceNode (NodeId) - NodeId of the source the condition relates to.
  • sourceName (String) - Human-readable source name.
void set_condition_name(String name)

Sets the condition name reported in emitted events.

  • name (String) - Condition name reported in emitted events.
void set_condition_class(NodeId classId, LocalizedText className)

Sets the condition class identifier and its display name.

  • classId (NodeId) - NodeId of the condition class (e.g. a well-known ConditionClassType).
  • className (LocalizedText) - Localized display name of the condition class.
void set_client_user_id(String userId)

Sets the ClientUserId recorded on the next comment/acknowledge interaction.

  • userId (String) - ClientUserId to record on the next comment/acknowledge interaction.
void set_supports_filtered_retain(bool value)

Sets whether the condition supports the FilteredRetain behavior.

  • value (bool) - true to enable FilteredRetain behavior support; false to disable it.
void set_last_event_id(ByteString eventId)

Sets the last event ID.

  • eventId (ByteString) - EventId of the most recently emitted event.
const ByteString & last_event_id() const

Returns the last emitted event ID, used to correlate ConditionRefresh.

Returns: Reference to the stored EventId; valid until the next set_last_event_id() call.

std::unique_ptr< BaseEvent > build_event() const

Builds an event struct populated from the current condition state.

Returns: An owning pointer to a freshly built event; never null.

ua::DialogConditionLogic

class

Pure state machine for the OPC UA DialogConditionType (Part 9).

Extends ConditionLogic with dialog-specific state: the prompt, the response-option set, and the DialogState two-state variable. Dialogs are not alarms - they derive directly from ConditionLogic. A dialog is activated with a prompt and is then awaiting a response; responses are validated against the configured number of options.

Like its base, this is a synchronous, side-effect-free logic object: it holds no I/O, address space, or strands. Each mutation returns a ConditionStateTransition that the owning strand-serialized shell inspects to decide whether to emit an event and what status to report to the caller.

Functions

~DialogConditionLogic() override=default
DialogConditionLogic()=default

Default constructor: the deleted copy/move members above suppress the implicit default ctor; this concrete logic type is default-constructed directly and by subclasses.

ConditionStateTransition activate_dialog(LocalizedText prompt)

Activates the dialog with the given prompt, entering the active DialogState.

  • prompt (LocalizedText) - Text shown to the client for this dialog. Taken by value.

Returns: The resulting state transition for the shell to apply.

ConditionStateTransition respond(int32_t selectedResponse)

Responds to the active dialog with the selected option.

  • selectedResponse (int32_t) - Zero-based option index in the range 0 .. numOptions - 1 (see set_response_options()).

Returns: The resulting state transition. Its status is BadDialogNotActive when the dialog is not currently active, or BadDialogResponseInvalid when selectedResponse is out of range.

ConditionStateTransition respond(int32_t selectedResponse, LocalizedText comment)

Responds to the active dialog and updates the condition comment.

  • selectedResponse (int32_t) - Zero-based option index, validated as in respond(int32_t).
  • comment (LocalizedText) - Comment to record alongside the response. Taken by value.

Returns: The resulting state transition, with the same status semantics as respond(int32_t).

void set_response_options(int32_t numOptions)

Sets the number of valid response options accepted by respond().

  • numOptions (int32_t) - Count of selectable options; valid response indices are 0 .. numOptions - 1.
void set_default_response(int32_t index)

Sets the default response option index.

  • index (int32_t) - Zero-based option index, or -1 for none.
void set_ok_response(int32_t index)

Sets the option index that represents the OK response.

  • index (int32_t) - Zero-based option index, or -1 for none.
void set_cancel_response(int32_t index)

Sets the option index that represents the Cancel response.

  • index (int32_t) - Zero-based option index, or -1 for none.
std::unique_ptr< BaseEvent > build_event() const override

Builds a dialog-condition event populated from the current state.

Returns: A newly allocated event carrying the dialog fields plus the inherited condition fields. Ownership transfers to the caller.

ua::DiscrepancyAlarmLogic

class

State machine for the OPC UA DiscrepancyAlarmType (Part 9, 5.8.25).

Monitors whether an input value reaches a configured target value within an expected time. When the input differs from the target (outside tolerance) for longer than the expected time, the alarm activates; when the input reaches the target, the alarm deactivates. Like every ConditionLogic this is a pure state machine: it performs no I/O, owns no strand, and is driven by a shell component that feeds it inputs and acts on the returned transitions.

Functions

~DiscrepancyAlarmLogic() override=default
DiscrepancyAlarmLogic()=default

Default constructor: the deleted copy/move members above suppress the implicit default ctor; this concrete logic type is default-constructed directly and by subclasses.

void set_target_value_node(NodeId nodeId)

Sets the NodeId of the variable that holds the target value.

  • nodeId (NodeId) - NodeId of the target-value variable.
void set_expected_time(double ms)

Sets the time the input may discrepate from the target before the alarm activates.

  • ms (double) - Expected time to reach the target, in milliseconds.
void set_tolerance(double tolerance)

Sets the tolerance band used for target comparison.

  • tolerance (double) - Maximum absolute difference, in input units, still treated as at-target.
void set_target_value(Variant value)

Sets the current target value the input is compared against.

  • value (Variant) - Target value; its type should match the input supplied to evaluate_input.
ConditionStateTransition evaluate_input(const Variant &value, DateTime timestamp) override

Evaluates a new input sample against the target and updates alarm state.

  • value (const Variant &) - The input sample to evaluate.
  • timestamp (DateTime) - Source timestamp of the sample, used to measure how long the input has been discrepant.

Returns: The state transition produced by the evaluation.

std::unique_ptr< BaseEvent > build_event() const override

Builds a DiscrepancyAlarmType event populated from the current state.

Returns: An owning event struct carrying this alarm's fields; never null.

ua::DiscreteAlarmLogic

class

Pure state machine for the OPC UA DiscreteAlarmType (Part 9).

A discrete alarm is driven by changes to a discrete input rather than by limit comparison against an analog process value. It inherits the full AlarmConditionLogic behavior (activation, shelving, suppression, out-of-service, silence, latching, on/off delays) unchanged and only specializes the emitted event type. Like its bases it performs no I/O and touches no address space or strand; a strand-serialized shell drives it.

Functions

~DiscreteAlarmLogic() override=default
DiscreteAlarmLogic()=default

Default constructor: the deleted copy/move members above suppress the implicit default ctor; this concrete logic type is default-constructed directly and by subclasses.

std::unique_ptr< BaseEvent > build_event() const override

Builds a DiscreteAlarm event struct from the current alarm state.

Returns: An owning handle to the freshly built event; never null.

ua::ConfiguredLimit

class

One limit exposed by a LimitAlarmType.

A configured limit may carry its numeric threshold or may be unavailable because the underlying system cannot supply the actual value. The latter remains an exposed Property but is excluded from alarm evaluation and has no Event-field value.

Static functions

ConfiguredLimit unavailable() noexcept

Constructs a configured limit whose actual value is unavailable.

Returns: A present but unavailable limit.

Functions

ConfiguredLimit(double value) noexcept

Constructs an available configured limit.

  • value (double) - Numeric threshold in the input's engineering units.
ConfiguredLimit & operator=(double value) noexcept

Replaces this limit with an available numeric threshold.

  • value (double) - Numeric threshold in the input's engineering units.

Returns: This configured limit.

bool is_available() const noexcept

Returns whether the underlying system supplied the numeric threshold.

Returns: true when a threshold was supplied; false when the limit is configured - the model declares it - but its actual value is not known to this server.

const std::optional< double > & value() const noexcept

Returns the supplied threshold, or empty when its actual value is unavailable.

Returns: The threshold in the input's engineering units, or an empty optional when the limit is configured but unavailable - the same distinction is_available reports.

ua::LimitConfig

struct

Configuration for limit thresholds, per-limit deadbands, and per-limit severities.

Each limit has three states: an absent outer optional is not exposed, an available ConfiguredLimit is exposed and evaluated, and an unavailable ConfiguredLimit is exposed with CurrentRead cleared but is not evaluated. Available values use the same engineering units as the alarm's input. Severities are OPC UA severity values in the range 1..1000.

Public attributes

std::optional< ConfiguredLimit > highHighLimit

HighHigh limit; unset omits the Property.

std::optional< ConfiguredLimit > highLimit

High limit; unset omits the Property.

std::optional< ConfiguredLimit > lowLimit

Low limit; unset omits the Property.

std::optional< ConfiguredLimit > lowLowLimit

LowLow limit; unset omits the Property.

double highHighDeadband

Per-limit deadbands.

double highDeadband

Deadband for the High limit, in input units.

double lowDeadband

Deadband for the Low limit, in input units.

double lowLowDeadband

Deadband for the LowLow limit, in input units.

uint16_t severityHighHigh

Per-limit severity values.

uint16_t severityHigh

Severity reported while the High limit is active.

uint16_t severityLow

Severity reported while the Low limit is active.

uint16_t severityLowLow

Severity reported while the LowLow limit is active.

ua::LimitAlarmLogic

class

State machine for the OPC UA LimitAlarmType (Part 9).

Extends AlarmConditionLogic with limit evaluation, deadband support, and exclusive/non-exclusive limit modes.

In exclusive mode, only the most severe violated limit is active at a time. In non-exclusive mode, each limit is evaluated independently and multiple can be active simultaneously.

Functions

~LimitAlarmLogic() override=default
LimitAlarmLogic()=default

Default constructor: the deleted copy/move members above suppress the implicit default ctor; this concrete logic type is default-constructed directly and by subclasses.

void set_limits(LimitConfig config)

Sets the limit thresholds, deadbands, and severities.

  • config (LimitConfig) - New limit configuration; ownership is taken by value.
void set_exclusive(bool exclusive)

Selects exclusive (true) or non-exclusive (false) limit mode.

  • exclusive (bool) - true for exclusive mode, false for non-exclusive mode.
void enable_rate_of_change_per_second()

Enables evaluation of limits against the input's rate of change per second.

ActiveLimit active_limit() const

Returns the currently active limit.

Returns: The active limit, or ActiveLimit::None when no limit is violated.

bool high_high_active() const

Returns whether the HighHigh limit is currently active (non-exclusive mode).

Returns: true when the HighHigh limit is currently violated.

bool high_active() const

Returns whether the High limit is currently active (non-exclusive mode).

Returns: true when the High limit is currently violated.

bool low_active() const

Returns whether the Low limit is currently active (non-exclusive mode).

Returns: true when the Low limit is currently violated.

bool low_low_active() const

Returns whether the LowLow limit is currently active (non-exclusive mode).

Returns: true when the LowLow limit is currently violated.

const LimitConfig & limits() const

Returns the current limit configuration.

Returns: A reference valid until the next set_limits call.

bool exclusive() const

Returns whether exclusive mode is enabled.

Returns: true when exclusive limit mode is enabled, false for non-exclusive mode.

ConditionStateTransition evaluate_input(const Variant &value, DateTime timestamp) override

Evaluates a new input value against the configured limits and updates state.

  • value (const Variant &) - New process value to evaluate; must be numeric to take effect.
  • timestamp (DateTime) - Source timestamp associated with the value.

Returns: The resulting state transition (which states changed, and whether an event should be emitted).

std::unique_ptr< BaseEvent > build_event() const override

Builds the event instance reflecting the current limit-alarm state.

Returns: A newly allocated event populated with the current condition state; ownership transfers to the caller.

ua::OffNormalAlarmLogic

class

State machine for the OPC UA OffNormalAlarmType (Part 9).

Extends DiscreteAlarmLogic with a comparison against a configured "normal" state. On each input evaluation the alarm activates when the input value differs from the normal state and deactivates when it equals the normal state. The comparison is by value equality of the Variant.

Functions

~OffNormalAlarmLogic() override=default
OffNormalAlarmLogic()=default

Default constructor: the deleted copy/move members above suppress the implicit default ctor; this concrete logic type is default-constructed directly and by subclasses.

void set_normal_state(Variant normalValue)

Sets the value that represents the "normal" (non-alarming) state.

  • normalValue (Variant) - Value taken to represent the normal state.
void set_normal_state_node(NodeId nodeId)

Sets the NodeId of the NormalState property exposed by the alarm node.

  • nodeId (NodeId) - NodeId of the NormalState property in the address space.
ConditionStateTransition evaluate_input(const Variant &value, DateTime timestamp) override

Evaluates a new input value against the normal state and returns the resulting condition state transition.

  • value (const Variant &) - New input value to evaluate.
  • timestamp (DateTime) - Source timestamp associated with the input change.

Returns: The transition describing any resulting condition state change.

std::unique_ptr< BaseEvent > build_event() const override

Builds an OffNormalAlarm event reflecting the current alarm state.

Returns: A newly allocated event whose ownership is transferred to the caller; never null.

ua::FileHelper

class

Convenience class that backs a FileType address-space node with real filesystem I/O.

All six FileType methods (Open, Close, Read, Write, GetPosition, SetPosition) are wired automatically to operate on the given filesystem path. Concurrent clients receive independent file handles with independent stream positions. The four mandatory properties (Size, Writable, UserWritable, OpenCount) are populated automatically; Size and OpenCount are dynamic, queried from live state by their read handlers.

A helper created via create_async/create_sync owns the FileType subtree it instantiates and removes it on destruction (RAII); call release to detach that ownership. A helper produced by attach_async/attach_sync wraps a pre-existing node and never owns it.

Member types

std::function< void(FileHelperResult)> CreateCompleteCallback

Callback type reporting the outcome of create_async.

std::function< void(FileHelperResult)> AttachCompleteCallback

Callback type reporting the outcome of attach_async.

Static functions

void create_async(AddressSpace addressSpace, const NodeId &parent, const QualifiedName &browseName, std::filesystem::path filePath, const InstantiationOptions &options, bool writable, CreateCompleteCallback complete, std::optional< uint64_t > maxFileSize=std::nullopt) noexcept

Creates a new FileType instance under parent and wires all method/property handlers.

  • addressSpace (AddressSpace) - Address space in which the node is created.
  • parent (const NodeId &) - Node under which the new FileType instance is created.
  • browseName (const QualifiedName &) - Browse name of the new node.
  • filePath (std::filesystem::path) - Filesystem path the FileType methods operate on.
  • options (const InstantiationOptions &) - Instantiation options for the new subtree.
  • writable (bool) - Whether the file may be opened for writing (drives the Writable / UserWritable properties and rejects write opens when false).
  • complete (CreateCompleteCallback) - Receives the outcome: on success the Result holds the owning FileHelper; on failure it carries an ErrorDetail. This overload never throws.
  • maxFileSize (std::optional< uint64_t >) - Optional maximum resulting file size in bytes; absent leaves writes uncapped.
FileHelperResult try_create_sync(AddressSpace addressSpace, const NodeId &parent, const QualifiedName &browseName, std::filesystem::path filePath, const InstantiationOptions &options, bool writable=true, std::optional< uint64_t > maxFileSize=std::nullopt) noexcept

Creates a new FileType instance under parent, blocking until complete.

  • addressSpace (AddressSpace) - Address space in which the node is created.
  • parent (const NodeId &) - Node under which the new FileType instance is created.
  • browseName (const QualifiedName &) - Browse name of the new node.
  • filePath (std::filesystem::path) - Filesystem path the FileType methods operate on.
  • options (const InstantiationOptions &) - Instantiation options for the new subtree.
  • writable (bool) - Whether the file may be opened for writing (drives the Writable / UserWritable properties and rejects write opens when false).
  • maxFileSize (std::optional< uint64_t >) - Optional maximum resulting file size in bytes; absent leaves writes uncapped.

Returns: The owning FileHelper, or an ErrorDetail on failure. Never throws.

FileHelper create_sync(AddressSpace addressSpace, const NodeId &parent, const QualifiedName &browseName, std::filesystem::path filePath, const InstantiationOptions &options, bool writable=true, std::optional< uint64_t > maxFileSize=std::nullopt)

Creates a new FileType instance under parent, blocking until complete.

  • addressSpace (AddressSpace) - Address space in which the node is created.
  • parent (const NodeId &) - Node under which the new FileType instance is created.
  • browseName (const QualifiedName &) - Browse name of the new node.
  • filePath (std::filesystem::path) - Filesystem path the FileType methods operate on.
  • options (const InstantiationOptions &) - Instantiation options for the new subtree.
  • writable (bool) - Whether the file may be opened for writing (drives the Writable / UserWritable properties and rejects write opens when false).
  • maxFileSize (std::optional< uint64_t >) - Optional maximum resulting file size in bytes; absent leaves writes uncapped. A Good subcode on the answer is not returned; try_create_sync() returns it.

Returns: The owning FileHelper.

void attach_async(AddressSpace addressSpace, const NodeId &existingInstance, std::filesystem::path filePath, bool writable, AttachCompleteCallback complete) noexcept

Wraps an existing FileType node and wires all method/property handlers.

  • addressSpace (AddressSpace) - Address space containing the node.
  • existingInstance (const NodeId &) - Node id of the existing FileType instance to back.
  • filePath (std::filesystem::path) - Filesystem path the FileType methods operate on.
  • writable (bool) - Whether the file may be opened for writing (drives the Writable / UserWritable properties and rejects write opens when false).
  • complete (AttachCompleteCallback) - Receives the outcome: on success the Result holds the non-owning FileHelper; on failure it carries an ErrorDetail. This overload never throws.
FileHelperResult try_attach_sync(AddressSpace addressSpace, const NodeId &existingInstance, std::filesystem::path filePath, bool writable=true) noexcept

Wraps an existing FileType node, blocking until complete.

  • addressSpace (AddressSpace) - Address space containing the node.
  • existingInstance (const NodeId &) - Node id of the existing FileType instance to back.
  • filePath (std::filesystem::path) - Filesystem path the FileType methods operate on.
  • writable (bool) - Whether the file may be opened for writing (drives the Writable / UserWritable properties and rejects write opens when false).

Returns: The non-owning FileHelper, or an ErrorDetail on failure. Never throws.

FileHelper attach_sync(AddressSpace addressSpace, const NodeId &existingInstance, std::filesystem::path filePath, bool writable=true)

Wraps an existing FileType node, blocking until complete.

  • addressSpace (AddressSpace) - Address space containing the node.
  • existingInstance (const NodeId &) - Node id of the existing FileType instance to back.
  • filePath (std::filesystem::path) - Filesystem path the FileType methods operate on.
  • writable (bool) - Whether the file may be opened for writing (drives the Writable / UserWritable properties and rejects write opens when false). A Good subcode on the answer is not returned; try_attach_sync() returns it.

Returns: The non-owning FileHelper.

Functions

FileHelper()=default

Constructs an empty helper that backs no node.

const NodeId & node_id() const

Returns the node id of the backed FileType instance.

Returns: The node id of the backed FileType instance.

const File & file() const

Returns the File handle wrapping the backed FileType instance.

Returns: The File handle wrapping the backed FileType instance.

Result< uint32_t > try_open_handle(uint8_t mode, const NodeId &sessionId={})

Open the backing file and return the FileType handle a Client would get from Open.

  • mode (uint8_t) - OPC 10000-20 section 4.2.1 open-mode byte, as the Open Method takes it.
  • sessionId (const NodeId &) - Session the handle is issued to, checked on every later call against it. Null for an internal caller, which forms its own handle space no Client can reach.

Returns: The new file handle, or an error if the backing file could not be opened.

void release()

Detaches RAII ownership of the created subtree so it persists beyond this handle's lifetime.

void on_all_handles_closed(std::function< void()> callback)

Registers a callback that runs, with no lock held, whenever a Close removes the file's last open handle.

std::shared_ptr< State > shared_state() const

The shared state backing this file's installed handlers.

Returns: The shared state; outlives this accessor, because the installed handlers hold it.

FileHelper(File file, std::shared_ptr< State > state)

Implementation-only constructor used by the install flow once handlers are wired and the File handle is ready.

  • file (File) - The File handle wrapping the wired FileType node.
  • state (std::shared_ptr< State >) - Shared state backing the installed method and property handlers.

ua::FileDirectoryHelper

class

Convenience class that backs a FileDirectoryType address-space node with a real filesystem directory.

The four FileDirectoryType methods are wired automatically against the backing directory path:

CreateFile creates a file on disk and a child FileType node backed by FileHelper. CreateDirectory creates a directory on disk and a child FileDirectoryType node backed recursively by FileDirectoryHelper. DeleteFileSystemObject deletes the file/directory on disk and removes the child node(s). MoveOrCopy currently returns BadNotSupported (cross-directory coordination is a planned follow-up).

Create-only: only objects created through the methods appear in the address space; pre-existing on-disk content is not reflected (a continuously-accurate view of an external directory belongs in a custom Namespace, not this helper). CreateFile with RequestFileOpen=true returns the new node with FileHandle 0 - clients open it via the File's Open method (auto-open-on-create is a follow-up).

The created subtree is owned by this handle through RAII: on destruction the instantiated node(s) are removed from the address space unless release has been called.

Member types

std::function< void(FileDirectoryHelperResult)> CreateCompleteCallback

Callback type reporting the outcome of create_async.

Static functions

void create_async(AddressSpace addressSpace, const NodeId &parent, const QualifiedName &browseName, std::filesystem::path dirPath, const InstantiationOptions &options, bool writable, CreateCompleteCallback complete) noexcept

Creates a new FileDirectoryType instance under parent, backed by dirPath, and wires all method handlers.

  • addressSpace (AddressSpace) - Address space the new node is instantiated into.
  • parent (const NodeId &) - Node the new FileDirectoryType instance is organized under.
  • browseName (const QualifiedName &) - BrowseName of the new instance.
  • dirPath (std::filesystem::path) - Filesystem directory backing the node; created if absent.
  • options (const InstantiationOptions &) - Instantiation options for the new subtree.
  • writable (bool) - Whether the directory and its created files accept writes.
  • complete (CreateCompleteCallback) - Receives the owning helper, or an ErrorDetail on failure. This overload never throws.
FileDirectoryHelperResult try_create_sync(AddressSpace addressSpace, const NodeId &parent, const QualifiedName &browseName, std::filesystem::path dirPath, const InstantiationOptions &options, bool writable=true) noexcept

Creates a new FileDirectoryType instance under parent, backed by dirPath, and wires all method handlers.

  • addressSpace (AddressSpace) - Address space the new node is instantiated into.
  • parent (const NodeId &) - Node the new FileDirectoryType instance is organized under.
  • browseName (const QualifiedName &) - BrowseName of the new instance.
  • dirPath (std::filesystem::path) - Filesystem directory backing the node; created if absent.
  • options (const InstantiationOptions &) - Instantiation options for the new subtree.
  • writable (bool) - Whether the directory and its created files accept writes.

Returns: The owning helper on success, or an ErrorDetail on failure. Never throws.

FileDirectoryHelper create_sync(AddressSpace addressSpace, const NodeId &parent, const QualifiedName &browseName, std::filesystem::path dirPath, const InstantiationOptions &options, bool writable=true)

Creates a new FileDirectoryType instance under parent, backed by dirPath, and wires all method handlers.

  • addressSpace (AddressSpace) - Address space the new node is instantiated into.
  • parent (const NodeId &) - Node the new FileDirectoryType instance is organized under.
  • browseName (const QualifiedName &) - BrowseName of the new instance.
  • dirPath (std::filesystem::path) - Filesystem directory backing the node; created if absent.
  • options (const InstantiationOptions &) - Instantiation options for the new subtree.
  • writable (bool) - Whether the directory and its created files accept writes. A Good subcode on the answer is not returned; try_create_sync() returns it.

Returns: The owning helper.

FileDirectoryHelperResult try_attach_sync(AddressSpace addressSpace, const NodeId &existingInstance, std::filesystem::path dirPath, bool writable=true) noexcept

Wraps an existing FileDirectoryType node and wires all method handlers against dirPath.

  • addressSpace (AddressSpace) - Address space containing the node.
  • existingInstance (const NodeId &) - FileDirectoryType node to wire method handlers onto.
  • dirPath (std::filesystem::path) - Filesystem directory the wrapped node operates on.
  • writable (bool) - Whether the directory and its created files accept writes.

Returns: The helper on success, or an ErrorDetail on failure. Never throws.

Functions

FileDirectoryHelper()=default

Constructs an empty handle that owns no node and wires no method handlers.

const NodeId & node_id() const

Returns the NodeId of the backed FileDirectoryType node.

Returns: The NodeId of the backed FileDirectoryType node.

const FileDirectory & directory() const

Returns the typed accessor for the backed FileDirectoryType node.

Returns: The typed FileDirectory accessor for the backed node.

void release()

Detaches RAII ownership of the created subtree so it persists beyond this handle's lifetime.

std::shared_ptr< State > shared_state() const

The shared state backing this directory's installed handlers.

Returns: The shared state; outlives this accessor, because the installed handlers hold it.

FileDirectoryHelper(FileDirectory directory, std::shared_ptr< State > state)

Constructs a helper bound to an already-instantiated directory and its shared state.

ua::TemporaryFileTransferConfig

struct

Configuration and host hooks for a TemporaryFileTransferHelper.

Carries the on-disk location and parent Node for transient transfer files, plus two optional host callbacks (onCommit, onGenerateForRead) that decide what an uploaded file becomes and what bytes a read transfer serves. Both callbacks default to unset, which yields a scratch transfer (uploads discarded, reads served an empty file).

Public attributes

std::filesystem::path tempDir

Filesystem directory holding the transient transfer files.

NodeId transientFileParent

Node under which transient FileType nodes are created (browsable).

std::function< VoidResult(const std::filesystem::path &uploadedFile, shared_ptr< const MethodCallContext >)> onCommit

Invoked on CloseAndCommit of a write transfer with the path of the uploaded temp file.

uint64_t maxFileSize

Largest size an upload (a write transfer's temp file) may grow to, in bytes (DEF-7); 0 leaves it unbounded.

uint32_t maxActiveTransfersPerSession

Most transfers one Session may hold open at once (DEF-7); 0 leaves it unbounded.

std::function< Result< std::filesystem::path >(const Variant &generateOptions, shared_ptr< const MethodCallContext >)> onGenerateForRead

Invoked on GenerateFileForRead to obtain the file the client will read.

ua::TemporaryFileTransferHelper

class

Convenience class backing a TemporaryFileTransferType node in the address space.

Implements the GenerateFileForWrite, GenerateFileForRead, and CloseAndCommit methods. Each transfer gets a transient FileType node backed by a FileHelper over a temp file in TemporaryFileTransferConfig::tempDir; CloseAndCommit invokes the host commit hook (for write transfers), then removes the transient node and temp file. Transfers complete synchronously, so the CompletionStateMachine output is left null (valid for synchronous completion).

This is a value handle that holds shared ownership of the created subtree. Copying shares the same backing state; destroying the last handle tears the subtree down unless release was called first.

Static functions

TemporaryFileTransferHelperResult try_create_sync(AddressSpace addressSpace, const NodeId &parent, const QualifiedName &browseName, const InstantiationOptions &options, TemporaryFileTransferConfig config) noexcept

Instantiates a TemporaryFileTransferType node under parent and backs it with this helper.

  • addressSpace (AddressSpace) - Address space the node is created in.
  • parent (const NodeId &) - Node under which the transfer object is instantiated.
  • browseName (const QualifiedName &) - Browse name of the new transfer object.
  • options (const InstantiationOptions &) - Instantiation options for the created subtree.
  • config (TemporaryFileTransferConfig) - Configuration and host hooks (see TemporaryFileTransferConfig).

Returns: The helper handle on success, or an ErrorDetail on failure. Never throws.

TemporaryFileTransferHelper create_sync(AddressSpace addressSpace, const NodeId &parent, const QualifiedName &browseName, const InstantiationOptions &options, TemporaryFileTransferConfig config)

Instantiates a TemporaryFileTransferType node under parent and backs it with this helper.

  • addressSpace (AddressSpace) - Address space the node is created in.
  • parent (const NodeId &) - Node under which the transfer object is instantiated.
  • browseName (const QualifiedName &) - Browse name of the new transfer object.
  • options (const InstantiationOptions &) - Instantiation options for the created subtree.
  • config (TemporaryFileTransferConfig) - Configuration and host hooks (see TemporaryFileTransferConfig). A Good subcode on the answer is not returned; try_create_sync() returns it.

Returns: The helper handle.

Functions

TemporaryFileTransferHelper()=default

Constructs an empty handle that backs no node.

const NodeId & node_id() const

Returns the node id of the instantiated transfer object.

Returns: The node id of the instantiated transfer object.

const TemporaryFileTransfer & transfer() const

Returns the underlying TemporaryFileTransfer wrapper for the instantiated node.

Returns: The TemporaryFileTransfer wrapper for the instantiated node.

void release()

Detaches RAII ownership of the created subtree so it persists beyond this handle's lifetime.

TemporaryFileTransferHelper(TemporaryFileTransfer transfer, std::shared_ptr< State > state)

Constructs a helper that wraps an already-instantiated transfer object and its backing state.

ua::BaseObject

class

Handle to an Object node whose type definition is the base BaseObjectType (i=58).

Wraps an existing or freshly instantiated Object node together with the AddressSpace it lives in. When the handle owns the node subtree it created, destroying the handle without first calling release removes that subtree from the address space; an attached handle (see attach_async) owns nothing and only references the node.

Move-only: copying would duplicate ownership of the underlying subtree. This type serves both as a usable handle and as the base class for generated, strongly typed Object handles, which call create_object_impl_async to instantiate.

Member types

Result< CreateResultData > CreateResult

Result carrying the outcome of an Object instantiation.

std::function< void(CreateResult)> CreateImplCompleteCallback

Callback receiving the CreateResult of create_object_impl_async.

std::function< void(BaseObjectResult)> AttachCompleteCallback

Callback receiving the BaseObjectResult of attach_async.

Static functions

void attach_async(AddressSpace addressSpace, const NodeId &existingInstance, AttachCompleteCallback complete) noexcept

Attaches an existing Object node as a BaseObject handle.

  • addressSpace (AddressSpace) - Address space containing the node.
  • existingInstance (const NodeId &) - NodeId of the Object node to attach.
  • complete (AttachCompleteCallback) - Receives the outcome: on success the Result holds the BaseObject handle; on failure it carries an ErrorDetail. This overload never throws.

Functions

BaseObject()=default

Constructs an empty handle that references no node.

~BaseObject()=default
BaseObject(BaseObject &&) noexcept=default

Transfers ownership of the referenced node and any owned subtree from the moved-from handle, leaving it empty.

BaseObject & operator=(BaseObject &&) noexcept=default

Transfers ownership of the referenced node and any owned subtree from the moved-from handle, leaving it empty.

Returns: Reference to this handle after the move.

const NodeId & node_id() const

Returns the NodeId of the referenced Object node.

Returns: The NodeId of the referenced node; a null NodeId when the handle is empty.

void release()

Releases ownership of the node subtree this handle created.

ua::BaseVariable

class

Handle to a Variable node whose type definition is the base BaseVariableType (i=62).

Wraps an existing or freshly instantiated Variable node together with the AddressSpace it lives in, and exposes the variable's live value: reading and writing the value, and installing the read/write handlers that produce and consume it. A Variable's value is dynamic and possibly externally sourced - it is never a stored attribute, so it is always accessed through this handle's value API rather than via attribute read/write.

When the handle owns the node subtree it created, destroying the handle without first calling release removes that subtree from the address space; a handle that references a pre-existing node owns nothing and only references it.

Move-only: copying would duplicate ownership of the underlying subtree. This type serves both as a usable handle and as the base class for generated, strongly typed Variable handles, which call create_variable_impl_async to instantiate.

Member types

std::function< void(DataValueResult)> ReadValueCompleteCallback

Callback receiving the DataValueResult of read_value_async.

std::function< void(VoidResult)> WriteValueCompleteCallback

Callback receiving the VoidResult of write_value_async.

Result< CreateResultData > CreateResult

Result carrying the outcome of a Variable instantiation.

std::function< void(CreateResult)> CreateImplCompleteCallback

Callback receiving the CreateResult of create_variable_impl_async.

Functions

BaseVariable()=default

Constructs an empty handle that references no node.

~BaseVariable()=default
BaseVariable(BaseVariable &&) noexcept=default

Transfers ownership of the referenced node and any owned subtree from the moved-from handle, leaving it empty.

BaseVariable & operator=(BaseVariable &&) noexcept=default

Transfers ownership of the referenced node and any owned subtree from the moved-from handle, leaving it empty.

Returns: Reference to this handle after the move.

const NodeId & node_id() const

Returns the NodeId of the referenced Variable node.

Returns: The NodeId of the referenced node; a null NodeId when the handle is empty.

void release()

Releases ownership of the node subtree this handle created.

void read_value_async(ReadValueCompleteCallback complete) const noexcept

Reads the variable's live value asynchronously.

  • complete (ReadValueCompleteCallback) - Receives the outcome: on success the Result holds the DataValue; on failure it carries an ErrorDetail. A null callback is ignored and the read is not performed. This overload never throws.
DataValueResult try_read_value_sync() const noexcept

Reads the variable's live value, blocking until complete.

Returns: The DataValue, or an ErrorDetail on failure. Never throws.

DataValue read_value_sync() const

Reads the variable's live value, blocking until complete.

Returns: The DataValue.

void write_value_async(DataValue value, WriteValueCompleteCallback complete) const noexcept

Writes the variable's live value asynchronously.

  • value (DataValue) - The DataValue to write (value, status, timestamps).
  • complete (WriteValueCompleteCallback) - Receives the outcome: on success an empty Result; on failure it carries an ErrorDetail. With a null callback the write is still performed and a failure is logged. This overload never throws.
VoidResult try_write_value_sync(DataValue value) const noexcept

Writes the variable's live value, blocking until complete.

  • value (DataValue) - The DataValue to write.

Returns: An empty Result on success, or an ErrorDetail on failure. Never throws.

void write_value_sync(DataValue value) const

Writes the variable's live value, blocking until complete.

  • value (DataValue) - The DataValue to write.
void set_value_source_async(std::shared_ptr< ValueSource > source, std::function< void(VoidResult)> done) const noexcept

Makes source the owner of this Variable's Value, replacing any attached one; null detaches it (see ExternalValueSource::set_value_source).

  • source (std::shared_ptr< ValueSource >) - The source; one source may serve many Variables (see ValueSource).
  • done (std::function< void(VoidResult)>) - Receives the outcome: on success an empty Result; on failure it carries an ErrorDetail (e.g. the node does not accept a source). Runs on an unspecified worker thread - do not block it. With a null callback the source is still attached and a failure is logged. This overload never throws.
VoidResult try_set_value_source_sync(std::shared_ptr< ValueSource > source) const noexcept

Makes source the owner of this Variable's Value, blocking until complete.

Returns: An empty Result on success, or an ErrorDetail on failure. Never throws.

void set_value_source_sync(std::shared_ptr< ValueSource > source) const

Makes source the owner of this Variable's Value, blocking until complete.

ua::ChildFilterInfo

struct

Describes an Optional child declaration offered to the optional-child filter.

One instance is passed to an OptionalChildFilter for each candidate child so the filter can decide whether to instantiate it.

Public attributes

QualifiedName browseName

Browse name of the candidate child.

NodeClass nodeClass

Node class of the candidate child.

NodeId typeDefinition

Type definition of the child; empty if it has no HasTypeDefinition reference.

NodeId parentTypeDefinition

Type definition of the node the child would be created under.

ua::InstantiationOptions

struct

Tunable options controlling a single type-instantiation operation.

All fields are optional; a default-constructed instance instantiates only mandatory children using the SDK's default string-based NodeId allocation.

Public attributes

std::optional< NodeId > parentReferenceType

Reference type linking the parent to the new instance; unset uses the SDK default.

NodeIdAllocator nodeIdAllocator

Custom allocator for node IDs.

OptionalChildFilter optionalChildFilter

Filter deciding which Optional children to instantiate.

std::optional< uint16_t > targetNamespaceIndex

Namespace index override for the entire instantiated subtree.

bool instantiateNestedTypeOptionals

Also instantiate OPTIONAL children declared on a child's TYPE DEFINITION but not redeclared on its instance declaration (e.g.

MemberTypeResolver memberTypeResolver

Names the concrete type of a member declared with an abstract type (see MemberTypeResolver).

ua::VariableInstantiationAttributes

struct

Attribute overrides applied to a Variable node as it is instantiated.

Passed to InstantiationService::instantiate_variable_async to set instance-specific Variable attributes that differ from the VariableType definition. Each field is optional: an absent (std::nullopt) field leaves the attribute at the value inherited from the type definition, while a present field overrides it on the new instance.

Public attributes

std::optional< NodeId > dataType

DataType of the instance's Value, or std::nullopt to inherit from the type.

std::optional< int32_t > valueRank

ValueRank of the instance, or std::nullopt to inherit from the type.

std::optional< AccessLevelType > accessLevel

AccessLevel bitmask of the instance, or std::nullopt to leave the node's default.

ua::InstantiationService

class

Instantiates type-defined nodes (objects, variables, and optional members) into an address space.

Walks an ObjectType or VariableType definition and materialises its mandatory children (and any selected optional members) under a parent node, allocating NodeIds, attaching HasTypeDefinition and parent edges, and copying attributes recursively. Every operation posts to the owning AddressSpace strand and completes asynchronously on an unspecified worker thread.

The service holds the AddressSpace by value; the caller need not keep its own copy alive for the duration of a call.

Member types

std::function< void(NodeSubtreeResult)> InstantiateCompleteCallback

Completion callback for an instantiation that creates a node subtree.

Functions

InstantiationService(AddressSpace addressSpace)

Constructs a service that instantiates into the given address space.

  • addressSpace (AddressSpace) - Address space the service materialises nodes into; held by value for the lifetime of the service.
void instantiate_object_async(const NodeId &parent, const QualifiedName &browseName, const NodeId &typeDefinition, const InstantiationOptions &options, InstantiateCompleteCallback complete) const noexcept

Instantiates an object of typeDefinition as a child of parent.

  • parent (const NodeId &) - Node the new object is attached to as a child.
  • browseName (const QualifiedName &) - Browse name of the new object node.
  • typeDefinition (const NodeId &) - ObjectType whose definition is instantiated.
  • options (const InstantiationOptions &) - Allocation and filtering policy; see InstantiationOptions.
  • complete (InstantiateCompleteCallback) - Receives the outcome: on success a NodeSubtree rooted at the new object, on failure an ErrorDetail. This overload never throws.
void instantiate_variable_async(const NodeId &parent, const QualifiedName &browseName, const NodeId &typeDefinition, const InstantiationOptions &options, const VariableInstantiationAttributes &attributes, InstantiateCompleteCallback complete) const noexcept

Instantiates a variable of typeDefinition as a child of parent.

  • parent (const NodeId &) - Node the new variable is attached to as a child.
  • browseName (const QualifiedName &) - Browse name of the new variable node.
  • typeDefinition (const NodeId &) - VariableType whose definition is instantiated.
  • options (const InstantiationOptions &) - Allocation and filtering policy; see InstantiationOptions.
  • attributes (const VariableInstantiationAttributes &) - Variable-specific attributes applied to the created node.
  • complete (InstantiateCompleteCallback) - Receives the outcome: on success a NodeSubtree rooted at the new variable, on failure an ErrorDetail. This overload never throws.
void instantiate_optional_members_async(const NodeId &instance, const NodeId &typeDefinition, const InstantiationOptions &options, std::function< void(VoidResult)> complete) const noexcept

Materialises the optional members of typeDefinition onto an existing instance.

  • instance (const NodeId &) - Existing node the selected members are added to.
  • typeDefinition (const NodeId &) - Type whose optional members are considered.
  • options (const InstantiationOptions &) - The filter and allocation policy; see InstantiationOptions.
  • complete (std::function< void(VoidResult)>) - Receives the outcome: a success VoidResult, or an ErrorDetail on failure - Bad_InvalidArgument (OptionalMembersFilterUnset) when options.optionalChildFilter is unset, because then no member would be added; Bad_TypeDefinitionInvalid when an accepted member is declared with an abstract type that options.memberTypeResolver does not resolve. Never throws.

ua::NodeSubtree

class

An owning, move-only handle to the nodes produced by a single instantiation.

Returned by the instantiation engine, it records the subtree's root. On destruction the handle fires a fire-and-forget async delete of exactly the nodes it created (reverse creation order, one single-node AddressSpace::delete_node_async each - not a reference-walked cascade) - never a blocking/synchronous call - giving instantiated subtrees RAII lifetime tied to this object. Call release() to keep the nodes alive past the handle's lifetime, or remove_async() to delete them eagerly.

The handle is move-only: moving transfers ownership and leaves the source released, so only one handle ever owns a given subtree. It does not keep the address space alive: once the address space is released its nodes are gone with it, and cleanup does nothing.

Functions

NodeSubtree()=default

Constructs an empty handle that owns no nodes.

NodeSubtree(AddressSpace addressSpace, NodeId rootId, std::vector< NodeId > createdNodes)

Constructs a handle owning a freshly instantiated subtree.

  • addressSpace (AddressSpace) - Address space the nodes live in and are deleted from on cleanup; the handle keeps a weak handle to it.
  • rootId (NodeId) - Node id of the subtree's root.
  • createdNodes (std::vector< NodeId >) - Ids of every node created for the subtree, in creation order; cleanup deletes them in reverse.
NodeSubtree(NodeSubtree &&other) noexcept

Move-constructs, transferring ownership and leaving other released.

  • other (NodeSubtree &&) - Handle whose owned subtree is transferred; left released.
NodeSubtree & operator=(NodeSubtree &&other) noexcept

Move-assigns, removing this handle's current subtree before taking other's.

  • other (NodeSubtree &&) - Handle whose owned subtree is adopted; left released.

Returns: Reference to this handle.

~NodeSubtree()

Deletes the owned nodes unless the handle was released or already removed.

const NodeId & root() const

Returns the node id of the subtree's root.

Returns: The NodeId identifying the subtree's root node.

void release()

Abandons ownership so the nodes are not deleted on destruction.

void remove_async()

Asynchronously deletes the owned subtree and releases the handle.

void add_created_node(NodeId id)

Records a node as part of the owned subtree so cleanup will delete it.

  • id (NodeId) - Node id to track for cleanup.

ua::ReferenceView

class

Immutable, XML-free view of a single reference, passed to reference_filter.

Functions

ReferenceView(NodeId referenceTypeId, NodeId targetId, bool isForward)

Constructs a view over one reference.

  • referenceTypeId (NodeId) - File-local NodeId of the reference type.
  • targetId (NodeId) - File-local NodeId of the referenced (target) node.
  • isForward (bool) - True for a forward reference, false for an inverse one.
const NodeId & reference_type_id() const

File-local NodeId of the reference type.

Returns: The file-local NodeId of the reference type.

const NodeId & target_id() const

File-local NodeId of the referenced (target) node.

Returns: The file-local NodeId of the referenced (target) node.

bool is_forward() const

True if the reference points forward, false if it is inverse.

Returns: True if the reference points forward, false if it is inverse.

ua::NodeView

class

Immutable, XML-free view of a single node.

Backed by the (private) parse-tree node via a non-owning typed pointer; the accessors below are the only surface customers see. Ids and names are in the file's own (document-local) namespace, matching what a node_filter decides about before any server-side translation. The richer accessors (references, as_data_type, as_variable) require a parsed NodeSetDocument context; in a bare node_filter they return empty.

Functions

NodeView(const ua::xml::nodeset::Node *node, const NodeSetDocumentImpl *document=nullptr)

Constructs a view over a parse-tree node, with an optional document context.

  • node (const ua::xml::nodeset::Node *) - Non-owning pointer to the private parse-tree node.
  • document (const NodeSetDocumentImpl *) - Non-owning pointer to the owning document context, or nullptr when the view is supplied to a bare node_filter (richer accessors then return empty).
NodeId node_id() const

File-local NodeId of this node.

Returns: This node's file-local NodeId.

QualifiedName browse_name() const

File-local browse name of this node.

Returns: This node's file-local browse name.

NodeClass node_class() const

NodeClass of this node.

Returns: This node's NodeClass.

optional< String > category() const

The node's Category annotation, or empty if absent.

Returns: The node's Category annotation, or empty if the node has none.

optional< NodeReleaseStatus > release_status() const

The node's <ReleaseStatus> annotation, or empty if unspecified.

Returns: The node's release status, or empty if the annotation is unspecified.

optional< XmlElement > extensions() const

The node's raw <Extensions> block, or empty if absent.

Returns: The node's raw <Extensions> block, or empty if absent.

std::vector< ReferenceView > references() const

This node's outgoing references, with file-local ids.

Returns: This node's outgoing references, with file-local ids.

optional< DataTypeView > as_data_type() const

DataType-specific detail, or empty if this node is not a DataType.

Returns: DataType-specific detail, or empty if this node is not a DataType or carries no document context.

optional< VariableView > as_variable() const

Variable-specific detail, or empty if this node is not a Variable.

Returns: Variable-specific detail, or empty if this node is not a Variable or carries no document context.

ua::DataTypeFieldView

struct

One field of an (aggregated) DataType structure/enum definition.

Public attributes

String name

Field name.

NodeId dataType

File-local NodeId of the field's DataType.

int32_t valueRank

Value rank: -1 for a scalar, >= 0 for an array of that dimension.

bool isOptional

True if the field is optional in the structure.

ua::DataTypeView

class

DataType-specific view: abstractness, structure/enum kind, and the aggregated field list.

The field list includes base-type fields, resolved across the parsed document.

Functions

DataTypeView(const ua::xml::nodeset::Node *node, const NodeSetDocumentImpl *document)

Constructs a DataType view over a parse-tree node and its document context.

  • node (const ua::xml::nodeset::Node *) - Non-owning pointer to the private parse-tree node.
  • document (const NodeSetDocumentImpl *) - Non-owning pointer to the owning document context.
bool is_abstract() const

True if the DataType is abstract.

Returns: True if the DataType is abstract.

bool is_structure() const

True if the DataType is a structure.

Returns: True if the DataType is a structure.

bool is_enumeration() const

True if the DataType is an enumeration.

Returns: True if the DataType is an enumeration.

std::vector< DataTypeFieldView > fields() const

The aggregated field list, including inherited base-type fields.

Returns: The aggregated field list, including inherited base-type fields.

ua::VariableView

class

Variable-specific view: the variable's DataType and value rank.

Functions

VariableView(const ua::xml::nodeset::Node *node)

Constructs a Variable view over a parse-tree node.

  • node (const ua::xml::nodeset::Node *) - Non-owning pointer to the private parse-tree node.
NodeId data_type() const

File-local NodeId of the variable's DataType.

Returns: The file-local NodeId of the variable's DataType.

int32_t value_rank() const

Value rank: -1 for a scalar, >= 0 for an array of that dimension.

Returns: The variable's value rank: -1 for a scalar, >= 0 for an array of that dimension.

ua::NamespaceMapping

struct

One server namespace slot allocated (or resolved) for a URI the file declared.

Public attributes

String uri

Declared namespace URI.

uint16_t serverIndex

File-local namespace index for the URI.

ua::ModelRef

struct

A reference to a dependent model declared via <RequiredModel>.

Public attributes

String uri

Model namespace URI.

String version

Required model version string.

ua::NodeSetParseOptions

struct

Options controlling how a NodeSet stream is parsed into a NodeSetDocument.

Public attributes

std::function< std::unique_ptr< Stream >(const ModelRef &)> resolveRequiredModel

Resolves <RequiredModel> dependencies to their NodeSet streams.

StructureResolver structureResolver

Resolves custom ExtensionObject value types.

bool decodeValues

When false, Variant values are not decoded (type-graph-only inspection). Defaults to true.

ua::NodeSetDocument

class

Immutable, owned read model of a parsed NodeSet (and its resolved dependencies).

Produced by try_parse_nodeset_sync; move-only and not copyable. The document exposes no import method - importing it into an AddressSpace is a separate free-function concern (see ua_nodeset_import.h).

try_parse_nodeset_sync

Functions

NodeSetDocument(std::unique_ptr< NodeSetDocumentImpl > impl)

Constructs a document from its private implementation.

  • impl (std::unique_ptr< NodeSetDocumentImpl >) - Owned implementation backing the read model.
NodeSetDocument(NodeSetDocument &&) noexcept

Move-constructs, transferring ownership of the read model.

NodeSetDocument & operator=(NodeSetDocument &&) noexcept

Move-assigns, transferring ownership of the read model.

Returns: Reference to this document.

~NodeSetDocument()
std::span< const NamespaceMapping > declared_namespaces() const

Namespaces the file declares, in file-local order.

Returns: The namespaces the file declares, in file-local order.

std::span< const ModelRef > required_models() const

The <RequiredModel> dependencies declared by the file.

Returns: The <RequiredModel> dependencies declared by the file.

std::vector< NodeView > nodes() const

All parsed nodes, as file-local views.

Returns: All parsed nodes, as file-local views.

optional< NodeView > find(const NodeId &nodeId) const

Finds a parsed node by its file-local NodeId.

  • nodeId (const NodeId &) - File-local NodeId to look up.

Returns: The matching node view, or empty if no node has that id.

optional< XmlElement > extensions() const

The NodeSet-level <Extensions> block describing the primary nodeset, or empty if absent.

Returns: The NodeSet-level <Extensions> block, or empty if absent.

DateTime last_modified() const

The primary nodeset's LastModified timestamp.

Returns: The timestamp, or a default-constructed (epoch) DateTime when the attribute is absent.

ua::NodeSetExportSummary

struct

Outcome counts of a completed NodeSet export.

Public attributes

std::vector< NamespaceMapping > namespacesWritten

The non-NS0 namespaces written to the document, in file order.

std::size_t nodesExported

Count of nodes the NodeSetExportOptions::nodeFilter accepted.

std::size_t referencesExported

Count of references written across all exported nodes.

ua::NodeSetModelRef

struct

A <RequiredModel> dependency declared by an exported <Model>.

Public attributes

String uri

Required model namespace URI.

String version

Required model version string.

DateTime publicationDate

Required model publication date.

ua::NodeSetExportModel

struct

One <Model> entry written to the document's <Models> header.

Public attributes

String uri

Model namespace URI.

String version

Model version string.

DateTime publicationDate

Model publication date.

std::vector< NodeSetModelRef > requiredModels

Declared <RequiredModel> dependencies.

ua::ExportNodeView

struct

Immutable, lightweight view of a node passed to NodeSetExportOptions::nodeFilter.

Unlike the import-side NodeView (backed by a parse tree), this carries the live node's identity and browse name directly - the attributes a filter needs to decide whether to export the node.

Public attributes

NodeId nodeId

The node's NodeId (server namespace index).

NodeClass nodeClass

The node's NodeClass.

QualifiedName browseName

The node's browse name (server namespace index).

ua::NodeSetExportOptions

struct

Controls which namespaces, nodes, and references are exported, and how the document is framed.

All members default to a permissive configuration: empty filters include everything, the scope is Scope::Full, aliases are emitted, and an unencodable value fails the export.

Member types

Scope (enum)

Subset of the address space to export.

  • Full - Export all nodes and references the filters accept.
  • TypeDefinitionsOnly - Export only type-definition nodes (Object/Variable/Data/Reference types).

OnUnencodableStructure (enum)

Disposition for a value that cannot be transcoded to XML (an unresolved opaque binary-bodied ExtensionObject).

  • Fail - Abort the export with a clean Result error (default).
  • OmitValue - Omit the offending <Value> but keep the rest of the node and the document.

Public attributes

std::vector< uint16_t > namespaces

Server namespace indices to export.

std::function< bool(const ExportNodeView &)> nodeFilter

Predicate selecting which nodes are exported; an empty function includes all.

std::function< bool(const ReferenceView &)> referenceFilter

Predicate selecting which references are exported; an empty function includes all.

enum ua::NodeSetExportOptions::Scope scope

Defaults to Scope::Full.

std::vector< NodeSetExportModel > models

<Models> header entries, each with its <RequiredModel> dependencies.

optional< DateTime > lastModified

Optional LastModified timestamp, written as an attribute on <UANodeSet> when set.

bool emitAliases

Whether to emit an <Aliases> table giving symbolic names to the reference/data types used.

StructureResolver structureResolver

Reifies an opaque binary-bodied ExtensionObject value to a typed Structure so it can be transcoded to XML.

enum ua::NodeSetExportOptions::OnUnencodableStructure onUnencodableStructure

Defaults to OnUnencodableStructure::Fail.

ua::NodeSetImportSummary

struct

Outcome counts of a completed NodeSet import.

Public attributes

std::vector< NamespaceMapping > namespacesAllocated

URIs the file declared that were resolved to, or newly allocated in, the server namespace table during this import.

std::size_t nodesImported

Count of nodes the NodeSetImportOptions::nodeFilter accepted.

std::size_t referencesImported

Count of references the NodeSetImportOptions::referenceFilter accepted.

ua::NodeSetImportOptions

struct

Controls how a NodeSet is filtered, scoped, and resolved during import.

All members default to a permissive, side-effect-free configuration: empty filters include everything, the scope is Scope::Full, and unset resolvers disable their respective behaviour (surfacing the corresponding gap as a clean Result error rather than a crash).

Member types

Scope (enum)

Subset of the NodeSet to import.

  • Full - Import all nodes and references the filters accept.
  • TypeDefinitionsOnly - Import only type-definition nodes (types, not instances).

OnUnknownStructure (enum)

Disposition for a value containing an ExtensionObject whose type cannot be resolved.

  • Fail - Abort the import with a clean Result error (default).
  • ImportOpaque - Store the value as a preserved opaque ExtensionObject.

Public attributes

std::function< bool(const NodeView &)> nodeFilter

Predicate selecting which nodes are imported; an empty function includes all.

std::function< bool(const ReferenceView &)> referenceFilter

Predicate selecting which references are imported; an empty function includes all.

enum ua::NodeSetImportOptions::Scope scope

Defaults to Scope::Full.

NamespaceFactory namespaceFactory

Allocates server namespace slots for URIs the file declares but the server lacks.

std::function< std::unique_ptr< Stream >(const ModelRef &)> resolveRequiredModel

Resolves a <RequiredModel> dependency to the NodeSet stream that satisfies it.

StructureResolver structureResolver

Resolves the custom ExtensionObject value types (named by <TypeId>) encountered during decode; empty disables custom types.

enum ua::NodeSetImportOptions::OnUnknownStructure onUnknownStructure

Defaults to OnUnknownStructure::Fail.

ua::MethodConfig

struct

The choices add_method_sync leaves to the caller.

Public attributes

std::optional< NodeId > nodeId

The Method node's NodeId.

std::optional< LocalizedText > description

The Method node's Description attribute. Unset: none.

NodeId parentReferenceType

The reference from the parent to the Method.

ua::AddressSpace

class

The server's node/reference graph and the entry point for node access.

An AddressSpace owns a set of Namespace instances (indexed by the NamespaceArray) and routes node operations to the namespace that owns the target NodeId. It is a cheap-to-copy value handle (Pimpl) over a shared implementation: copies share the same underlying graph, and the graph stays alive while any copy (or a locked WeakAddressSpace) exists.

Each namespace serializes its own mutable state on a private strand; the *_async methods post work there and complete on an unspecified worker thread, while the sync / try_sync variants block the calling thread until that work completes.

Member types

std::function< void(NodeAccessorResult)> FindNodeCompleteCallback

Completion of find_node_async: an accessor for the Node, or why there is none.

std::function< void(BatchResult< NodeAccessorResult >)> FindNodesCompleteCallback

Completion of find_nodes_async: one accessor result per NodeId, in request order.

std::function< void(Result< std::vector< NodeId > >)> EnumerateNodesCallback

Completion of enumerate_nodes_async: the namespace's NodeIds, or why it cannot list them.

std::function< void(NodeAccessorResult)> CreateNodeCompleteCallback

Completion of create_node_async: an accessor for the created Node, or why it was not created.

std::function< void(Result< uint16_t >)> AddNamespaceCallback

Callback receiving the permanent index assigned by asynchronous namespace registration.

std::function< void(VoidResult)> DeleteNodeCompleteCallback

Callback receiving the outcome of an asynchronous node deletion.

Static functions

AddressSpace create(String applicationUri, boost::asio::any_io_executor executor)

Creates an AddressSpace with namespace 0 (and the application namespace) initialised.

  • applicationUri (String) - Application URI seeded into namespace 1 and the ServerArray.
  • executor (boost::asio::any_io_executor) - Executor on which namespace strands and async completions run.

Returns: A handle to the newly created address space.

Functions

const ExecutionLimits & limits() const

Returns the per-operation execution budgets applied while a single operation runs.

Returns: The current execution budgets.

void set_limits(ExecutionLimits limits)

Sets the per-operation execution budgets applied while a single operation runs.

  • limits (ExecutionLimits) - New budgets to apply to subsequent operations. Every field must be greater than zero. See limits for what these do and do not bound.
void set_operation_limits(ServiceOperationLimits limits)

Sets the per-service operation limits that bound each call this address space makes to a namespace.

  • limits (ServiceOperationLimits) - The limits to apply to later calls. A limit that is set must be greater than zero (OPC 10000-5 6.3.11).
boost::asio::any_io_executor executor() const

Returns the executor on which this address space's async work runs.

Returns: The bound I/O executor.

ua::Logger logger() const

Returns the logger for async work done on this address space's behalf.

Returns: The bound logger, or a no-op logger if none was seeded.

uint64_t model_generation() const noexcept

Returns the monotonic generation of the address space's model: its Nodes, their References, and their BrowseNames and DataTypes.

Returns: The model changes counted so far. The value never decreases, and it SATURATES at UINT64_MAX rather than wrapping - so a cache comparing a stored generation against this one can never be fooled into reusing a stale entry by wrap-around, at the cost of ceasing to invalidate once saturated.

void validate_event_graph_async(std::function< void(VoidResult)> complete) const noexcept

Checks that the event-source graph of every namespace is loop-free and legal.

  • complete (std::function< void(VoidResult)>) - Called once, on a thread of this address space's executor, with: Good; or the first violation found, Bad_ReferenceNotAllowed with the ErrorDetail that names it - EventReferenceCycle for a loop, EventReferenceEndpointUnavailable, EventReferenceSourceUnavailable or EventReferenceTargetUnavailable for an end that does not resolve, or EventReferenceSourceNotSubscribable or EventReferenceTargetNotSubscribable for an illegal source or target; or, when no violation was found but part of the graph could not be read, Uncertain_NotAllNodesAvailable with the ErrorDetail EventGraphNotFullyChecked, naming the namespaces that declined to enumerate and caused by the first lookup, References read or ReferenceType walk that failed; or Bad_Shutdown (AddressSpaceGone) when this address space goes during the check.
VoidResult try_validate_event_graph_sync() const noexcept

validate_event_graph_async, waiting for its answer.

Returns: The answer of validate_event_graph_async; or Bad_WouldBlock on a thread of this address space's executor, where the check is not started because its answer may need that thread. Never throws.

void validate_event_graph_sync() const

try_validate_event_graph_sync, throwing for any answer other than Good.

void set_logger(ua::Logger logger)

Seeds the logger returned by logger().

  • logger (ua::Logger) - The logger to bind (a value handle; copied).
shared_ptr< Namespace > create_namespace(string_view uri, std::vector< RolePermissionType > rolePermissions, std::optional< AccessRestrictionType > accessRestrictions=std::nullopt)

Creates a new in-memory namespace with declarative access-control defaults.

Returns: Shared ownership of the configured namespace; never null.

void add_namespace_async(shared_ptr< Namespace > namespaceToAdd, AddNamespaceCallback callback) noexcept

Registers namespaceToAdd through the address-space lifecycle coordinator.

  • namespaceToAdd (shared_ptr< Namespace >) - Candidate namespace. Must be non-null, have a non-empty unique URI and fit in the remaining UInt16 namespace-index space.
  • callback (AddNamespaceCallback) - Receives the permanent dense index, or a rich validation, preparation or shutdown failure.
void add_namespace_async(shared_ptr< Namespace > namespaceToAdd, NamespaceMetadataOptions metadata, AddNamespaceCallback callback) noexcept

Registers namespaceToAdd, stating what metadata is to be published for it.

  • namespaceToAdd (shared_ptr< Namespace >) - Candidate namespace, as above.
  • metadata (NamespaceMetadataOptions) - Publication intent and the descriptive facts to publish.
  • callback (AddNamespaceCallback) - Receives the permanent dense index, or a rich failure.
Result< uint16_t > try_add_namespace_sync(shared_ptr< Namespace > namespaceToAdd, NamespaceMetadataOptions metadata={}) noexcept

Registers a namespace and blocks the external caller until the canonical async flow completes.

  • namespaceToAdd (shared_ptr< Namespace >) - The namespace to register.
  • metadata (NamespaceMetadataOptions) - Publication intent and descriptive facts; defaults to ordinary publication.

Returns: The permanent index, or the async operation's exact StatusCode and ErrorDetail. Never throws.

uint16_t add_namespace_sync(shared_ptr< Namespace > namespaceToAdd, NamespaceMetadataOptions metadata={})

Registers a namespace and blocks the external caller until the canonical async flow completes.

  • namespaceToAdd (shared_ptr< Namespace >) - The namespace to register.
  • metadata (NamespaceMetadataOptions) - Publication intent and descriptive facts; defaults to ordinary publication.

Returns: The permanent dense index.

void find_node_async(const NodeId &nodeId, FindNodeCompleteCallback callback) noexcept

Looks up the node identified by nodeId, completing asynchronously.

  • nodeId (const NodeId &) - Node to look up.
  • callback (FindNodeCompleteCallback) - Receives the outcome: a NodeAccessor for the node with the namespace's code; on failure it carries an ErrorDetail (e.g. BadNodeIdUnknown when the namespace index is unknown). This overload never throws.
void find_nodes_async(std::span< const NodeId > nodeIds, FindNodesCompleteCallback callback) noexcept

Resolves a batch of nodes, grouping by owning namespace, completing asynchronously.

  • nodeIds (std::span< const NodeId >) - Nodes to resolve, viewed but not owned by the callee. The span need only stay valid for the synchronous portion of the call.
  • callback (FindNodesCompleteCallback) - Receives a BatchResult with one NodeAccessorResult per input id, in request order (an accessor with the namespace's code, as find_node_async gives it, or a status carrying any ErrorDetail - e.g. BadNodeIdUnknown for an unknown namespace index). The batch status is good whenever per-item results were produced. Never throws.
void enumerate_nodes_async(uint16_t namespaceIndex, EnumerateNodesCallback callback) noexcept

Enumerates the NodeIds of every node owned by the namespace at namespaceIndex.

  • namespaceIndex (uint16_t) - Index of the namespace whose nodes are enumerated.
  • callback (EnumerateNodesCallback) - Receives a Result holding the owned NodeIds on success, or a bad StatusCode carrying any ErrorDetail (BadNodeIdUnknown for an unknown index; BadNotSupported if the namespace cannot enumerate). This overload never throws.
NodeAccessorResult try_find_node_sync(const NodeId &nodeId) noexcept

Looks up the node identified by nodeId, blocking until complete.

  • nodeId (const NodeId &) - Node to look up.

Returns: A NodeAccessor with the namespace's code, as find_node_async gives it, or an ErrorDetail on failure. Never throws. Bad_WouldBlock when called on a thread of this address space's executor, which may be the thread that would run the answer: use the *_async overload there.

NodeAccessor find_node_sync(const NodeId &nodeId)

Looks up the node identified by nodeId, blocking until complete.

  • nodeId (const NodeId &) - Node to look up.

Returns: A NodeAccessor for the node.

Result< T > try_find_sync(const NodeId &nodeId) noexcept

Looks up nodeId and downcasts the accessor to T, blocking until complete.

  • nodeId (const NodeId &) - Node to look up.

Returns: The node accessor as T with the lookup's code (a Good subcode, or an Uncertain code with the accessor), an ErrorDetail with BadNodeClassInvalid if the node is not a T, or the lookup's own failure detail. Never throws.

T find_sync(const NodeId &nodeId)

Looks up nodeId and downcasts the accessor to T, blocking until complete.

  • nodeId (const NodeId &) - Node to look up.

Returns: The node accessor as T.

void find_async(const NodeId &nodeId, std::function< void(Result< T >)> callback) noexcept

Looks up nodeId and downcasts the accessor to T, completing asynchronously.

  • nodeId (const NodeId &) - Node to look up.
  • callback (std::function< void(Result< T >)>) - Receives the outcome: the accessor as T with the lookup's code (a Good subcode, or an Uncertain code with the accessor), an ErrorDetail with BadNodeClassInvalid if the node is not a T, or the lookup's own failure detail. This overload never throws.
void create_node_async(const NodeId &nodeId, NodeClass nodeClass, InitialAttributes initialAttributes, CreateNodeCompleteCallback callback) noexcept

Creates a node of nodeClass at nodeId, completing asynchronously.

  • nodeId (const NodeId &) - Identifier for the new node; its namespace index selects the owner.
  • nodeClass (NodeClass) - Node class to create (Object, Variable, Method, ...).
  • initialAttributes (InitialAttributes) - Standard attributes to apply atomically at creation (interface refactor 5.2); may be empty for a bare node.
  • callback (CreateNodeCompleteCallback) - Receives the outcome: a NodeAccessor for the new node with the namespace's code (a Good subcode, or an Uncertain code with the accessor, is kept); on failure an ErrorDetail (e.g. BadNodeIdUnknown for an unknown namespace). This overload never throws.
void create_node_async(const NodeId &nodeId, NodeClass nodeClass, CreateNodeCompleteCallback callback) noexcept

Creates a bare node of nodeClass at nodeId, completing asynchronously.

  • nodeId (const NodeId &) - Identifier for the new node; its namespace index selects the owner.
  • nodeClass (NodeClass) - Node class to create (Object, Variable, Method, ...).
  • callback (CreateNodeCompleteCallback) - Receives the outcome, exactly as the initial-attribute overload. Never throws.
NodeAccessorResult try_create_node_sync(const NodeId &nodeId, NodeClass nodeClass, InitialAttributes initialAttributes={}) noexcept

Creates a node of nodeClass at nodeId, blocking until complete.

  • nodeId (const NodeId &) - Identifier for the new node.
  • nodeClass (NodeClass) - Node class to create.
  • initialAttributes (InitialAttributes) - Standard attributes to apply atomically at creation; may be empty.

Returns: A NodeAccessor for the new node with the namespace's code, as create_node_async gives it, or an ErrorDetail on failure. Never throws. Bad_WouldBlock when called on a thread of this address space's executor, which may be the thread that would run the answer: use the *_async overload there.

NodeAccessor create_node_sync(const NodeId &nodeId, NodeClass nodeClass, InitialAttributes initialAttributes={})

Creates a node of nodeClass at nodeId, blocking until complete.

  • nodeId (const NodeId &) - Identifier for the new node.
  • nodeClass (NodeClass) - Node class to create.
  • initialAttributes (InitialAttributes) - Standard attributes to apply atomically at creation; defaults to none.

Returns: A NodeAccessor for the new node.

Result< T > try_create_sync(const NodeId &nodeId, NodeClass nodeClass, InitialAttributes initialAttributes={}) noexcept

Creates a node and downcasts the accessor to T, blocking until complete.

  • nodeId (const NodeId &) - Identifier for the new node.
  • nodeClass (NodeClass) - Node class to create.
  • initialAttributes (InitialAttributes) - Standard attributes to apply atomically at creation; defaults to none.

Returns: The new node's accessor as T with the creation's code (a Good subcode, or an Uncertain code with the accessor), an ErrorDetail with BadNodeClassInvalid if it is not a T, or the creation's own failure detail. Never throws.

T create_sync(const NodeId &nodeId, NodeClass nodeClass, InitialAttributes initialAttributes={})

Creates a node and downcasts the accessor to T, blocking until complete.

  • nodeId (const NodeId &) - Identifier for the new node.
  • nodeClass (NodeClass) - Node class to create.
  • initialAttributes (InitialAttributes) - Standard attributes to apply atomically at creation; defaults to none.

Returns: The new node's accessor as T.

void create_async(const NodeId &nodeId, NodeClass nodeClass, InitialAttributes initialAttributes, std::function< void(Result< T >)> callback) noexcept

Creates a node and downcasts the accessor to T, completing asynchronously.

  • nodeId (const NodeId &) - Identifier for the new node.
  • nodeClass (NodeClass) - Node class to create.
  • initialAttributes (InitialAttributes) - Standard attributes to apply atomically at creation; may be empty.
  • callback (std::function< void(Result< T >)>) - Receives the outcome: the new node's accessor as T with the creation's code (a Good subcode, or an Uncertain code with the accessor), an ErrorDetail with BadNodeClassInvalid if it is not a T, or the creation's own failure detail. This overload never throws.
void create_async(const NodeId &nodeId, NodeClass nodeClass, std::function< void(Result< T >)> callback) noexcept

Creates a bare node and downcasts the accessor to T, completing asynchronously.

  • nodeId (const NodeId &) - Identifier for the new node.
  • nodeClass (NodeClass) - Node class to create.
  • callback (std::function< void(Result< T >)>) - Receives the outcome, exactly as the initial-attribute overload. Never throws.
void delete_node_async(const NodeId &nodeId, bool deleteForwardHierarchicallyReferencedNodes, ReferenceHalves halves, DeleteNodeCompleteCallback callback) noexcept

Deletes the node identified by nodeId, completing asynchronously.

  • nodeId (const NodeId &) - Node to delete.
  • deleteForwardHierarchicallyReferencedNodes (bool) - If true, recursively delete the whole subtree: nodeId and every node reachable from it via forward hierarchical references (any subtype of HierarchicalReferences, in any namespace). Descendants are deleted before their parents; cycles and shared nodes are deleted once. If false, only nodeId is deleted (the spec-aligned single-node DeleteNodes).
  • halves (ReferenceHalves) - Which halves of the deleted nodes' References go. Both (DeleteNodes' deleteTargetReferences TRUE): the deleted nodes, the halves they hold, and the halves every other node of this address space holds of a Reference to a deleted node. ThisHalfOnly (deleteTargetReferences FALSE, OPC 10000-4 5.7.4.2): the deleted nodes and the halves they hold; every other node keeps its half of a Reference to a deleted node, which is left unresolved (5.7.4.1; OPC 10000-3 4.3.4 allows a Reference to a node that does not exist). Its NodeVersion does not advance and no ModelChangeEvent lists it.
  • callback (DeleteNodeCompleteCallback) - Receives the outcome: success, or an ErrorDetail on failure (e.g. BadNodeIdUnknown). With Both it answers once every other namespace has answered the removal of its half of a Reference to a deleted node; when one could not remove it, the nodes are deleted and the answer is Uncertain_ReferenceNotDeleted (Part 4 5.7.4.4). A success carries the Good code the namespaces answered the deletes with, combined by detail::combined_status, so a Good subcode is not lost. A References read or lookup of a subtree's Node answered Uncertain is not acted on: it is answered Bad_InternalError (ReferencesAnswerUncertain or LookupAnswerUncertain). This overload never throws.
VoidResult try_delete_node_sync(const NodeId &nodeId, bool deleteForwardHierarchicallyReferencedNodes, ReferenceHalves halves=ReferenceHalves::Both) noexcept

Deletes the node identified by nodeId, blocking until complete.

  • nodeId (const NodeId &) - Node to delete.
  • deleteForwardHierarchicallyReferencedNodes (bool) - If true, recursively delete the whole forward-hierarchical subtree (see delete_node_async); if false, only nodeId.
  • halves (ReferenceHalves) - Which halves of the deleted nodes' References go, as for delete_node_async: by default the halves every other node holds too.

Returns: Success, or an ErrorDetail on failure; Uncertain_ReferenceNotDeleted as for delete_node_async. Never throws. Bad_WouldBlock when called on a thread of this address space's executor, which may be the thread that would run the answer: use the *_async overload there.

void delete_node_sync(const NodeId &nodeId, bool deleteForwardHierarchicallyReferencedNodes, ReferenceHalves halves=ReferenceHalves::Both)

Deletes the node identified by nodeId, blocking until complete.

  • nodeId (const NodeId &) - Node to delete.
  • deleteForwardHierarchicallyReferencedNodes (bool) - If true, recursively delete the whole forward-hierarchical subtree (see delete_node_async); if false, only nodeId.
  • halves (ReferenceHalves) - Which halves of the deleted nodes' References go, as for delete_node_async: by default the halves every other node holds too.
void shutdown_async(std::function< void(VoidResult)> callback) noexcept

Stops the background work every registered namespace is running.

const NamespaceArray & namespace_array() const

Returns the array mapping namespace indices to namespace URIs.

Returns: Read-only reference to the committed namespace array.

ServerArray & server_array()

Returns the array of server URIs known to this address space.

Returns: Mutable reference to the server array.

const ServerArray & server_array() const

Returns the array of server URIs known to this address space.

Returns: Read-only reference to the server array.

CodecNamespaceContext codec_namespace_context() const

Returns a codec namespace context whose resolver reads namespace indexes from this address space.

Returns: A CodecNamespaceContext bound to this address space.

WeakAddressSpace weak() const

Returns a non-owning weak handle to this address space.

Returns: A WeakAddressSpace that does not keep the graph alive and must be lock()-ed before use.

ua::dynamic_types::AddressSpaceModelAccess

class

TypeModelAccess implementation that reads and browses a local AddressSpace.

Server-side adapter that satisfies the TypeModelAccess Read/Browse contract by querying the local address space's namespaces directly, bypassing the service layer (no authentication, session, or diagnostics). Use SessionModelAccess for the client-side variant that issues service calls over a session.

The adapter holds the AddressSpace weakly, so neither it nor an outstanding read or browse keeps the address space alive: one started after the address space is gone answers Bad_Shutdown with ErrorDetail code AddressSpaceGone. As with the base interface, this type is not safe for concurrent use from multiple threads against the same instance.

TypeModelAccess

Functions

AddressSpaceModelAccess(ua::AddressSpace &addressSpace)

Constructs an adapter over addressSpace.

  • addressSpace (ua::AddressSpace &) - Address space queried by read_async / browse_async. Held weakly.
void read_async(std::vector< ua::ReadValueId > nodesToRead, ReadCallback complete) override

Reads one or more attribute values from the local address space.

  • nodesToRead (std::vector< ua::ReadValueId >) - Attributes to read, each a NodeId + AttributeId pair.
  • complete (ReadCallback) - Receives the outcome: on success a Result holding the per-input ua::DataValue vector; on failure a Result carrying an ua::ErrorDetail. Never throws.
void browse_async(std::vector< ua::BrowseDescription > nodesToBrowse, BrowseCallback complete) override

Browses references from one or more nodes in the local address space.

  • nodesToBrowse (std::vector< ua::BrowseDescription >) - Nodes to browse, each describing a starting NodeId, direction, and reference-type filter.
  • complete (BrowseCallback) - Receives the outcome: on success a Result holding the per-input ua::BrowseResult vector; on failure a Result carrying an ua::ErrorDetail. Never throws.

ua::BaseEvent

class

Base class for all OPC UA events.

Holds the nine mandatory BaseEventType properties as concrete members for O(1) access. Subclasses (generated or hand-written) add type-specific fields and override resolve_field() to expose them.

This is a pure value type: no async, no strands, no I/O. Instances are constructed, populated, and handed to the EventBus, which fills in any unset auto-assigned fields (see the per-member notes) before dispatch.

Functions

Variant resolve_field(std::span< const QualifiedName > browsePath) const

Resolves a field by browse path for EventFilter evaluation.

Returns: The field value, or a null Variant if the field is not part of this event type.

std::unique_ptr< BaseEvent > clone() const

Creates a heap-allocated copy preserving the concrete event type.

Returns: An owning pointer to a copy with the same dynamic type as *this.

ExpandedNodeId event_type_expanded() const

Returns the EventType id in URI-bearing form.

Returns: The EventType identifier as an ExpandedNodeId.

bool is_condition_event() const

Returns true for condition-derived events (Condition and all subtypes).

Returns: true if this event derives from ConditionType, otherwise false.

BaseEvent()=default
~BaseEvent()=default
BaseEvent(const BaseEvent &)=default

Copy-constructs a BaseEvent; the field snapshots are value members, so the copy is independent.

BaseEvent & operator=(const BaseEvent &)=default

Copy-assigns a BaseEvent; the field snapshots are value members, so the copy is independent.

Returns: Reference to this event.

BaseEvent(BaseEvent &&)=default

Move-constructs a BaseEvent, transferring the field snapshots from the source.

BaseEvent & operator=(BaseEvent &&)=default

Move-assigns a BaseEvent, transferring the field snapshots from the source.

Returns: Reference to this event.

Public attributes

ByteString eventId

Unique identifier for this event occurrence.

NodeId eventType

NodeId of the EventType (e.g.

NodeId sourceNode

NodeId of the node that is the source of the event.

String sourceName

Human-readable description of the event source.

UtcTime time

Time the event occurred.

UtcTime receiveTime

Time the server received the event.

LocalizedText message

Human-readable event description.

uint16_t severity

Severity from 1 (lowest) to 1000 (highest).

std::optional< NodeId > conditionClassId

NodeId of the condition class this event belongs to, if any.

std::optional< LocalizedText > conditionClassName

Human-readable name of the condition class named by condition_class_id, if any.

std::optional< NodeId > conditionNodeId

NodeId of the ConditionType instance this event is about (the ConditionId), if any.

std::shared_ptr< const std::vector< NodeId > > eventTypeHierarchy

The resolved EventType supertype chain for this event occurrence: [event_type, parent, ..., BaseEventType].

ua::DescribedNodes

class

A ready-made Node store for a namespace that does not write its own Node class: it holds one Node per NodeId while anyone holds it, and nothing once the last holder lets go.

A gateway or a computed namespace answers its lookups with node_for and its writes with record_write, and so meets the Node contract without writing a Node class: one Node per NodeId, attributes() answered at once and safe during a write, writes visible to every holder once they complete, deleted() set by a delete.

It holds Nodes weakly. A namespace that wants to keep a Node's description longer than any caller holds the Node (a cache) keeps the shared_ptr<Node> itself; the store still guarantees one Node per NodeId while it is held.

Thread-safe: every member may be called from any thread, concurrently, also while the namespace holds its own locks. No member calls back into the namespace or into the SDK.

The Nodes it hands out return nullptr from both probes (external_value_source(), method_call_source()): their Values and Methods are served by the namespace's batched members.

Functions

DescribedNodes()
~DescribedNodes()
shared_ptr< Node > node_for(NodeDescription description)

The Node for description.node_id(): the one already held, now carrying this description, or a new one.

Returns: The Node; never null.

VoidResult record_write(const NodeId &nodeId, AttributeId attributeId, const Variant &value) noexcept

Applies a successful write to the held Node, if one is held; otherwise does nothing.

  • nodeId (const NodeId &) - The Node written.
  • attributeId (AttributeId) - The Attribute written; not a Variable's Value.
  • value (const Variant &) - The written value in wire form.

Returns: Good, also when no Node is held; or the status of NodeDescription::try_with_attribute when the value cannot be applied, in which case the Node is unchanged. Never throws.

shared_ptr< Node > held(const NodeId &nodeId, std::optional< Duration > maxAge) const

The Node held for nodeId, if one is held and its description was set no longer ago than maxAge; otherwise null, and the namespace asks its source.

  • nodeId (const NodeId &) - The NodeId looked up.
  • maxAge (std::optional< Duration >) - The oldest description acceptable, in milliseconds; nullopt accepts any age.

Returns: The held Node, or null.

void remove(const NodeId &nodeId)

Marks the held Node for nodeId deleted and forgets it, so that a later node_for for the same NodeId makes a new Node and old holders keep seeing a deleted Node, never the new one's Attributes.

  • nodeId (const NodeId &) - The NodeId deleted.

ua::GenericEvent

class

Property-bag event for event types that have no generated C++ struct.

Extends BaseEvent with a set of extension fields keyed by browse path, letting an application emit custom or user-defined event types without code-generating a payload class. The mandatory BaseEventType properties are set through the inherited BaseEvent members; type-specific properties are added with set_field. Like BaseEvent this is a plain data type no async, no strands, no I/O - so instances are not thread-safe and must be externally synchronised if shared.

BaseEvent

Functions

GenericEvent(NodeId typeId)

Constructs an event of the given EventType.

  • typeId (NodeId) - NodeId of the EventType this occurrence represents; moved into the inherited BaseEvent::eventType member.
void set_field(std::vector< QualifiedName > browsePath, Variant value)

Sets an extension field, addressed by its browse path relative to the EventType.

  • browsePath (std::vector< QualifiedName >) - Browse path identifying the field; moved into storage.
  • value (Variant) - Field value; moved into storage. A null Variant clears the field's value but keeps the path addressable.
Variant resolve_field(std::span< const QualifiedName > browsePath) const override

Resolves a field by browse path, checking mandatory base fields first, then the extension fields added via set_field.

Returns: The field value, or a null Variant if no base or extension field matches browsePath.

std::unique_ptr< BaseEvent > clone() const override

Creates a heap-allocated copy preserving the concrete type and extension fields.

Returns: An owning copy of this event as a BaseEvent pointer; never null.

ua::MethodAdapter

class

Decodes a Call service request into a strongly-typed method handler.

Wraps a handler that receives method input arguments as a typed InputArgs tuple instead of a raw Variant list. When invoked as a node's method callable, the adapter validates arity, decodes each Variant into the corresponding tuple element, and forwards the result to the wrapped handler; decode and arity failures are reported to the completion callback without reaching the handler.

InputArgs is a std::tuple whose elements name the expected argument types in order. A trailing std::optional<U> element marks an optional trailing input argument (OPC 10000-4 5.11.2.2) that the client may omit, in which case the handler receives std::nullopt. Optional arguments must follow all required ones (OPC 10000-3 5.7.3); this trailing-only invariant is checked at compile time.

InputArgs std::tuple of expected input-argument types, in declaration order, with optional trailing elements modelled as std::optional<U>. OutputArgs void for this form, whose handler encodes its own outputs; the std::tuple<In...>, std::tuple<Out...> specialisation below takes a handler of either typed form and encodes the outputs itself.

Member types

std::function< void(const NodeId &objectId, const InputArgs &, shared_ptr< const MethodCallContext >, CallMethodResult, CallMethodCompleteCallback)> Handler

Typed method handler invoked once the input arguments are decoded.

Functions

MethodAdapter(Handler handler)

Constructs an adapter that forwards decoded calls to handler.

  • handler (Handler) - Typed handler invoked on a successful argument decode. Moved into the adapter and retained for the adapter's lifetime.
void operator()(const CallMethodRequest &callMethodRequest, shared_ptr< const MethodCallContext > context, CallMethodCompleteCallback callback) const

Decodes callMethodRequest and invokes the wrapped handler.

  • callMethodRequest (const CallMethodRequest &) - Request carrying the object NodeId and input argument Variant list.
  • context (shared_ptr< const MethodCallContext >) - Per-call session context, or null when no session context is available. Held by shared ownership for the (possibly asynchronous) duration of the call.
  • callback (CallMethodCompleteCallback) - Receives the CallResult outcome exactly once.

ua::MethodAdapter< std::tuple< In... >, std::tuple< Out... > >

class

Decodes a Call service request into a typed method handler of either form, and encodes its result.

The handler is synchronous, (const MethodCall&, const In&...) -> MethodResult<Out...>, for work that waits for nothing, or asynchronous, (const MethodCall&, const In&..., MethodResultCallback<Out...>), for work that must ask the address space or another component; the form is chosen at compile time from the handler's parameters, and a handler of both forms (a generic lambda) or neither does not compile. The adapter checks the argument count, decodes every input (a mismatch is Bad_InvalidArgument with Bad_TypeMismatch for that argument, and the handler is not called), calls the handler, and turns its MethodResult into the Call's result:

The handler returns, or passes to done The client receives the outputs Good, with the outputs MethodResult::with_status(Good_..., outputs) Good and the outputs; MethodStatusQualified MethodResult::with_status(Uncertain_..., outputs) that status, with the outputs a Bad StatusCode, or a failed Result / VoidResult that status, no outputs, the ErrorDetail reject_argument(...) Bad_InvalidArgument, a status per input, a DiagnosticInfo per rejection (either form) throws Bad_InternalError with an ErrorDetail; the exception never escapes (asynchronous) every copy of done dropped Bad_InternalError, the ErrorDetail naming the Method (asynchronous) done called twice the first result counts; the second is ignored and logged

A Good status with a subcode is not allowed as a Method's statusCode (OPC 10000-4 5.11.2.4): the Call service answers it plain Good with the outputs, the given code as the cause of the ErrorDetail MethodStatusQualified, and logs a warning. A caller in the same process (MethodAccessor) receives the code as given.

The handler runs on the thread that delivers the Call to the Method node. It never calls a *_sync function: on an executor thread that returns Bad_WouldBlock. Work that needs the address space uses the asynchronous form. In The input arguments' C++ types; a trailing std::optional<T> is an optional argument. Out The output arguments' C++ types.

Functions

MethodAdapter(Handler handler, ua::Inputs< In... > inputs={}, Logger logger={})

Wraps handler.

  • handler (Handler) - The handler; copied with the adapter.
  • inputs (ua::Inputs< In... >) - The input arguments' descriptions, whose names go into a rejected argument's ErrorDetail; default for none.
  • logger (Logger) - Where a handler that completes twice is reported; silent by default.
void operator()(const CallMethodRequest &callMethodRequest, shared_ptr< const MethodCallContext > context, CallMethodCompleteCallback callback) const

Decodes callMethodRequest, calls the handler and delivers the Call's result to callback once.

  • callMethodRequest (const CallMethodRequest &) - The request: the Object, the Method and the input arguments.
  • context (shared_ptr< const MethodCallContext >) - The calling session's context, or null.
  • callback (CallMethodCompleteCallback) - Receives the result exactly once.

ua::Arg

struct

One argument of a Method.

The C++ type T is the argument's type in the handler, and through ua::data_type_of it is also the DataType, ValueRank and ArrayDimensions published in the Method's InputArguments or OutputArguments Property, so the published signature and the decoding cannot disagree. Made by ua::arg, or by ua::argument for an argument whose DataType is known only at run time. T The argument's C++ type; ua::hasDataType must be true for it.

Public attributes

std::string name

The argument's name, published as Argument.Name.

LocalizedText description

The argument's description, published as Argument.Description; empty when there is none.

std::optional< NodeId > dataType

The DataType given to ua::argument. Unset otherwise, and then ua::data_type_of<T>() applies.

std::optional< int32_t > valueRank

The ValueRank given to ua::argument. Unset otherwise, and then ua::value_rank_of<T>() applies.

ua::Inputs

struct

A Method's input arguments, in order.

A trailing std::optional<T> argument is optional (OPC 10000-3 5.7.3): the client may omit it, and the handler then receives std::nullopt. T The arguments' C++ types.

Public attributes

std::tuple< Arg< T >... > args

The arguments.

ua::Outputs

struct

A Method's output arguments, in order.

T The arguments' C++ types.

Public attributes

std::tuple< Arg< T >... > args

The arguments.

ua::MethodCall

class

What a typed method handler is told about the call it serves.

Functions

MethodCall(NodeId objectId, NodeId methodId, shared_ptr< const MethodCallContext > context)
  • objectId (NodeId) - The Object the Method was called on.
  • methodId (NodeId) - The Method.
  • context (shared_ptr< const MethodCallContext >) - The calling session's context; null for a call with no session.
const NodeId & object_id() const noexcept

Returns the Object the Method was called on: for a Method declared on an ObjectType, the instance.

Returns: The ObjectId of the call.

const NodeId & method_id() const noexcept

Returns the Method.

Returns: The MethodId of the call.

const MethodCallContext & context() const noexcept

Returns the calling session's context.

Returns: The calling session's context.

ua::ArgumentRejection

class

The input arguments a method handler refuses, each with its status (OPC 10000-4 5.11.2.4, Table 68).

Made by reject_argument; returned as a MethodResult, which the client receives as Bad_InvalidArgument with one status per input argument. Every rejected argument carries an ErrorDetail, either the handler's own, or one the SDK builds. The SDK adds the argument's index and name and the Method and Object NodeIds to it, and never the argument's value, which can be a secret; a handler adds the value itself when it is safe to show.

Functions

ArgumentRejection & and_argument(std::size_t index, StatusCode status)

Rejects another argument as well.

  • index (std::size_t) - The argument's index in the Method's input arguments.
  • status (StatusCode) - Why: a Bad status.

Returns: This rejection.

ArgumentRejection & and_argument(std::size_t index, StatusCode status, shared_ptr< const ErrorDetail > detail)

Rejects another argument as well, saying why in an ErrorDetail.

  • index (std::size_t) - The argument's index in the Method's input arguments.
  • status (StatusCode) - Why: a Bad status.
  • detail (shared_ptr< const ErrorDetail >) - The facts, built by the rules of error handling: a literal summary and context keys.

Returns: This rejection.

const std::vector< Rejected > & rejected() const noexcept

Returns the rejected arguments, in the order they were given.

Returns: The rejected arguments.

ua::MethodResult

class

The outcome of a Method call (OPC 10000-4 5.11.2.2), as a typed method handler reports it.

Made by The result holds the outputs (return {a, b};) Good, the outputs with_status (an Uncertain status, outputs) that status, the outputs with_status (a Good subcode, outputs) that status, the outputs; a client receives Good a Result holding the only output its status, a Good subcode included, the output a Bad StatusCode, or a failed Result / VoidResult that status, its ErrorDetail, no outputs a status that is not Bad, for a Method with no outputs that status, a Good subcode included reject_argument Bad_InvalidArgument, one status per input argument

The result holds the status the handler gave, and an in-process call (MethodAccessor::try_call_sync) returns it as given. The Call service answers a client the result's status as the Method's statusCode, with the outputs, and its ErrorDetail in the operation's diagnostics, with one exception: OPC 10000-4 5.11.2.4 forbids a Good status with a subcode as a Method's statusCode, so the Call service answers one plain Good, keeps the outputs, gives that status the ErrorDetail MethodStatusQualified whose cause is the given code, and logs a warning naming the Method and the code. A handler's mistake is reported as Bad_InternalError with an ErrorDetail saying what it did, never as a status it did not mean: a Bad status given to with_status, a successful Result or a status that is not Bad given where outputs are due, or a rejection whose status is not Bad. Out The output arguments' C++ types.

Static functions

MethodResult with_status(StatusCode status, Out... outputs)

A status with the outputs: an Uncertain status for a call that failed but whose outputs explain why, such as an application error code (OPC 10000-4 5.11.2.2).

  • status (StatusCode) - The status.
  • outputs (Out...) - The outputs.

Returns: The result.

Functions

MethodResult(Out... outputs)

Good, with every output.

  • outputs (Out...) - The outputs.
MethodResult(std::in_place_t, Out... outputs)

Good, with every output.

  • outputs (Out...) - The outputs.
MethodResult(StatusCode status, shared_ptr< const ErrorDetail > detail={})

A failure: the status, no outputs, and the ErrorDetail in the client's diagnostics.

  • status (StatusCode) - A Bad status. For a Method with no outputs, a Good and an Uncertain status are also accepted, since nothing is missing; a Good status with a subcode is kept, and the Call service answers it to a client plain Good with the ErrorDetail MethodStatusQualified (OPC 10000-4 5.11.2.4).
  • detail (shared_ptr< const ErrorDetail >) - The facts; when null, the status's own ErrorDetail is kept.
MethodResult(const Result< U > &result)

Passes a Result on.

  • result (const Result< U > &) - The result.
MethodResult(ArgumentRejection rejection)

Bad_InvalidArgument, with one status per input argument.

const StatusCode & status_code() const noexcept

Returns the result's status: for a handler's result, the status the handler gave, a Good subcode included, or the Bad_InternalError its mistake is reported with; for an in-process call's result (MethodAccessor::try_call_sync), the status the call answered.

Returns: The status, carrying its ErrorDetail if it has one.

bool has_outputs() const noexcept

Returns whether the result carries outputs: true for a successful call, and for an Uncertain one made with with_status.

Returns: Whether outputs may be read.

const std::tuple< Out... > & outputs() const

Returns the outputs.

Returns: The outputs, in order.

const auto & value() const

Returns the only output.

Returns: The output.

const std::vector< StatusCode > & argument_results() const noexcept

Returns the status of each input argument: empty unless the call was rejected with Bad_InvalidArgument.

Returns: The statuses, by argument index.

ua::MethodResultCallback

class

The completion of an asynchronous method handler: call it once, from any thread, with the result.

Copies share one completion. The first call completes the Method; a second is ignored and logged as an error. If every copy is destroyed uncalled, the SDK completes the call with Bad_InternalError and an ErrorDetail naming the Method, so the client never waits for a time-out. Out The output arguments' C++ types.

Functions

void operator()(MethodResult< Out... > result) const

Completes the Method with result.

ua::ExternalReference

struct

A reference from a deleted node whose target lives in another namespace.

Returned for a deleted Node by Namespace::delete_nodes_async so the caller (the owning AddressSpace) can remove the corresponding inverse reference from the target node, which a single namespace cannot reach on its own.

Public attributes

NodeId referenceType

Type of the dangling reference.

ExpandedNodeId target

Cross-namespace endpoint that still holds the inverse reference.

bool isForward

Direction of the reference as seen from the deleted node.

ua::Namespace

class

One OPC UA namespace within the server address space.

A namespace owns a disjoint set of nodes addressed under a single namespace URI / index. The owning AddressSpace routes every request to the namespace that owns the target node. Implementations decide their own threading and serialization (typically a private strand); callers invoke from any thread and a completion runs on an unspecified worker thread - do not block it.

One rule explains every member hereAnswer synchronously if you can. Go asynchronous only in batches. Decline a capability you do not have. A member that can answer from state you already hold returns its answer, and returns nullopt to mean ask me again through the asynchronous form - never to mean denied. The immediate find_node and effective_permissions are this shape. Every asynchronous member is BATCHED. There is deliberately no asynchronous single-node lookup: a namespace fronting a remote server collapses N cold round trips into one, and that is only worth anything if it is the only way in. Everything optional declines by default, so a namespace implements what it can do and says nothing about what it cannot. Monitoring is the exception: once the namespace is registered, the SDK's monitoring helper samples every item by default (create_monitoring_async).

Implementations override the pure-virtual core (uri, shutdown_async, find_nodes_async, read_references_async and read_values_async) and may override the optional members; the base provides a decline default for each.

The batched membersThe _async members taking a RequestInfo first (find_nodes_async, read_references_async, read_values_async, write_async and the rest) are the namespace API every service and every accessor reaches the namespace through. Conventions that hold for every one of them: Each takes the request's RequestInfo first. The members that act on behalf of a Session (read_values_async, write_async, call_async, create_monitoring_async) also take a const CallerInfo, null for the server's own call. Each completes EXACTLY ONCE, inline or later, on any thread, with one result per item in item order. A bad batch status fails every item. The address space checks the count and accepts one completion; an exception thrown by a member becomes Bad_InternalError for that call's items. None is noexcept. No SDK lock is held while a member runs, and a member must not block. Lifetime. Everything a member is given - the RequestInfo, the CallerInfo pointer, the spans, and everything an item refers to - is valid until the member RETURNS. The two exceptions are the Nodes items carry, which the caller holds by shared_ptr until the call completes, and CallItem::context, which is shared and may be kept. A namespace that answers later copies what it needs before returning: a RequestInfo or CallerInfo is cheap to copy, and copying CallerInfo::identity keeps the identity alive. Ownership. The address space holds a registered namespace until the address space is destroyed. The completion a member is given does not hold the namespace: a namespace that answers after its member has returned keeps itself alive for that work, for example by holding a shared_ptr to itself in what it posts, or checks through a weak_ptr that it still exists. Its last reference may be released on any thread, including the thread on which it completes a call, so its destructor must not join or wait for that thread. A member is called by the address space. Calling one directly from other code is allowed (a forwarding namespace, a test), and skips the address space's work around it; each member with such work says what is skipped.

Functions

Namespace()=default
~Namespace()
String uri() const =0

Returns the namespace URI that uniquely identifies this namespace.

Returns: The namespace URI, the string form used to register and look this namespace up in the server's namespace array.

VoidResult attach(NamespaceContext context)

Gives this namespace the context of its registration, once.

  • context (NamespaceContext) - The registration's context; only the address space creates one.

Returns: Good, Bad_InvalidState when this object was attached already, Bad_InvalidArgument for the context a namespace answers before it is attached, or the answer of on_attached (an exception it throws is answered as its status).

void shutdown_async(std::function< void(VoidResult)> callback) noexcept=0

Stops the background work this namespace is running, without destroying it.

  • callback (std::function< void(VoidResult)>) - Invoked exactly once when this namespace has no work left running. Runs on an unspecified worker thread. Never throws.
void find_nodes_async(const RequestInfo &request, std::span< const NodeId > nodeIds, std::optional< Duration > maxAge, std::function< void(BatchResult< NodeResult >)> complete)=0

Looks up nodes this namespace owns.

  • request (const RequestInfo &) - The request served.
  • nodeIds (std::span< const NodeId >) - NodeIds of this namespace to look up.
  • maxAge (std::optional< Duration >) - The Read service's maxAge (OPC 10000-4 5.10.2.2), in milliseconds, for the Attributes of the Nodes it reads a non-Value Attribute of; nullopt from every other caller, and the namespace then uses its own default. A namespace whose store is its source ignores it.
  • complete (std::function< void(BatchResult< NodeResult >)>) - One NodeResult per NodeId: the Node, or Bad_NodeIdUnknown for a NodeId this namespace does not hold, with any ErrorDetail.
std::optional< NodeResult > find_node(const NodeId &nodeId, std::optional< Duration > maxAge)

Looks up one node from state this namespace already holds.

  • nodeId (const NodeId &) - The NodeId to look up.
  • maxAge (std::optional< Duration >) - As find_nodes_async. A caching namespace declines rather than answer from a copy older than maxAge allows (DescribedNodes::held does this).

Returns: The outcome, or nullopt to be asked in a batch. The default declines.

void enumerate_nodes_async(const RequestInfo &request, std::function< void(Result< std::vector< NodeId > >)> complete)

Enumerates the NodeIds of every node this namespace owns.

void read_references_async(const RequestInfo &request, std::span< const ReferenceQuery > queries, std::function< void(BatchResult< NodeReferencesResult >)> complete)=0

Reads the References nodes hold.

void release_resume_token(ByteString token)

Releases what a resume token from read_references_async holds, when its caller abandons it (a Browse continuation point released or discarded, a TranslateBrowsePaths path answered before its References were read to the end).

void read_values_async(const RequestInfo &request, const CallerInfo *caller, std::span< const ValueReadItem > items, Duration maxAge, bool setSourceTimestamp, std::function< void(BatchResult< DataValueResult >)> complete)=0

Reads Variables' Values.

  • request (const RequestInfo &) - The request served.
  • caller (const CallerInfo *) - On whose behalf the Values are read; null for the server's own reads.
  • items (std::span< const ValueReadItem >) - One item per Value; each carries the Node this namespace returned.
  • maxAge (Duration) - The Read request's maxAge in milliseconds (OPC 10000-4 5.10.2.2); 0 from every other caller, which asks for the source to be read.
  • setSourceTimestamp (bool) - true when the caller wants the SourceTimestamp.
  • complete (std::function< void(BatchResult< DataValueResult >)>) - One DataValueResult per item.
void write_async(const RequestInfo &request, const CallerInfo *caller, std::span< const ValueWriteItem > items, std::function< void(BatchResult< VoidResult >, std::vector< VersionedNode >)> complete)

Writes Attributes: Variables' Values and every other writable Attribute.

void call_async(const RequestInfo &request, const CallerInfo *caller, std::span< const CallItem > items, std::function< void(BatchResult< std::optional< CallResult > >)> complete)

Runs Method calls, or declines them.

void view_contains_async(const RequestInfo &request, const NodeId &view, std::span< const ExpandedNodeId > nodes, std::function< void(BatchResult< BoolResult >)> complete)

Answers which Nodes are members of a View this namespace holds.

void add_to_view_async(const RequestInfo &request, const NodeId &view, std::span< const NodeId > nodes, std::function< void(BatchResult< VoidResult >, std::vector< VersionedNode >)> complete)

Adds Nodes to a View this namespace holds.

void create_nodes_async(const RequestInfo &request, std::span< const NodeCreation > nodes, std::function< void(BatchResult< NodeResult >)> complete)

Creates Nodes, each with its Attributes, in one call.

void delete_nodes_async(const RequestInfo &request, std::span< const NodeId > nodes, ReferenceHalves halves, std::function< void(BatchResult< DeleteNodeResult >, std::vector< VersionedNode >)> complete)

Deletes Nodes.

void add_references_async(const RequestInfo &request, std::span< const ReferenceChange > changes, std::function< void(BatchResult< VoidResult >, std::vector< VersionedNode >)> complete)

Adds Reference halves held by Nodes of this namespace.

void remove_references_async(const RequestInfo &request, std::span< const ReferenceChange > changes, std::function< void(BatchResult< VoidResult >, std::vector< VersionedNode >)> complete)

Removes Reference halves held by Nodes of this namespace.

void create_monitoring_async(const RequestInfo &request, const CallerInfo *caller, std::span< const MonitoringCreateItem > items, std::function< void(BatchResult< MonitoringCreateItemResult >)> complete)

Creates monitoring registrations.

  • request (const RequestInfo &) - The request served: for CreateMonitoredItems, the deadline its timeoutHint sets from its arrival, and a cancellation flag set when the create has ended, after which no answer is read.
  • caller (const CallerInfo *) - The subscription's current caller, sink->caller() at the time of the call; null for a sink with no Session.
  • items (std::span< const MonitoringCreateItem >) - The items to register. An item from CreateMonitoredItems carries the Node this namespace's lookup returned for it for the same request (MonitoringCreateItem::node) and the IndexRange to which the namespace narrows every sample it delivers (MonitoringCreateItem::indexRange); a sample larger than the range fails its monitored item with Bad_InternalError.
  • complete (std::function< void(BatchResult< MonitoringCreateItemResult >)>) - One result per item: a handle, or why the item was refused.
void modify_monitoring_async(const RequestInfo &request, std::span< const MonitoringModifyItem > items, std::function< void(BatchResult< MonitoringModifyItemResult >)> complete)

Modifies monitoring registrations.

void delete_monitoring_async(const RequestInfo &request, std::span< const MonitoringHandle > handles, std::function< void(BatchResult< VoidResult >)> complete)

Deletes monitoring registrations.

shared_ptr< NamespaceRegisterNodesDelegate > register_nodes_delegate() noexcept

Returns the delegate that customizes RegisterNodes/UnregisterNodes handling for this namespace.

Returns: The register-nodes delegate, or nullptr to use the SDK's default handling.

shared_ptr< NamespaceHistoryDelegate > history_delegate() noexcept

Returns the delegate that provides historical-access for nodes in this namespace.

Returns: The history delegate, or nullptr if this namespace has no history support.

std::optional< PermissionType > effective_permissions(const AccessIdentity &identity, const Node *node) const

What identity may do with node, or with this namespace when node is null.

  • identity (const AccessIdentity &) - The caller equivalence class; borrowed for the call only.
  • node (const Node *) - A Node of this namespace, or null to ask about the namespace itself; borrowed for the call only. A Node whose deleted() is true is the caller's to refuse with Bad_NodeIdUnknown before asking.

Returns: The effective permission bits, or nullopt when only the asynchronous member can answer.

void effective_permissions_async(const RequestInfo &request, shared_ptr< const AccessIdentity > identity, std::optional< std::vector< NodeId > > nodes, EffectivePermissionsCallback callback)

Resolves effective permissions for nodes of this namespace, or for the namespace itself, in one call.

  • request (const RequestInfo &) - The request served; its deadline bounds the wait.
  • identity (shared_ptr< const AccessIdentity >) - The caller equivalence class, owned so it may be kept across the call.
  • nodes (std::optional< std::vector< NodeId > >) - Engaged and non-empty for node subjects; disengaged for the namespace subject.
  • callback (EffectivePermissionsCallback) - Completion carrying the effective masks; invoked exactly once.
void validate_role_permissions_updates_async(const RequestInfo &request, std::span< const RolePermissionsUpdate > updates, std::function< void(BatchResult< VoidResult >)> complete)

Refuses proposed RolePermissions changes that would leave the Server inoperable (OPC 10000-3 5.2.9: "Servers shall prevent Permissions from being changed in such a way as to render the Server inoperable").

std::optional< std::vector< RolePermissionType > > default_role_permissions() const

This namespace's DefaultRolePermissions - the Part 3 5.2.9 fallback for a node carrying none.

Returns: The namespace-wide default; see the three states above.

std::optional< AccessRestrictionType > default_access_restrictions() const

This namespace's DefaultAccessRestrictions - the channel condition for a node carrying none.

Returns: The namespace-wide channel condition, or nullopt for none. Default: nullopt.

void on_identity_released(const AccessIdentityKey &key) noexcept

No further call will name key.

  • key (const AccessIdentityKey &) - The key of the identity now dead. Never reissued.
std::optional< NodeId > metadata_object() const

The NamespaceMetadataType Object this namespace already serves for itself.

Returns: The Object this namespace serves, or nullopt to let the SDK create one.

ua::NamespaceArray

class

The address space's table of registered namespaces, keyed by index and URI.

Holds the ordered list of Namespace instances that back a server's address space. The position of a namespace in this table is its namespace index, the small integer that qualifies every NodeId on the wire; index 0 is OPC UA NS0 (http://opcfoundation.org/UA/), installed by initialise(). Lookups are bidirectional: index -> URI/Namespace and URI -> index/Namespace.

All operations are internally synchronised by a shared mutex, so the table may be queried and extended concurrently from any thread.

Functions

shared_ptr< Namespace > get_namespace(uint16_t index) const

Returns the namespace registered at index, or nullptr if none.

  • index (uint16_t) - Namespace index to resolve.

Returns: The Namespace at index, or an empty shared_ptr if index is out of range. Does not throw.

shared_ptr< Namespace > get_namespace(string_view uri) const

Returns the namespace whose URI equals uri.

  • uri (string_view) - Namespace URI to resolve. Not retained.

Returns: The matching Namespace.

uint16_t get_namespace_index(string_view uri) const

Returns the index of the namespace whose URI equals uri.

  • uri (string_view) - Namespace URI to resolve. Not retained.

Returns: The namespace index for uri.

String get_namespace_uri(uint16_t index) const

Returns the URI of the namespace registered at index.

  • index (uint16_t) - Namespace index to resolve.

Returns: The namespace URI at index.

Array< String > get_namespace_array() const

Returns the registered URIs ordered by namespace index.

Returns: The namespace array as published in the NamespaceArray Variable, element i being the URI of namespace index i.

ua::AccessIdentityKey

class

Identifies an access identity for as long as it is live.

Opaque, stable for the identity's lifetime, never reused within a server, equality-comparable and hashable - which is the whole of its contract, because its only purpose is to let a namespace key its own tables by the caller it was asked about and drop the row when Namespace::on_identity_released names it.

A namespace shall not read anything into the value: it is a server-assigned token, not an index, and two servers in one process assign from separate sequences.

Functions

AccessIdentityKey() noexcept=default

Constructs the key no live identity ever carries, so a default-constructed key compares equal to no issued one.

AccessIdentityKey(uint64_t value) noexcept

Constructs a key over a server-assigned token.

  • value (uint64_t) - Non-zero token; the server's identity table is the only thing that may assign one.
bool valid() const noexcept

Whether this key names an identity at all.

Returns: true iff the key was assigned rather than default-constructed.

uint64_t value() const noexcept

The opaque token, for hashing and for correlating a log line with a key.

Returns: The assigned token, or zero for a default-constructed key.

ua::AccessIdentity

class

The equivalence class of callers a namespace is asked about.

Not a Session. Several sessions of one user, on one endpoint, with one application URI and one claim set are one identity and are prepared once; the same user on an unsecured and on an encrypted endpoint are two, because Part 18 4.4.1 compares Endpoint settings when granting Roles, so the two can hold different Roles and must not share an answer.

The SDK keeps an identity alive from the moment it is first named until the last caller mapping to it has gone, and issues no call naming it outside that window. A namespace may therefore hold the key - never the object - in its own tables and rely on Namespace::on_identity_released to tell it when the row is dead.

Functions

AccessIdentity(AccessIdentityKey key, std::vector< NodeId > grantedRoles, shared_ptr< const UserIdentity > user, shared_ptr< const EndpointSecurityContext > endpoint, String applicationUri) noexcept

Assembles an identity.

  • key (AccessIdentityKey) - The server-assigned key, already unique among live identities.
  • grantedRoles (std::vector< NodeId >) - Part-18 Role NodeIds granted to this identity; may be empty.
  • user (shared_ptr< const UserIdentity >) - The authenticated principal; non-null, and outlives this object.
  • endpoint (shared_ptr< const EndpointSecurityContext >) - The negotiated endpoint security context; non-null, and outlives this object.
  • applicationUri (String) - The calling client's application URI, copied because the address-space layer cannot see inside endpoint.
AccessIdentity(AccessIdentityKey key, std::vector< NodeId > grantedRoles, std::vector< NodeId > registeredRoles, shared_ptr< const UserIdentity > user, shared_ptr< const EndpointSecurityContext > endpoint, String applicationUri, uint64_t roleConfigurationEpoch=0) noexcept

Assembles an identity with a coherent snapshot of every configured Role.

  • key (AccessIdentityKey) - The interning key for this identity.
  • grantedRoles (std::vector< NodeId >) - The Roles the identity holds.
  • registeredRoles (std::vector< NodeId >) - Every Role in configuration, granted or not.
  • user (shared_ptr< const UserIdentity >) - The authenticated user the identity was activated for.
  • endpoint (shared_ptr< const EndpointSecurityContext >) - The endpoint security context the Session activated over.
  • applicationUri (String) - The client application URI the Session presented.
  • roleConfigurationEpoch (uint64_t) - The RoleConfiguration generation the snapshots were read at; zero when the identity was built without one.
const AccessIdentityKey & key() const noexcept

The key that names this identity for as long as it is live.

Returns: The key; stable, and never reissued once the identity is released.

std::span< const NodeId > granted_roles() const noexcept

The Part-18 Roles granted to this identity, as NodeIds.

Returns: The granted Roles, in configuration order; may be empty. Valid while this object is.

std::optional< std::span< const NodeId > > registered_roles() const noexcept

Returns the complete registered Role set captured with granted_roles.

Returns: Every registered Role, or nullopt when no RoleConfiguration snapshot was taken.

const UserIdentity & user() const noexcept

The authenticated principal - kind, id and claims - for a namespace deciding its own way.

Returns: The principal. Valid while this object is.

std::string_view application_uri() const noexcept

The calling client's verified application URI.

Returns: The URI, possibly empty. Valid while this object is.

uint64_t role_configuration_epoch() const noexcept

RoleConfiguration epoch against which the Role snapshots were evaluated.

Returns: The epoch the Role snapshots were read at, or zero when there was no configuration.

const EndpointSecurityContext & endpoint() const noexcept

The negotiated endpoint security context - mode, policy, endpoint and transport.

Returns: The endpoint context. Valid while this object is.

ua::NamespaceContext

class

What the SDK gives a namespace: its index in the server's namespace array, and the monitoring helper of its registration.

Only the address space creates a context, one per registration, and gives it to the registered object through Namespace::attach, which accepts one context once. A namespace reads its index through Namespace::context(); a namespace that forwards to another passes the context it was given on, by calling the other's attach from its on_attached. Copies share the context.

When a registration fails, the namespace object keeps its context and cannot be attached again: the application registers a new namespace object.

Functions

uint16_t index() const noexcept

The index the namespace was registered at in the server's namespace array.

Returns: The namespace index; 0 for the context Namespace::context() answers before its namespace is attached.

default_ns::NamespaceMonitoringSupport & monitoring() const noexcept

The monitoring helper of this registration: the one helper the context and every copy of it answer, which samples and delivers the namespace's monitored items (see ua_namespace_monitoring_support.h).

Returns: The registration's helper, valid while this context or a copy of it lives.

void model_changed(std::span< const ModelChangeReport > changes) const noexcept

Reports changes the namespace made to its own Nodes itself, outside the address space's routes (NR-27, NR-36 rule 3): the model generation advances at once, and one ModelChangeEvent for changes is raised later, on the address space's executor (a GeneralModelChangeEvent listing the Nodes, or a BaseModelChangeEvent when a ValueRank or ArrayDimensions changed).

void semantics_changed(std::span< const SemanticChangeReport > changes) const noexcept

Reports that Properties with the SemanticChange flag (OPC 10000-3 5.6.2) changed their Value: one SemanticChangeEvent listing changes is raised later, on the address space's executor (NR-38).

VoidResult constant_values_changed(std::function< void(VoidResult)> completion) const noexcept

Reports that this namespace changed the Value of at least one Variable whose AccessLevelEx has the Constant bit (OPC 10000-3 8.58), through a Write or by itself; the SDK then advances this namespace's ConfigurationVersion (NR-40).

  • completion (std::function< void(VoidResult)>) - Called once, on the address space's executor and never on the calling thread inside this member, so it cannot re-enter a lock the caller holds; after the advance that covers this change: Good, also when the namespace has no ConfigurationVersion; otherwise why ConfigurationVersion could not be advanced.

Returns: Good when the advance was queued. Bad_Shutdown before the namespace is attached, after its registration failed or the address space shut down, and after the address space is gone: nothing was queued and completion is never called.

ua::NamespaceHistoryDelegate

class

Extension interface through which a namespace serves OPC UA historical data and events.

A namespace implements this interface to expose history for the nodes it owns; the SDK's HistoryRead and HistoryUpdate services dispatch to it. Each operation is a batched, callback-canonical request: the delegate receives the full list of per-node items and reports each outcome through a BatchResult delivered to the supplied callback. The batch-level status reports whether the request as a whole was accepted; the per-item Result values carry each node's outcome and, on failure, an ErrorDetail.

All operations have default implementations that report BadHistoryOperationUnsupported for every item, so a delegate need only override the operations whose support it declares via capabilities. Every *_async method is noexcept and never throws - failures are reported through the result payload, never by exception.

The callback may be invoked inline on the calling stack or later from a worker thread; callers apply the post discipline (see async rules). Do not block the callback.

Member types

DetailKind (enum)

Identifies which kind of history read a continuation point belongs to.

std::any Cursor

Opaque pagination state, created and interpreted only by the delegate.

Result< HistoryReadRawSuccess > ReadRawItemResult

Per-item result of a raw/modified value-history read.

Result< HistoryReadAtTimeSuccess > ReadAtTimeItemResult

Per-item result of a read-at-time operation.

Result< HistoryReadProcessedSuccess > ReadProcessedItemResult

Per-item result of an aggregate-processed read.

Result< HistoryReadAnnotationSuccess > ReadAnnotationItemResult

Per-item result of an annotation read.

Result< HistoryReadEventsSuccess > ReadEventsItemResult

Per-item result of a historical-event read.

Result< HistoryUpdateSuccess > UpdateDataItemResult

Per-item result of a value-history update.

Result< HistoryUpdateSuccess > UpdateEventsItemResult

Per-item result of a historical-event update.

Result< HistoryUpdateSuccess > UpdateStructureDataItemResult

Per-item result of a structured-history update.

UpdateDataItemResult DeleteItemResult

Per-item result of any history delete operation.

std::function< void(BatchResult< ReadRawItemResult >)> ReadRawCallback

Callback receiving the per-item outcomes of a read_raw_async batch.

std::function< void(BatchResult< ReadAtTimeItemResult >)> ReadAtTimeCallback

Callback receiving the per-item outcomes of a read_at_time_async batch.

std::function< void(BatchResult< ReadProcessedItemResult >)> ReadProcessedCallback

Callback receiving the per-item outcomes of a read_processed_async batch.

std::function< void(BatchResult< ReadAnnotationItemResult >)> ReadAnnotationCallback

Callback receiving the per-item outcomes of a read_annotations_async batch.

std::function< void(BatchResult< ReadEventsItemResult >)> ReadEventsCallback

Callback receiving the per-item outcomes of a read_events_async batch.

std::function< void(BatchResult< UpdateDataItemResult >)> UpdateDataCallback

Callback receiving the per-item outcomes of an update_data_async batch.

std::function< void(BatchResult< UpdateEventsItemResult >)> UpdateEventsCallback

Callback receiving the per-item outcomes of an update_events_async batch.

std::function< void(BatchResult< UpdateStructureDataItemResult >)> UpdateStructureDataCallback

Callback receiving the per-item outcomes of an update_structure_data_async batch.

std::function< void(BatchResult< DeleteItemResult >)> DeleteRawCallback

Callback receiving the per-item outcomes of a delete_raw_async batch.

std::function< void(BatchResult< DeleteItemResult >)> DeleteAtTimeCallback

Callback receiving the per-item outcomes of a delete_at_time_async batch.

std::function< void(BatchResult< DeleteItemResult >)> DeleteEventsCallback

Callback receiving the per-item outcomes of a delete_events_async batch.

Functions

~NamespaceHistoryDelegate()=default
Capabilities capabilities() const noexcept

Declares which history operations this delegate supports.

Returns: The supported-operation flags. The default returns all-false (no operations supported).

void read_raw_async(const ReadContext &context, std::vector< ReadRawItem > items, ReadRawCallback callback) noexcept

Reads raw or modified value history for a batch of nodes.

  • context (const ReadContext &) - Read context, including cancellation flag and timestamp preference.
  • items (std::vector< ReadRawItem >) - Per-node read requests, taken by value so the delegate may retain them.
  • callback (ReadRawCallback) - Receives a BatchResult whose batch status reports whether the request was accepted, and each per-item Result holds the node's values or an ErrorDetail. This method never throws.
void read_at_time_async(const ReadContext &context, std::vector< ReadAtTimeItem > items, ReadAtTimeCallback callback) noexcept

Reads values at specific timestamps for a batch of nodes.

  • context (const ReadContext &) - Read context, including cancellation flag and timestamp preference.
  • items (std::vector< ReadAtTimeItem >) - Per-node read requests, taken by value so the delegate may retain them.
  • callback (ReadAtTimeCallback) - Receives a BatchResult whose per-item Result holds the node's values or an ErrorDetail. This method never throws.
void read_processed_async(const ReadContext &context, std::vector< ReadProcessedItem > items, ReadProcessedCallback callback) noexcept

Reads aggregate-processed value history for a batch of nodes.

  • context (const ReadContext &) - Read context, including cancellation flag and timestamp preference.
  • items (std::vector< ReadProcessedItem >) - Per-node read requests, taken by value so the delegate may retain them.
  • callback (ReadProcessedCallback) - Receives a BatchResult whose per-item Result holds the aggregated values or an ErrorDetail. This method never throws.
void read_annotations_async(const ReadContext &context, std::vector< ReadAnnotationItem > items, ReadAnnotationCallback callback) noexcept

Reads history annotations for a batch of nodes.

  • context (const ReadContext &) - Read context, including cancellation flag and timestamp preference.
  • items (std::vector< ReadAnnotationItem >) - Per-node read requests, taken by value so the delegate may retain them.
  • callback (ReadAnnotationCallback) - Receives a BatchResult whose per-item Result holds the annotation values or an ErrorDetail. This method never throws.
void read_events_async(const ReadContext &context, std::vector< ReadEventsItem > items, ReadEventsCallback callback) noexcept

Reads historical events for a batch of event-source nodes.

  • context (const ReadContext &) - Read context, including cancellation flag and timestamp preference.
  • items (std::vector< ReadEventsItem >) - Per-node read requests, taken by value so the delegate may retain them.
  • callback (ReadEventsCallback) - Receives a BatchResult whose per-item Result holds the matching events or an ErrorDetail. This method never throws.
void update_data_async(const UpdateContext &context, std::vector< UpdateDataItem > items, UpdateDataCallback callback) noexcept

Inserts or replaces historical values for a batch of nodes.

  • context (const UpdateContext &) - Update context, including the cancellation flag.
  • items (std::vector< UpdateDataItem >) - Per-node update requests, taken by value so the delegate may retain them.
  • callback (UpdateDataCallback) - Receives a BatchResult whose per-item Result holds the per-value status codes or an ErrorDetail. This method never throws.
void update_events_async(const UpdateContext &context, std::vector< UpdateEventsItem > items, UpdateEventsCallback callback) noexcept

Inserts, replaces, or updates historical events for a batch of event-source nodes.

  • context (const UpdateContext &) - Update context, including the cancellation flag.
  • items (std::vector< UpdateEventsItem >) - Per-node update requests, taken by value so the delegate may retain them.
  • callback (UpdateEventsCallback) - Receives a BatchResult whose per-item Result holds the per-event status codes or an ErrorDetail. This method never throws.
void update_structure_data_async(const UpdateContext &context, std::vector< UpdateStructureDataItem > items, UpdateStructureDataCallback callback) noexcept

Inserts, replaces, updates, or removes structured history (e.g.

  • context (const UpdateContext &) - Update context, including the cancellation flag.
  • items (std::vector< UpdateStructureDataItem >) - Per-node update requests, taken by value so the delegate may retain them.
  • callback (UpdateStructureDataCallback) - Receives a BatchResult whose per-item Result holds the per-entry status codes or an ErrorDetail. This method never throws.
void delete_raw_async(const UpdateContext &context, std::vector< DeleteRawItem > items, DeleteRawCallback callback) noexcept

Deletes raw or modified value history over a time range for a batch of nodes.

  • context (const UpdateContext &) - Update context, including the cancellation flag.
  • items (std::vector< DeleteRawItem >) - Per-node delete requests, taken by value so the delegate may retain them.
  • callback (DeleteRawCallback) - Receives a BatchResult whose per-item Result holds the outcome or an ErrorDetail. This method never throws.
void delete_at_time_async(const UpdateContext &context, std::vector< DeleteAtTimeItem > items, DeleteAtTimeCallback callback) noexcept

Deletes values at specific timestamps for a batch of nodes.

  • context (const UpdateContext &) - Update context, including the cancellation flag.
  • items (std::vector< DeleteAtTimeItem >) - Per-node delete requests, taken by value so the delegate may retain them.
  • callback (DeleteAtTimeCallback) - Receives a BatchResult whose per-item Result holds the outcome or an ErrorDetail. This method never throws.
void delete_events_async(const UpdateContext &context, std::vector< DeleteEventsItem > items, DeleteEventsCallback callback) noexcept

Deletes historical events for a batch of event-source nodes.

  • context (const UpdateContext &) - Update context, including the cancellation flag.
  • items (std::vector< DeleteEventsItem >) - Per-node delete requests, taken by value so the delegate may retain them.
  • callback (DeleteEventsCallback) - Receives a BatchResult whose per-item Result holds the outcome or an ErrorDetail. This method never throws.
void release_cursor(Cursor cursor) noexcept

Releases a continuation cursor the delegate previously issued.

  • cursor (Cursor) - The cursor to release; ownership transfers to this call.

ua::ReferenceQuery

struct

One Node whose References Namespace::read_references_async is asked for.

direction and referenceTypeHint are hints. The service filters every answer again by ReferenceType and subtypes, NodeClass mask and View, so a namespace that ignores both is correct. A namespace that applies referenceTypeHint may leave a Reference out only when it knows the Reference's type is neither a hinted type nor a subtype of one; when unsure it returns the Reference, because the service cannot restore what was never returned. For namespace-0 ReferenceTypes the SDK provides that test; a namespace cannot know subtypes defined in other namespaces, and a gateway that forwards the hint upstream with includeSubtypes meets the rule through its upstream server.

Lifetime. node refers to a Node the caller holds until the call completes; every other field is valid until the member returns.

Public attributes

const Node & node

The Node this namespace returned for nodeId, held by the caller until the call completes.

NodeId nodeId

The Node whose References are read.

BrowseDirection direction

The References wanted; a hint (see above).

std::vector< NodeId > referenceTypeHint

ReferenceTypes the caller will keep, with their subtypes; empty for all. A hint (see above).

uint32_t maxReferences

The most References to return in this answer; 0 for no limit.

ByteString resumeToken

Where to resume, from a previous answer's resumeToken; empty on the first call.

ua::NodeReferences

struct

One answer of Namespace::read_references_async: References the Node holds, and where to resume.

Each Reference names its type, its target and its direction only. The namespace does not fill in the target's Attributes; the services look targets up themselves.

Public attributes

References references

The References of this page.

ByteString resumeToken

Where the next call resumes; empty when there are no more References for this query.

ua::ReferenceChange

struct

One half of a Reference, held by a Node of the namespace it is sent to, for Namespace::add_references_async and Namespace::remove_references_async.

A Reference between two Nodes is two halves (OPC 10000-3: "A bidirectional Reference is modelled as two separate References"): the forward half on the source and the inverse half on the target. Each half is a separate change, sent to the namespace of the Node that holds it. both_halves builds the pair.

Static functions

std::array< ReferenceChange, 2 > both_halves(NodeId source, NodeId referenceType, NodeId target)

The two halves of one Reference: forward on source, inverse on target.

  • source (NodeId) - The Node holding the forward half.
  • referenceType (NodeId) - The ReferenceType.
  • target (NodeId) - The Node holding the inverse half; local, so that it can hold one.

Returns: {forward half on source, inverse half on target}.

Public attributes

NodeId source

The Node of this namespace that holds this half.

NodeId referenceType

The ReferenceType.

ExpandedNodeId target

The other end. May be in another namespace or another Server.

bool isForward

true for a forward half, false for an inverse one.

bool sourceCreated

The address space created source earlier in this same operation (a NodeSet import or an instantiation).

std::optional< LocalizedText > targetDisplayName

The DisplayName a target in another Server has, as its authority gives it; Browse returns it for that target (Reference::target_display_name).

ua::ValueReadItem

struct

One Value read by Namespace::read_values_async: the Variable's Node and what is read of it.

Lifetime. node refers to a Node the caller holds until the call completes; value is valid until the member returns, so a namespace that answers later copies what it needs from it first.

Public attributes

const Node & node

The Node this namespace returned for value's NodeId, held by the caller until the call completes: the service's lookup, the accessor's own Node, or the monitoring helper's registration.

const ReadValueId & value

The NodeId, the IndexRange to apply (OPC 10000-4 7.27) and the DataEncoding, which the service applies.

ua::ValueWriteItem

struct

One Value written by Namespace::write_async: the Node and the write.

Lifetime. node refers to a Node the caller holds until the call completes; value is valid until the member returns, so a namespace that applies the write later copies it first.

Public attributes

const Node & node

The Node this namespace returned for value's NodeId; checked before use as ValueReadItem::node says.

const WriteValue & value

The NodeId, the AttributeId, the IndexRange or OptionSet ValidBits to apply, and the DataValue.

ua::CallItem

struct

One Method call for Namespace::call_async.

The Call service asks the Object's namespace first and the Method's namespace for the items the first declines, so each namespace checks and uses only the Node that is its own: the Object's namespace object, the Method's namespace method.

Lifetime. object and method refer to Nodes the caller holds until the call completes; request is valid until the member returns, so a namespace that answers later copies it first; context is shared and may be kept by a handler that answers later.

Public attributes

const Node & object

The Object or ObjectType the Method is called on, as its namespace returned it.

const Node & method

The Method, as its namespace returned it; may be of a different namespace from object.

const CallMethodRequest & request

The objectId, methodId and input arguments.

shared_ptr< const MethodCallContext > context

The per-call context handed to the Method's handler; null for a call with no Session.

ua::NodeCreation

struct

One Node to create with Namespace::create_nodes_async.

Public attributes

NodeId nodeId

The new Node's NodeId; not yet held by this namespace.

NodeClass nodeClass

The new Node's NodeClass.

InitialAttributes attributes

The new Node's Attributes in wire form, as AddNodes carries them; may be empty for a bare Node.

ua::VersionedNode

struct

A Node a call changed whose NodeVersion that change advanced.

The output of the members that change structure or a versioned Attribute.

A Node is versioned when it has a HasProperty Reference to a Node of the same namespace whose BrowseName is 0:NodeVersion and that has no ModellingRule (an InstanceDeclaration does not count). A NodeVersion Property held in another namespace than its owner is not supported.

The namespace that changes a versioned Node advances its NodeVersion in the same call and reports the Node here; the address space then raises one GeneralModelChangeEvent for the operation (OPC 10000-3 9.32.6, OPC 10000-5 6.4.32), listing the reported Nodes. OPC 10000-3 9.32.2: every NodeVersion change raises a ModelChangeEvent, every ModelChangeEvent issued for a Node changes its NodeVersion, and only Nodes that have a NodeVersion trigger one. So the output lists only Nodes whose NodeVersion the call changed:

a View Node only when it gained or lost a Reference. A change of a View's content advances its ViewVersion, which the namespace does itself, and is never reported: the View Node's NodeVersion does not change for it (OPC 10000-3 5.4, Table 10); the one exception is a Node the address space created earlier in the same operation and that gains a half marked ReferenceChange::sourceCreated: it keeps the NodeVersion it was created with and is still reported, so that the event lists it as added.

Public attributes

NodeId node

The Node that changed.

NodeId affectedType

The Node's TypeDefinition when it is an Object or Variable, from the HasTypeDefinition the namespace holds (for a deleted Node, the TypeDefinition it had); otherwise null (OPC 10000-5 12.16, affectedType).

ua::ModelChangeReport

struct

One change a namespace made to its own Nodes outside the address space's routes, reported through NamespaceContext::model_changed (NR-36 rule 3, NR-55).

Report only Nodes whose NodeVersion the change advanced, after advancing it, as VersionedNode states: a ModelChangeEvent for a Node whose NodeVersion did not change breaks OPC 10000-3 9.32.2.

Member types

Kind (enum)

What changed.

  • NodeAdded - A verb of a GeneralModelChangeEvent (OPC 10000-5 12.16).
  • NodeDeleted - A verb of a GeneralModelChangeEvent.
  • ReferenceAdded - A verb of a GeneralModelChangeEvent, for the Node holding the half.
  • ReferenceDeleted - A verb of a GeneralModelChangeEvent, for the Node holding the half.
  • DataTypeChanged - A verb of a GeneralModelChangeEvent; Variables and VariableTypes only.
  • ValueRankChanged - No verb names it: the event is a BaseModelChangeEvent.
  • ArrayDimensionsChanged - No verb names it: the event is a BaseModelChangeEvent.
  • ViewContentChanged - The View's ViewVersion advanced; listed in no event (OPC 10000-3 5.4).

Public attributes

Kind kind

What changed.

NodeId affected

The Node that changed; for ViewContentChanged, the View.

NodeId affectedType

The Node's TypeDefinition when it is an Object or Variable (for NodeDeleted, the one it had); otherwise null.

ua::SemanticChangeReport

struct

One entry of a SemanticChangeEvent (OPC 10000-3 9.33.1, OPC 10000-5 12.17): a Property with the SemanticChange flag changed its Value, and this is the Node that owns it.

A namespace reports it through NamespaceContext::semantics_changed.

Public attributes

NodeId affected

The Node that owns the Property.

NodeId affectedType

Its TypeDefinition when it is an Object or Variable; otherwise null.

ua::RolePermissionsUpdate

struct

One proposed change of a Node's RolePermissions, for Namespace::validate_role_permissions_updates_async.

Public attributes

NodeId nodeId

The existing Node whose RolePermissions would change.

std::optional< std::vector< RolePermissionType > > proposed

The exact non-empty array the Write service would store, or nullopt for the OPC 10000-3 5.2.9 empty-array write that clears the Node's own RolePermissions so that the namespace's DefaultRolePermissions apply.

ua::MonitoringCreateItem

struct

Per-item input describing one node attribute to begin monitoring.

One element of the batch passed to Namespace::create_monitoring_async(). MonitoringCreateItemResult, MonitoringModifyItem

Public attributes

NodeId nodeId

Node whose attribute is sampled.

std::shared_ptr< Node > node

The Node this namespace returned for nodeId when CreateMonitoredItems looked it up for the same request, so the namespace need not look it up again; CreateMonitoredItems refuses an item whose lookup finds no Node, so its items always carry one.

AttributeId attributeId

Attribute of nodeId to monitor.

NumericRange indexRange

The monitored item's IndexRange (OPC 10000-4 7.27); empty for the whole value.

IntegerId monitoredItemId

Caller's identifier, echoed back to sink on delivery.

Duration samplingInterval

Requested sampling interval in milliseconds; 0 requests the fastest practical rate, subject to revision.

uint32_t queueSize

Maximum samples buffered before older values are overwritten.

std::shared_ptr< SampleSink > sink

Shared sink that receives sampled values; one per subscription.

ua::MonitoringCreateSuccess

struct

Successful per-item outcome of Namespace::create_monitoring_async().

MonitoringCreateItemResult

Public attributes

MonitoringHandle handle

Handle identifying the new registration; pass to delete_monitoring_async() / modify_monitoring_async().

Duration revisedSamplingInterval

Interval the namespace will actually sample at, in milliseconds; may differ from the requested value.

ua::MonitoringModifyItem

struct

Per-item input describing a change to an existing monitoring registration.

One element of the batch passed to Namespace::modify_monitoring_async(). MonitoringModifyItemResult, MonitoringCreateItem

Public attributes

MonitoringHandle handle

Handle of the registration to modify, from MonitoringCreateSuccess::handle.

Duration samplingInterval

New requested sampling interval in milliseconds; 0 requests the fastest practical rate, subject to revision.

uint32_t queueSize

New maximum number of buffered samples.

ua::MonitoringModifySuccess

struct

Successful per-item outcome of Namespace::modify_monitoring_async().

MonitoringModifyItemResult

Public attributes

Duration revisedSamplingInterval

Interval the namespace will actually sample at after the change, in milliseconds; may differ from requested.

ua::default_ns::NamespaceMonitoringSupport

class

The monitoring helper the SDK gives each namespace registration.

A namespace reaches it through context().monitoring(); the address space creates one per registration, runs its sampling on the address space's executor, and shuts it down before it shuts the namespaces down (AddressSpace::shutdown_async). A namespace neither creates nor shuts it.

The namespace puts in each item the Node it resolved for it (MonitoringCreateItem::node), decides how each item is fed - read by the helper at its interval (Delivery::Sampled) or told of each change by the namespace (Delivery::Reported) - and passes the items here. From then on the helper delivers to each item's sink: a Sampled item from what it reads at each tick, a Reported item from what attribute_changed reported since its last tick. At the first tick that finds an item's Node deleted (Node::deleted()), the item receives the changes reported before the deletion and not yet delivered, then Bad_NodeIdUnknown once, and nothing after it; it can still be modified and deleted (Part 4 5.12.1.6).

At each tick of an interval the helper reads the Sampled items on a Variable's Value through the registered namespace's Namespace::read_values_async: one call per distinct caller of the items' sinks (SampleSink::caller()), with the server's own RequestInfo (never cancelled, no deadline), maxAge 0 and the SourceTimestamp requested, each item carrying its registration's Node. The calls of one tick are started before any is awaited, and each is split by the address space's MaxNodesPerRead as it stands at the tick. The tick gives up its thread between calls, so a namespace that answers inline holds an executor thread for one call at a time, not across the tick's calls: one call runs as long as the namespace takes to answer it, and MaxNodesPerRead, when it is set, bounds its size. A Sampled item on any other attribute, or on a VariableType's Value, is read from the Node's description (Node::attributes()). A tick that finds the registered namespace gone delivers nothing.

Every value the helper delivers is narrowed to its registration's IndexRange (MonitoringCreateItem::indexRange), as a Read of that range answers, so that registrations with different ranges on one attribute each receive their own part. A Sampled read through Namespace::read_values_async carries the range, and the namespace narrows the Value; a value read from the description, and a value reported through attribute_changed, is narrowed by the helper before it is compared with the last value delivered, so a change outside the range is not delivered unless its status or timestamps changed too. A namespace reports whole values; it does not narrow them.

Before the namespace is registered, context().monitoring() answers a helper that refuses every create, modify and delete with Bad_NotSupported and the ErrorDetail NamespaceNotRegistered, and ignores attribute_changed and structure_changed. A namespace calls context().monitoring() each time rather than keeping the reference, so that it reaches its registration's helper once it has one.

Thread-safety: every member is synchronous and may be called from any thread. No member but structure_changed calls a sink; sinks are called from the helper's ticks and from structure_changed, with no lock of the helper held.

Member types

Delivery (enum)

How an item is fed.

  • Sampled - The helper reads the item's attribute at each tick of the item's interval and delivers a changed value.
  • Reported - The namespace reports each change through attribute_changed; the helper delivers it at the item's next tick.

Functions

Stops the helper's sampling if the address space has not already shut it down.

std::vector< CreateResult > create_monitoring(std::span< const ResolvedMonitoringItem > items)

Creates one registration per item.

Returns: One result per item, in order: Good with the handle and revised interval; Bad_NodeIdUnknown (ErrorDetail NodeIdUnknown) for an item with no Node; Bad_IndexRangeInvalid for an item whose indexRange is not a NumericRange; Bad_NotSupported (NamespaceNotRegistered) before registration, for every item; or Bad_Shutdown (MonitoringShutDown) once the address space has shut the helper down.

std::vector< ModifyResult > modify_monitoring(std::span< const ResolvedMonitoringModifyItem > items)

Changes each registration's interval, queue size and delivery, revising the interval as create_monitoring does.

Returns: One result per item, in order: Good with the revised interval; Bad_MonitoredItemIdInvalid for an unknown handle; Bad_NotSupported (NamespaceNotRegistered) before registration; Bad_Shutdown (MonitoringShutDown) once shut down.

std::vector< VoidResult > delete_monitoring(std::span< const MonitoringHandle > handles)

Deletes registrations; nothing is delivered to them afterwards.

Returns: One result per handle, in order: Good; Bad_MonitoredItemIdInvalid for an unknown handle, or one deleted already; Bad_NotSupported (NamespaceNotRegistered) before registration.

void attribute_changed(const NodeId &node, AttributeId attribute, const DataValue &value)

Reports that attribute of the Node node now holds value.

  • node (const NodeId &) - The NodeId of the Node that changed.
  • attribute (AttributeId) - The attribute that changed.
  • value (const DataValue &) - The attribute's new value, as a Read of it returns it.
void structure_changed(const NodeId &variable)

Reports that the structure of the Value of the Variable variable changed: the DataTypeEncoding its Value is serialized with, as when its DataType changes (OPC 10000-4 7.39.1 Table 180).

  • variable (const NodeId &) - The NodeId of the Variable whose Value's structure changed.
bool property_value_changed(const NodeId &owner, const Node &property, bool initial)

Reports that the Value of the Property property, which belongs to the Node owner, changed, by any path (NR-37, NR-38).

  • owner (const NodeId &) - The NodeId of the Node that owns the Property, the source of its HasProperty Reference.
  • property (const Node &) - The Property.
  • initial (bool) - Whether the change gave the Property its first Value (NR-38 rule 1).

Returns: True when a SemanticChangeEvent is due: the Property has the SemanticChange flag of AccessLevelEx (OPC 10000-3 5.6.2) and initial is false. The namespace then reports owner through NamespaceContext::semantics_changed. The answer does not depend on registrations, so it is the same before registration and after shutdown, when nothing is marked.

ua::NamespaceRegisterNodesDelegate

class

Optional capability hook for namespaces that implement RegisterNodes/UnregisterNodes.

A namespace inherits from this interface to take over RegisterNodes and UnregisterNodes for its own nodes - for example to allocate optimized, session-scoped NodeId aliases that make repeated access to externally-backed nodes cheaper. Namespaces that do not provide a delegate get the default behaviour: RegisterNodes echoes back the requested NodeIds unchanged, and UnregisterNodes is a no-op.

Implementations must be safe to call from the server's worker threads; the SDK does not serialize delegate calls onto any particular strand.

Member types

std::function< void(BatchResult< NodeId >)> RegisterCompleteCallback

Callback delivering the per-item RegisterNodes outcomes for an entire batch.

std::function< void(VoidResult)> UnregisterCompleteCallback

Callback signalling completion of an UnregisterNodes batch.

Functions

~NamespaceRegisterNodesDelegate()=default
void register_nodes_async(const Context &context, std::vector< Item > items, RegisterCompleteCallback callback) noexcept=0

Registers the given nodes and delivers the resulting NodeIds asynchronously.

  • context (const Context &) - Request-wide inputs for the batch; valid only for the duration of the call.
  • items (std::vector< Item >) - Nodes to register, taken by value so the delegate may retain them.
  • callback (RegisterCompleteCallback) - Receives the BatchResult; invoked exactly once.
void unregister_nodes_async(const Context &context, std::vector< Item > items, UnregisterCompleteCallback callback) noexcept=0

Releases registrations previously created by register_nodes_async.

  • context (const Context &) - Request-wide inputs for the batch; valid only for the duration of the call.
  • items (std::vector< Item >) - Nodes to unregister, taken by value so the delegate may retain them.
  • callback (UnregisterCompleteCallback) - Receives the VoidResult; invoked exactly once.

ua::MethodCallContext

struct

Per-call session context threaded through to method handlers.

Populated by the Call service from the active session and passed by shared ownership to the namespace's call_async (CallItem::context), so a handler that completes asynchronously may retain it past the call's synchronous portion. A null shared_ptr<const MethodCallContext> indicates no session context is available - e.g. direct calls from tests or internal SDK operations; handlers that require session state must fail closed in that case.

Public attributes

String clientUserId

Authenticated user identity of the calling session (the ClientUserId reported in condition events).

NodeId sessionId

NodeId of the calling session, used for cross-session validation (e.g. ConditionRefresh).

MessageSecurityMode channelSecurityMode

Security mode of the secure channel over which the call was made.

std::vector< LocaleId > sessionLocales

Locale preference list supplied by the session at ActivateSession.

ua::ExternalValueSource

class

Optional capability interface for Variable nodes whose Value an application can own.

A namespace implementation whose Variable nodes accept a ValueSource inherits from this interface and overrides Node::external_value_source() to return this. Implementations that do not (e.g. proxies to remote servers) do not inherit it; callers detect support via Node::external_value_source(), which returns nullptr when unsupported.

Functions

ExternalValueSource()=default
~ExternalValueSource()=default
VoidResult set_value_source(std::shared_ptr< ValueSource > source)=0

Makes source the owner of the Variable's Value, replacing any attached one; null detaches it.

Returns: Success, or an ErrorDetail when the node refuses the source. Never throws.

void notify_value_changed(DataValue newValue)=0

Signals that the externally-managed value has changed.

  • newValue (DataValue) - The updated value to publish to subscribers.

ua::MethodCallSource

class

Optional capability interface for Method nodes that support runtime call-handler registration.

A namespace implementation whose Method nodes accept programmatic handler installation inherits from this interface and overrides Node::method_call_source() to return this. Implementations that do not support handler registration (e.g. proxies to remote servers) do not inherit it; callers detect support via Node::method_call_source(), which returns nullptr when unsupported.

Member types

std::function< void(const CallMethodRequest &methodToCall, shared_ptr< const MethodCallContext > context, std::function< void(CallResult)> callback)> CallHandler

Handler invoked to execute a method call.

Functions

MethodCallSource()=default
~MethodCallSource()=default
StatusCode set_call_handler(CallHandler handler)=0

Installs the handler invoked when the method is called.

  • handler (CallHandler) - Invoked for each call; ownership is transferred to the node.

Returns: Good, or a bad StatusCode when the source rejects registration.

ua::Node

class

A Node a namespace hands out: its current non-Value Attributes, whether it has been deleted, and the two optional capability probes.

Every other operation on a Node - References, Values, attribute writes, Method calls, Views - is a member of the namespace that owns it (Namespace), reached through the address space by the services and by NodeAccessor. A namespace that does not write its own Node class hands out the Nodes of a DescribedNodes store. Instances are held by std::shared_ptr.

Functions

Node()=default
~Node()=default
NodeDescription attributes() const =0

The Node's current non-Value Attributes.

Returns: The description.

bool deleted() const noexcept

True once this Node's namespace has deleted it.

Returns: true once the Node has been deleted.

ExternalValueSource * external_value_source() noexcept

Returns this node's external value-source capability, or nullptr when unsupported.

Returns: The ExternalValueSource interface, or nullptr if the implementation does not support runtime value-handler registration.

MethodCallSource * method_call_source() noexcept

Returns this node's method call-source capability, or nullptr when unsupported.

Returns: The MethodCallSource interface, or nullptr if the implementation does not support runtime call-handler registration.

ua::NodeAccessor

class

A typed handle over a single address-space Node.

Wraps a shared owning pointer to the underlying node and exposes its base attributes (NodeId, NodeClass, BrowseName, DisplayName, Description, WriteMask, RolePermissions, AccessRestrictions) plus its reference graph. Derived accessors (VariableAccessor, ObjectAccessor, ...) add the attributes and operations specific to each NodeClass; downcast to one with as.

The attribute getters read the held node on the calling thread. Every other operation (References, Reference changes, Value reads and writes, attribute writes and the setters, Method calls, Views) is a one-item call, through the address space that handed the accessor out, to the batched member of the namespace that owns the node: the route the services take. An operation whose address space no longer exists, or of an accessor built from a node alone, answers Bad_Shutdown. The operations follow the callback-canonical async pattern and are also offered as blocking sync and try*_sync convenience wrappers (external consumers only - never call the blocking variants from inside the SDK).

The blocking wrappers, and the setters, which wait for their write, refuse on a thread of the address space's executor before they start the operation: a try_*_sync form returns Bad_WouldBlock, and a _sync form or a setter throws UaException carrying it. Code that runs on that executor (a Method handler, a value source, the completion of an *_async operation) uses the *_async forms. An accessor without an address space has no executor to refuse on; its operations answer Bad_Shutdown.

Copyable and movable (value-handle semantics): copies share ownership of the same underlying node and refer to the same address space.

Member types

Result< References > ReferencesResult

Result holding a node's full Reference set.

std::function< void(ReferencesResult)> GetReferencesCallback

Completion of get_references_async; carries the References or an ErrorDetail.

Result< ReferencePage > ReferencesPageResult

Result holding a single ReferencePage.

std::function< void(ReferencesPageResult)> GetReferencesPageCallback

Completion of the paged get_references_async; carries a page or an ErrorDetail.

std::function< void(VoidResult)> ReferenceModifyCallback

Completion of a Reference add or remove; signals success or an ErrorDetail.

std::function< void(VoidResult)> WriteAttributeCompleteCallback

Completion of write_attribute_async; signals success or an ErrorDetail.

std::function< void(DataValueResult)> ReadValueCompleteCallback

Completion of a Value read; carries the value or an ErrorDetail.

std::function< void(VoidResult)> WriteValueCompleteCallback

Completion of a Value write; signals success or an ErrorDetail.

std::function< void(BoolResult)> IsNodeInViewCallback

Completion of a View membership test; carries the answer or an ErrorDetail.

std::function< void(VoidResult)> ViewModifyCallback

Completion of an addition to a View; signals success or an ErrorDetail.

Functions

NodeAccessor(const NodeAccessor &)=default

Copies the handle, sharing ownership of the same underlying node.

NodeAccessor(NodeAccessor &&) noexcept=default

Moves the handle; the source is left wrapping no node.

NodeAccessor & operator=(const NodeAccessor &)=default

Rebinds this handle to share ownership of other's node.

Returns: A reference to this handle.

NodeAccessor & operator=(NodeAccessor &&) noexcept=default

Rebinds this handle to other's node; other is left wrapping no node.

Returns: A reference to this handle.

~NodeAccessor()=default
Node * operator->() const

Accesses the underlying node's members.

Returns: A non-owning pointer to the wrapped node; never null.

Node & operator*() const

Accesses the underlying node by reference.

Returns: A reference to the wrapped node.

optional< T > as() const

Attempts to view this node through a more specific accessor type.

Returns: The typed accessor, or std::nullopt if the node's class does not match T.

void get_references_async(GetReferencesCallback callback) const noexcept

Retrieves all of the node's references.

  • callback (GetReferencesCallback) - Receives the outcome: the References with the code the namespace answered the pages with, combined by detail::combined_status (a Good subcode, or an Uncertain code with the References it held, is kept); a page answered without References gives its status and ErrorDetail. This overload never throws.
References get_references_sync() const

Retrieves all of the node's references, blocking until complete.

Returns: The node's references.

Result< References > try_get_references_sync() const noexcept

Retrieves all of the node's references, blocking until complete.

Returns: The node's references, or an ErrorDetail on failure. Never throws.

void get_references_async(uint32_t maxReferences, ByteString continuationToken, GetReferencesPageCallback callback) const noexcept

Retrieves a page of the node's references, supporting continuation.

  • maxReferences (uint32_t) - Maximum number of references to return in this page; 0 means no per-page limit.
  • continuationToken (ByteString) - Token from a prior page's result, or empty to start from the first page.
  • callback (GetReferencesPageCallback) - Receives the outcome: on success the Result holds a ReferencePage (whose continuation token is empty when no further pages remain); on failure it carries an ErrorDetail. This overload never throws.
ReferencePage get_references_sync(uint32_t maxReferences, ByteString continuationToken) const

Retrieves a page of the node's references, blocking until complete.

  • maxReferences (uint32_t) - Maximum number of references in this page; 0 = no limit.
  • continuationToken (ByteString) - Token from a prior page, or empty to start.

Returns: The reference page.

ReferencesPageResult try_get_references_sync(uint32_t maxReferences, ByteString continuationToken) const noexcept

Retrieves a page of the node's references, blocking until complete.

  • maxReferences (uint32_t) - Maximum number of references in this page; 0 = no limit.
  • continuationToken (ByteString) - Token from a prior page, or empty to start.

Returns: The reference page, or an ErrorDetail on failure. Never throws.

void get_components_async(GetReferencesCallback callback) const noexcept

Retrieves the node's HasComponent-referenced child nodes.

  • callback (GetReferencesCallback) - Receives the outcome: the component References with the code of the References read as get_references_async gives it; on failure it carries an ErrorDetail. This overload never throws.
References get_components_sync() const

Retrieves the node's components, blocking until complete.

Returns: The component references.

Result< References > try_get_components_sync() const noexcept

Retrieves the node's components, blocking until complete.

Returns: The component references, or an ErrorDetail on failure. Never throws.

void get_properties_async(GetReferencesCallback callback) const noexcept

Retrieves the node's HasProperty-referenced property nodes.

  • callback (GetReferencesCallback) - Receives the outcome: the property References with the code of the References read as get_references_async gives it; on failure it carries an ErrorDetail. This overload never throws.
References get_properties_sync() const

Retrieves the node's properties, blocking until complete.

Returns: The property references.

Result< References > try_get_properties_sync() const noexcept

Retrieves the node's properties, blocking until complete.

Returns: The property references, or an ErrorDetail on failure. Never throws.

void add_reference_async(NodeId type, ExpandedNodeId target, bool isForward, ReferenceHalves halves, ReferenceModifyCallback callback) noexcept

Adds a reference of type type from this node to target.

  • type (NodeId) - ReferenceType of the new reference.
  • target (ExpandedNodeId) - The reference's target node, possibly in another namespace/server.
  • isForward (bool) - true to add a forward reference, false for an inverse one.
  • halves (ReferenceHalves) - ReferenceHalves::Both to have the address space add the other half as described, ReferenceHalves::ThisHalfOnly to add this node's half alone.
  • callback (ReferenceModifyCallback) - Receives a VoidResult: the code the namespaces answered the change with (several answers combined by detail::combined_status, so a Good subcode is kept); on failure it carries an ErrorDetail. This overload never throws.
void add_reference_sync(const NodeId &type, const ExpandedNodeId &target, bool isForward=true, ReferenceHalves halves=ReferenceHalves::Both)

Adds a reference from this node to target, blocking until complete.

  • type (const NodeId &) - ReferenceType of the new reference.
  • target (const ExpandedNodeId &) - The reference's target node, possibly in another namespace/server.
  • isForward (bool) - true for a forward reference, false for an inverse one.
  • halves (ReferenceHalves) - Which halves of the Reference change; see add_reference_async.
VoidResult try_add_reference_sync(const NodeId &type, const ExpandedNodeId &target, bool isForward=true, ReferenceHalves halves=ReferenceHalves::Both) noexcept

Adds a reference from this node to target, blocking until complete.

  • type (const NodeId &) - ReferenceType of the new reference.
  • target (const ExpandedNodeId &) - The reference's target node, possibly in another namespace/server.
  • isForward (bool) - true for a forward reference, false for an inverse one.
  • halves (ReferenceHalves) - Which halves of the Reference change; see add_reference_async.

Returns: A VoidResult that carries an ErrorDetail on failure. Never throws.

void add_reference_sync(const NodeId &type, const NodeId &target, bool isForward=true, ReferenceHalves halves=ReferenceHalves::Both)

Adds a reference from this node to a local target, blocking until complete.

  • type (const NodeId &) - ReferenceType of the new reference.
  • target (const NodeId &) - The reference's local target node.
  • isForward (bool) - true for a forward reference, false for an inverse one.
  • halves (ReferenceHalves) - Which halves of the Reference change; see add_reference_async.
VoidResult try_add_reference_sync(const NodeId &type, const NodeId &target, bool isForward=true, ReferenceHalves halves=ReferenceHalves::Both) noexcept

Adds a reference from this node to a local target, blocking until complete.

  • type (const NodeId &) - ReferenceType of the new reference.
  • target (const NodeId &) - The reference's local target node.
  • isForward (bool) - true for a forward reference, false for an inverse one.
  • halves (ReferenceHalves) - Which halves of the Reference change; see add_reference_async.

Returns: A VoidResult that carries an ErrorDetail on failure. Never throws.

void add_reference_async(const Reference &reference, ReferenceHalves halves, ReferenceModifyCallback callback) noexcept

Adds a fully specified reference originating from this node, with its other half as halves says (see the type and target form).

  • reference (const Reference &) - The reference (type, target, direction) to add.
  • halves (ReferenceHalves) - Which halves of the Reference are added; see the type and target form.
  • callback (ReferenceModifyCallback) - Receives a VoidResult: the code the namespaces answered the change with (several answers combined by detail::combined_status, so a Good subcode is kept); on failure it carries an ErrorDetail. This overload never throws.
void add_reference_sync(const Reference &reference, ReferenceHalves halves=ReferenceHalves::Both)

Adds a fully specified reference, blocking until complete.

  • reference (const Reference &) - The reference (type, target, direction) to add.
  • halves (ReferenceHalves) - Which halves of the Reference change; see add_reference_async.
VoidResult try_add_reference_sync(const Reference &reference, ReferenceHalves halves=ReferenceHalves::Both) noexcept

Adds a fully specified reference, blocking until complete.

  • reference (const Reference &) - The reference (type, target, direction) to add.
  • halves (ReferenceHalves) - Which halves of the Reference change; see add_reference_async.

Returns: A VoidResult that carries an ErrorDetail on failure. Never throws.

void add_references_async(std::vector< Reference > references, ReferenceHalves halves, ReferenceModifyCallback callback) noexcept

Adds multiple references originating from this node in one call to the owning namespace.

  • references (std::vector< Reference >) - The references to add.
  • halves (ReferenceHalves) - Which halves of each Reference are added; see add_reference_async.
  • callback (ReferenceModifyCallback) - Receives a VoidResult: the code the namespaces answered the change with (several answers combined by detail::combined_status, so a Good subcode is kept); on failure it carries an ErrorDetail. This overload never throws.
void add_references_sync(std::vector< Reference > references, ReferenceHalves halves=ReferenceHalves::Both)

Adds multiple references, blocking until complete.

VoidResult try_add_references_sync(std::vector< Reference > references, ReferenceHalves halves=ReferenceHalves::Both) noexcept

Adds multiple references, blocking until complete.

Returns: A VoidResult that carries an ErrorDetail on failure. Never throws.

void add_reference_if_not_present_async(NodeId type, NodeId target, bool isForward, ReferenceHalves halves, ReferenceModifyCallback callback) noexcept

Adds a reference only if the Node does not already hold it.

  • type (NodeId) - ReferenceType of the reference to add if absent.
  • target (NodeId) - The reference's local target node.
  • isForward (bool) - true for a forward reference, false for an inverse one.
  • halves (ReferenceHalves) - Which halves of the Reference are added; see add_reference_async.
  • callback (ReferenceModifyCallback) - Receives a VoidResult: plain Good when the reference is present, the add's own answer (its code whatever it is) when it was added, as the sync form answers. The read of the Node's References decides whether to add, so an Uncertain read is answered Bad_InternalError (ReferencesAnswerUncertain) with the Uncertain code as its cause. This overload never throws.
void add_references_if_not_present_async(std::vector< Reference > references, ReferenceHalves halves, ReferenceModifyCallback callback) noexcept

Adds multiple references in one operation, skipping any that already exist.

  • references (std::vector< Reference >) - The references to add if absent.
  • halves (ReferenceHalves) - Which halves of each Reference are added; see add_reference_async.
  • callback (ReferenceModifyCallback) - Receives a VoidResult: plain Good when every reference is present, the add's own answer (its code whatever it is) otherwise. An Uncertain read of the Node's References is answered Bad_InternalError (ReferencesAnswerUncertain) with the Uncertain code as its cause. This overload never throws.
void add_reference_if_not_present_sync(const NodeId &type, const NodeId &target, bool isForward=true, ReferenceHalves halves=ReferenceHalves::Both)

Adds a reference if absent, blocking until complete.

  • type (const NodeId &) - ReferenceType of the reference to add if absent.
  • target (const NodeId &) - The reference's local target node.
  • isForward (bool) - true for a forward reference, false for an inverse one.
  • halves (ReferenceHalves) - Which halves of the Reference change; see add_reference_async.
VoidResult try_add_reference_if_not_present_sync(const NodeId &type, const NodeId &target, bool isForward=true, ReferenceHalves halves=ReferenceHalves::Both) noexcept

Adds a reference if absent, blocking until complete.

  • type (const NodeId &) - ReferenceType of the reference to add if absent.
  • target (const NodeId &) - The reference's local target node.
  • isForward (bool) - true for a forward reference, false for an inverse one.
  • halves (ReferenceHalves) - Which halves of the Reference change; see add_reference_async.

Returns: A VoidResult that carries an ErrorDetail on failure. Never throws.

void remove_reference_async(NodeId type, ExpandedNodeId target, bool isForward, ReferenceHalves halves, ReferenceModifyCallback callback) noexcept

Removes the reference of type type from this node to target.

  • type (NodeId) - ReferenceType of the reference to remove.
  • target (ExpandedNodeId) - The reference's target node, possibly in another namespace/server.
  • isForward (bool) - true to remove a forward reference, false for an inverse one.
  • halves (ReferenceHalves) - ReferenceHalves::Both to remove the other half too, ReferenceHalves::ThisHalfOnly to remove this node's half alone.
  • callback (ReferenceModifyCallback) - Receives a VoidResult; on failure it carries an ErrorDetail. A Reference the node does not hold is not a failure: Uncertain_ReferenceNotDeleted or Good (see Namespace::remove_references_async). This overload never throws.
void remove_reference_sync(const NodeId &type, const ExpandedNodeId &target, bool isForward=true, ReferenceHalves halves=ReferenceHalves::Both)

Removes a reference from this node to target, blocking until complete.

  • type (const NodeId &) - ReferenceType of the reference to remove.
  • target (const ExpandedNodeId &) - The reference's target node, possibly in another namespace/server.
  • isForward (bool) - true for a forward reference, false for an inverse one.
  • halves (ReferenceHalves) - Which halves of the Reference change; see remove_reference_async.
VoidResult try_remove_reference_sync(const NodeId &type, const ExpandedNodeId &target, bool isForward=true, ReferenceHalves halves=ReferenceHalves::Both) noexcept

Removes a reference from this node to target, blocking until complete.

  • type (const NodeId &) - ReferenceType of the reference to remove.
  • target (const ExpandedNodeId &) - The reference's target node, possibly in another namespace/server.
  • isForward (bool) - true for a forward reference, false for an inverse one.
  • halves (ReferenceHalves) - Which halves of the Reference change; see remove_reference_async.

Returns: A VoidResult that carries an ErrorDetail on failure. Never throws.

void remove_reference_sync(const NodeId &type, const NodeId &target, bool isForward=true, ReferenceHalves halves=ReferenceHalves::Both)

Removes a reference from this node to a local target, blocking until complete.

  • type (const NodeId &) - ReferenceType of the reference to remove.
  • target (const NodeId &) - The reference's local target node.
  • isForward (bool) - true for a forward reference, false for an inverse one.
  • halves (ReferenceHalves) - Which halves of the Reference change; see remove_reference_async.
VoidResult try_remove_reference_sync(const NodeId &type, const NodeId &target, bool isForward=true, ReferenceHalves halves=ReferenceHalves::Both) noexcept

Removes a reference from this node to a local target, blocking until complete.

  • type (const NodeId &) - ReferenceType of the reference to remove.
  • target (const NodeId &) - The reference's local target node.
  • isForward (bool) - true for a forward reference, false for an inverse one.
  • halves (ReferenceHalves) - Which halves of the Reference change; see remove_reference_async.

Returns: A VoidResult that carries an ErrorDetail on failure. Never throws.

void remove_reference_async(const Reference &reference, ReferenceHalves halves, ReferenceModifyCallback callback) noexcept

Removes a fully specified reference originating from this node, with its other half as halves says (see the type and target form).

  • reference (const Reference &) - The reference (type, target, direction) to remove.
  • halves (ReferenceHalves) - Which halves of the Reference are removed; see the type and target form.
  • callback (ReferenceModifyCallback) - Receives a VoidResult: the code the namespaces answered the change with (several answers combined by detail::combined_status, so a Good subcode is kept); on failure it carries an ErrorDetail. This overload never throws.
void remove_reference_sync(const Reference &reference, ReferenceHalves halves=ReferenceHalves::Both)

Removes a fully specified reference, blocking until complete.

  • reference (const Reference &) - The reference (type, target, direction) to remove.
  • halves (ReferenceHalves) - Which halves of the Reference change; see remove_reference_async.
VoidResult try_remove_reference_sync(const Reference &reference, ReferenceHalves halves=ReferenceHalves::Both) noexcept

Removes a fully specified reference, blocking until complete.

  • reference (const Reference &) - The reference (type, target, direction) to remove.
  • halves (ReferenceHalves) - Which halves of the Reference change; see remove_reference_async.

Returns: A VoidResult that carries an ErrorDetail on failure. Never throws.

void remove_references_async(std::vector< Reference > references, ReferenceHalves halves, ReferenceModifyCallback callback) noexcept

Removes multiple references originating from this node in one call to the owning namespace.

  • references (std::vector< Reference >) - The references to remove.
  • halves (ReferenceHalves) - Which halves of each Reference are removed; see remove_reference_async.
  • callback (ReferenceModifyCallback) - Receives a VoidResult: the code the namespaces answered the change with (several answers combined by detail::combined_status, so a Good subcode is kept); on failure it carries an ErrorDetail. This overload never throws.
void remove_references_sync(std::vector< Reference > references, ReferenceHalves halves=ReferenceHalves::Both)

Removes multiple references, blocking until complete.

VoidResult try_remove_references_sync(std::vector< Reference > references, ReferenceHalves halves=ReferenceHalves::Both) noexcept

Removes multiple references, blocking until complete.

Returns: A VoidResult that carries an ErrorDetail on failure. Never throws.

bool is_object() const

Returns true if the node's class is Object.

Returns: true if the node's class is Object.

bool is_object_type() const

Returns true if the node's class is ObjectType.

Returns: true if the node's class is ObjectType.

bool is_data_type() const

Returns true if the node's class is DataType.

Returns: true if the node's class is DataType.

bool is_variable() const

Returns true if the node's class is Variable.

Returns: true if the node's class is Variable.

bool is_variable_type() const

Returns true if the node's class is VariableType.

Returns: true if the node's class is VariableType.

bool is_reference_type() const

Returns true if the node's class is ReferenceType.

Returns: true if the node's class is ReferenceType.

bool is_view() const

Returns true if the node's class is View.

Returns: true if the node's class is View.

bool is_method() const

Returns true if the node's class is Method.

Returns: true if the node's class is Method.

bool is_type() const

Returns true if the node is a type node (DataType, ObjectType, VariableType or ReferenceType).

Returns: true if the node is a DataType, ObjectType, VariableType or ReferenceType.

NodeId get_node_id() const

Returns the node's NodeId.

Returns: The node's NodeId.

NodeClass get_node_class() const

Returns the node's NodeClass.

Returns: The node's NodeClass.

QualifiedName get_browse_name() const

Returns the node's BrowseName, or an empty QualifiedName when the node carries none.

Returns: The node's BrowseName, or an empty QualifiedName when the attribute is absent.

optional< AttributeWriteMask > get_write_mask() const

Returns the node's WriteMask, or std::nullopt if the attribute is not set.

Returns: The node's WriteMask, or std::nullopt when the attribute is not set.

optional< std::vector< RolePermissionType > > get_role_permissions() const

Returns the node's RolePermissions, or std::nullopt if the attribute is not set.

Returns: The node's RolePermissions, or std::nullopt when the attribute is not set.

optional< AccessRestrictionType > get_access_restrictions() const

Returns the node's AccessRestrictions, or std::nullopt if the attribute is not set.

Returns: The node's AccessRestrictions, or std::nullopt when the attribute is not set.

Variant read_attribute(AttributeId attributeId) const

Reads an attribute of the node's description (Node::attributes()) in its OPC UA wire form.

  • attributeId (AttributeId) - Attribute to read.

Returns: The attribute value in wire form, or an empty Variant for an attribute the node does not carry or its NodeClass does not define (a Variable's Value among them).

void write_attribute_async(AttributeId attributeId, Variant attributeValue, std::function< void(VoidResult)> callback) noexcept

Writes an attribute in its OPC UA wire form.

  • attributeId (AttributeId) - Attribute to write.
  • attributeValue (Variant) - New value in wire form, as the setters build it; consumed by the call.
  • callback (std::function< void(VoidResult)>) - Receives the outcome; a bad StatusCode carries any ErrorDetail. The callback runs on an unspecified thread - do not block it.
void write_attribute_sync(AttributeId attributeId, Variant attributeValue)

Writes an attribute in its OPC UA wire form, blocking until complete.

  • attributeId (AttributeId) - Attribute to write.
  • attributeValue (Variant) - New value in wire form; consumed by the call.
VoidResult try_write_attribute_sync(AttributeId attributeId, Variant attributeValue) noexcept

Writes an attribute in its OPC UA wire form, blocking until complete (non-throwing).

  • attributeId (AttributeId) - Attribute to write.
  • attributeValue (Variant) - New value in wire form; consumed by the call.

Returns: The write outcome; a bad StatusCode (carrying any ErrorDetail) on failure.

void set_browse_name(QualifiedName browseName)

Sets the node's BrowseName.

void set_display_name(LocalizedText displayName)

Sets the node's DisplayName.

void set_description(LocalizedText description)

Sets the node's Description.

void set_write_mask(optional< AttributeWriteMask > writeMask)

Sets (or clears, with std::nullopt) the node's WriteMask.

  • writeMask (optional< AttributeWriteMask >) - The WriteMask to set, or std::nullopt to clear the attribute.
void set_role_permissions(optional< std::vector< RolePermissionType > > rolePermissions)

Sets (or clears, with std::nullopt) the node's RolePermissions.

  • rolePermissions (optional< std::vector< RolePermissionType > >) - The RolePermissions to set, or std::nullopt to clear the attribute.
void set_access_restrictions(optional< AccessRestrictionType > accessRestrictions)

Sets (or clears, with std::nullopt) the node's AccessRestrictions.

  • accessRestrictions (optional< AccessRestrictionType >) - The AccessRestrictions to set, or std::nullopt to clear the attribute.
bool is_matching_class() const

Returns true if the wrapped node's class matches this accessor type.

Returns: true for NodeAccessor; the derived contract narrows it.

ua::VariableAccessor

class

Accessor for Variable nodes.

A Variable's value is dynamic and possibly externally sourced; it is never a stored attribute. The value is accessed only through the async read_value / write_value family below (each carrying a full DataValue - value, status and timestamps). There is intentionally no get_value() / set_value() here - contrast VariableTypeAccessor, which stores a static default Value.

Functions

bool is_matching_class() const

Returns true if the wrapped node's class is Variable.

Returns: true if the wrapped node's class is Variable.

NodeId get_data_type() const

Returns the variable's DataType NodeId.

Returns: The variable's DataType NodeId.

ValueRank get_value_rank() const

Returns the variable's ValueRank.

Returns: The variable's ValueRank.

optional< std::vector< uint32_t > > get_array_dimensions() const

Returns the variable's ArrayDimensions, or std::nullopt if the attribute is not set.

Returns: The variable's ArrayDimensions, or std::nullopt when the attribute is not set.

void set_data_type(NodeId dataType)

Sets the variable's DataType.

  • dataType (NodeId) - The DataType NodeId to set.
void set_value_rank(ValueRank valueRank)

Sets the variable's ValueRank.

  • valueRank (ValueRank) - The ValueRank to set.
void set_array_dimensions(optional< std::vector< uint32_t > > arrayDimensions)

Sets (or clears, with std::nullopt) the variable's ArrayDimensions.

  • arrayDimensions (optional< std::vector< uint32_t > >) - The ArrayDimensions to set, or std::nullopt to clear the attribute.
AccessLevelType get_access_level() const

Returns the variable's AccessLevel.

Returns: The variable's AccessLevel.

bool get_historizing() const

Returns the variable's Historizing flag.

Returns: The variable's Historizing flag.

optional< Duration > get_minimum_sampling_interval() const

Returns the variable's MinimumSamplingInterval in milliseconds, or std::nullopt if the attribute is not set.

Returns: The MinimumSamplingInterval in milliseconds, or std::nullopt when the attribute is not set.

optional< AccessLevelExType > get_access_level_ex() const

Returns the variable's AccessLevelEx, or std::nullopt if the attribute is not set.

Returns: The variable's AccessLevelEx, or std::nullopt when the attribute is not set.

void set_access_level(const AccessLevelType &accessLevel)

Sets the variable's AccessLevel.

  • accessLevel (const AccessLevelType &) - The AccessLevel to set.
void set_historizing(bool historizing)

Sets the variable's Historizing flag.

  • historizing (bool) - The Historizing flag to set.
void set_minimum_sampling_interval(optional< Duration > minimumSamplingInterval)

Sets (or clears, with std::nullopt) the variable's MinimumSamplingInterval (milliseconds).

  • minimumSamplingInterval (optional< Duration >) - The MinimumSamplingInterval in milliseconds, or std::nullopt to clear the attribute.
void set_access_level_ex(optional< AccessLevelExType > accessLevelEx)

Sets (or clears, with std::nullopt) the variable's AccessLevelEx.

  • accessLevelEx (optional< AccessLevelExType >) - The AccessLevelEx to set, or std::nullopt to clear the attribute.
void read_value_async(Duration maxAge, bool setSourceTimestamp, const ReadValueId &nodeToRead, const CallerInfo *caller, ReadValueCompleteCallback callback) const noexcept

Reads the variable's Value attribute.

  • maxAge (Duration) - Maximum acceptable age of a cached value, in milliseconds; 0 requests the freshest value.
  • setSourceTimestamp (bool) - true to request the source timestamp be populated.
  • nodeToRead (const ReadValueId &) - Identifies the attribute and index range to read; a null NodeId names this Variable.
  • caller (const CallerInfo *) - On whose behalf the Value is read, or null for the server's own read; passed to the namespace unchanged, and valid until this call returns.
  • callback (ReadValueCompleteCallback) - Receives the outcome: on success the Result holds the DataValue; on failure it carries an ErrorDetail. This overload never throws.
DataValueResult try_read_value_sync() const noexcept

Reads the variable's Value attribute, blocking until complete.

Returns: The value, or an ErrorDetail on failure. Never throws.

DataValue read_value_sync() const

Reads the variable's Value attribute, blocking until complete.

Returns: The value.

void write_value_async(const WriteValue &nodeToWrite, const CallerInfo *caller, WriteValueCompleteCallback callback) noexcept

Writes the variable's value from a service-level WriteValue.

  • nodeToWrite (const WriteValue &) - Identifies the attribute, index range and value to write.
  • caller (const CallerInfo *) - On whose behalf the value is written, or null for the server's own write; passed to the namespace unchanged, and valid until this call returns.
  • callback (WriteValueCompleteCallback) - Receives a VoidResult; on failure it carries an ErrorDetail. This overload never throws.
VoidResult try_write_value_sync(WriteValue writeValue) noexcept

Writes the variable's value from a WriteValue, blocking until complete.

  • writeValue (WriteValue) - Identifies the attribute, index range and value to write.

Returns: A VoidResult that carries an ErrorDetail on failure. Never throws.

void write_value_sync(WriteValue writeValue)

Writes the variable's value from a WriteValue, blocking until complete.

  • writeValue (WriteValue) - Identifies the attribute, index range and value to write.
void write_value_async(DataValue value, WriteValueCompleteCallback callback) noexcept

Writes the variable's Value attribute from a DataValue.

  • value (DataValue) - The value, status and timestamps to write.
  • callback (WriteValueCompleteCallback) - Receives a VoidResult; on failure it carries an ErrorDetail. This overload never throws.
VoidResult try_write_value_sync(DataValue value) noexcept

Writes the variable's Value from a DataValue, blocking until complete.

  • value (DataValue) - The value, status and timestamps to write.

Returns: A VoidResult that carries an ErrorDetail on failure. Never throws.

void write_value_sync(DataValue value)

Writes the variable's Value from a DataValue, blocking until complete.

  • value (DataValue) - The value, status and timestamps to write.
VoidResult try_write_value_sync(T value, optional< DateTime > sourceTimestamp=optional< DateTime >{}) noexcept

Writes the variable's Value from a plain payload, blocking until complete.

  • value (T) - The value to write.
  • sourceTimestamp (optional< DateTime >) - Optional source timestamp.

Returns: A VoidResult that carries an ErrorDetail on failure. Never throws.

void write_value_sync(T value, optional< DateTime > sourceTimestamp=optional< DateTime >{})

Writes the variable's Value from a plain payload, blocking until complete.

  • value (T) - The value to write.
  • sourceTimestamp (optional< DateTime >) - Optional source timestamp.
NodeAccessor(const NodeAccessor &)=default

Copies the handle, sharing ownership of the same underlying node.

NodeAccessor(NodeAccessor &&) noexcept=default

Moves the handle; the source is left wrapping no node.

ua::VariableTypeAccessor

class

Accessor for VariableType nodes.

Unlike a Variable, a VariableType stores a static default DataValue as a plain attribute. This is the only node class for which Value is a stored attribute, so get_value / set_value are synchronous attribute access (distinct from a Variable's live, async value).

Functions

bool is_matching_class() const

Returns true if the wrapped node's class is VariableType.

Returns: true if the wrapped node's class is VariableType.

NodeId get_data_type() const

Returns the variable type's DataType NodeId.

Returns: The variable type's DataType NodeId.

ValueRank get_value_rank() const

Returns the variable type's ValueRank.

Returns: The variable type's ValueRank.

optional< std::vector< uint32_t > > get_array_dimensions() const

Returns the variable type's ArrayDimensions, or std::nullopt if the attribute is not set.

Returns: The variable type's ArrayDimensions, or std::nullopt when the attribute is not set.

void set_data_type(NodeId dataType)

Sets the variable type's DataType.

  • dataType (NodeId) - The DataType NodeId to set.
void set_value_rank(ValueRank valueRank)

Sets the variable type's ValueRank.

  • valueRank (ValueRank) - The ValueRank to set.
void set_array_dimensions(optional< std::vector< uint32_t > > arrayDimensions)

Sets (or clears, with std::nullopt) the variable type's ArrayDimensions.

  • arrayDimensions (optional< std::vector< uint32_t > >) - The ArrayDimensions to set, or std::nullopt to clear the attribute.
bool get_is_abstract() const

Returns the variable type's IsAbstract flag.

Returns: The variable type's IsAbstract flag.

void set_is_abstract(bool isAbstract)

Sets the variable type's IsAbstract flag.

  • isAbstract (bool) - The IsAbstract flag to set.
optional< DataValue > get_value() const

Returns the variable type's stored default Value, or std::nullopt if unset.

Returns: The stored default Value, or std::nullopt when unset.

void set_value(optional< DataValue > value)

Sets (or clears, with std::nullopt) the variable type's stored default Value.

  • value (optional< DataValue >) - The default Value to store, or std::nullopt to clear it.
void set_value(T value, optional< DateTime > sourceTimestamp)

Sets the variable type's stored default Value from a plain payload.

  • value (T) - The value to store.
  • sourceTimestamp (optional< DateTime >) - Optional source timestamp.
void set_value(DataValue value, optional< DateTime > sourceTimestamp)

Sets the variable type's stored default Value directly from a DataValue.

  • value (DataValue) - The value to store; its own timestamps are preserved.
  • sourceTimestamp (optional< DateTime >) - Optional source timestamp applied when set.
void set_value(Variant value, optional< DateTime > sourceTimestamp)

Sets the variable type's stored default Value from a Variant.

  • value (Variant) - The value to store.
  • sourceTimestamp (optional< DateTime >) - Optional source timestamp applied when set.
NodeAccessor(const NodeAccessor &)=default

Copies the handle, sharing ownership of the same underlying node.

NodeAccessor(NodeAccessor &&) noexcept=default

Moves the handle; the source is left wrapping no node.

ua::MethodAccessor

class

Accessor for Method nodes.

Functions

bool is_matching_class() const

Returns true if the wrapped node's class is Method.

Returns: true if the wrapped node's class is Method.

bool get_executable() const

Returns the method's Executable flag.

Returns: The method's Executable flag.

void set_executable(bool executable)

Sets the method's Executable flag.

  • executable (bool) - The Executable flag to set.
void call_async(const CallMethodRequest &methodToCall, shared_ptr< const MethodCallContext > context, CallMethodCompleteCallback callback) const noexcept

Invokes the method.

  • methodToCall (const CallMethodRequest &) - The method's object, method NodeId and input arguments.
  • context (shared_ptr< const MethodCallContext >) - Optional invocation context (session, locale, ...); may be null. Held by shared ownership for the (possibly asynchronous) duration of the call.
  • callback (CallMethodCompleteCallback) - Receives the outcome: on success the Result holds the CallMethodResult; on failure it carries an ErrorDetail. This overload never throws.
CallResult try_call_sync(const CallMethodRequest &methodToCall) const noexcept

Invokes the method, blocking until complete.

  • methodToCall (const CallMethodRequest &) - The method's object, method NodeId and input arguments.

Returns: The call result, or an ErrorDetail on failure. Never throws.

CallMethodResult call_sync(const CallMethodRequest &methodToCall) const

Invokes the method, blocking until complete.

  • methodToCall (const CallMethodRequest &) - The method's object, method NodeId and input arguments.

Returns: The call result.

MethodResult< Out... > try_call_sync(const NodeId &objectId, const In &... inputs) const noexcept

Calls the method from the server's own code with typed arguments, blocking until complete: for testing a handler without a client, or using a Method's logic locally.

  • objectId (const NodeId &) - The Object to call the method on.
  • inputs (const In &...) - The input arguments.

Returns: The result: its status, the outputs when there are any, and the status of each input argument when the call was rejected. The status is the one detail::combined_status gives for the call's code and the Method's statusCode, so a namespace's Good subcode or Uncertain code reaches the caller; the Call service answers a Good subcode plain Good to a client (OPC 10000-4 5.11.2.4). Outputs that do not match Out make it Bad_TypeMismatch. Never throws.

auto call_sync(const NodeId &objectId, const In &... inputs) const

Calls the method with typed arguments, blocking until complete, and returns its outputs.

  • objectId (const NodeId &) - The Object to call the method on.
  • inputs (const In &...) - The input arguments.

Returns: Nothing for a Method without outputs, the output for one, a std::tuple for several.

NodeAccessor(const NodeAccessor &)=default

Copies the handle, sharing ownership of the same underlying node.

NodeAccessor(NodeAccessor &&) noexcept=default

Moves the handle; the source is left wrapping no node.

ua::ObjectAccessor

class

Accessor for Object nodes.

Functions

bool is_matching_class() const

Returns true if the wrapped node's class is Object.

Returns: true if the wrapped node's class is Object.

EventNotifierType get_event_notifier() const

Returns the object's EventNotifier bit mask.

Returns: The object's EventNotifier bit mask.

void set_event_notifier(const EventNotifierType &eventNotifier)

Sets the object's EventNotifier bit mask.

  • eventNotifier (const EventNotifierType &) - The EventNotifier bit mask to set.
NodeAccessor(const NodeAccessor &)=default

Copies the handle, sharing ownership of the same underlying node.

NodeAccessor(NodeAccessor &&) noexcept=default

Moves the handle; the source is left wrapping no node.

ua::DataTypeAccessor

class

Accessor for DataType nodes.

Functions

bool is_matching_class() const

Returns true if the wrapped node's class is DataType.

Returns: true if the wrapped node's class is DataType.

bool get_is_abstract() const

Returns the data type's IsAbstract flag.

Returns: The data type's IsAbstract flag.

void set_is_abstract(bool isAbstract)

Sets the data type's IsAbstract flag.

  • isAbstract (bool) - The IsAbstract flag to set.
shared_ptr< const DataTypeDefinition > get_data_type_definition() const

Returns the data type's structure/enum definition, or null if none is set.

Returns: The data type's structure/enum definition, or null when none is set.

void set_data_type_definition(shared_ptr< const DataTypeDefinition > dataTypeDefinition)

Sets (or clears, with null) the data type's structure/enum definition.

  • dataTypeDefinition (shared_ptr< const DataTypeDefinition >) - The structure/enum definition to set, or null to clear it.
NodeAccessor(const NodeAccessor &)=default

Copies the handle, sharing ownership of the same underlying node.

NodeAccessor(NodeAccessor &&) noexcept=default

Moves the handle; the source is left wrapping no node.

ua::ObjectTypeAccessor

class

Accessor for ObjectType nodes.

Functions

bool is_matching_class() const

Returns true if the wrapped node's class is ObjectType.

Returns: true if the wrapped node's class is ObjectType.

bool get_is_abstract() const

Returns the object type's IsAbstract flag.

Returns: The object type's IsAbstract flag.

void set_is_abstract(bool isAbstract)

Sets the object type's IsAbstract flag.

  • isAbstract (bool) - The IsAbstract flag to set.
NodeAccessor(const NodeAccessor &)=default

Copies the handle, sharing ownership of the same underlying node.

NodeAccessor(NodeAccessor &&) noexcept=default

Moves the handle; the source is left wrapping no node.

ua::ReferenceTypeAccessor

class

Accessor for ReferenceType nodes.

Functions

bool is_matching_class() const

Returns true if the wrapped node's class is ReferenceType.

Returns: true if the wrapped node's class is ReferenceType.

bool get_is_abstract() const

Returns the reference type's IsAbstract flag.

Returns: The reference type's IsAbstract flag.

void set_is_abstract(bool isAbstract)

Sets the reference type's IsAbstract flag.

  • isAbstract (bool) - The IsAbstract flag to set.
bool get_symmetric() const

Returns the reference type's Symmetric flag.

Returns: The reference type's Symmetric flag.

void set_symmetric(bool isSymmetric)

Sets the reference type's Symmetric flag.

  • isSymmetric (bool) - The Symmetric flag to set.
void set_inverse_name(LocalizedText inverseName)

Sets the reference type's InverseName.

NodeAccessor(const NodeAccessor &)=default

Copies the handle, sharing ownership of the same underlying node.

NodeAccessor(NodeAccessor &&) noexcept=default

Moves the handle; the source is left wrapping no node.

ua::ViewAccessor

class

Accessor for View nodes.

Functions

bool is_matching_class() const

Returns true if the wrapped node's class is View.

Returns: true if the wrapped node's class is View.

EventNotifierType get_event_notifier() const

Returns the view's EventNotifier bit mask.

Returns: The view's EventNotifier bit mask.

void set_event_notifier(const EventNotifierType &eventNotifier)

Sets the view's EventNotifier bit mask.

  • eventNotifier (const EventNotifierType &) - The EventNotifier bit mask to set.
bool get_contains_no_loops() const

Returns the view's ContainsNoLoops flag.

Returns: The view's ContainsNoLoops flag.

void set_contains_no_loops(bool containsNoLoops)

Sets the view's ContainsNoLoops flag.

  • containsNoLoops (bool) - The ContainsNoLoops flag to set.
void is_node_in_view_async(NodeId nodeId, IsNodeInViewCallback callback) const noexcept

Tests whether nodeId is a member of this view.

  • nodeId (NodeId) - The node to test for membership.
  • callback (IsNodeInViewCallback) - Receives the outcome: on success the Result holds the membership boolean; on failure it carries an ErrorDetail. This overload never throws.
bool is_node_in_view_sync(const NodeId &nodeId) const

Tests view membership of nodeId, blocking until complete.

  • nodeId (const NodeId &) - The node to test for membership.

Returns: true if the node is in the view.

BoolResult try_is_node_in_view_sync(const NodeId &nodeId) const noexcept

Tests view membership of nodeId, blocking until complete.

  • nodeId (const NodeId &) - The node to test for membership.

Returns: true if the node is in the view, or an ErrorDetail on failure. Never throws.

void add_node_to_view_async(NodeId nodeId, ViewModifyCallback callback) noexcept

Adds nodeId as a member of this view.

  • nodeId (NodeId) - The node to add to the view.
  • callback (ViewModifyCallback) - Receives a VoidResult; on failure it carries an ErrorDetail. This overload never throws.
void add_node_to_view_sync(const NodeId &nodeId)

Adds nodeId to this view, blocking until complete.

  • nodeId (const NodeId &) - The node to add to the view.
VoidResult try_add_node_to_view_sync(const NodeId &nodeId) noexcept

Adds nodeId to this view, blocking until complete.

  • nodeId (const NodeId &) - The node to add to the view.

Returns: A VoidResult that carries an ErrorDetail on failure. Never throws.

NodeAccessor(const NodeAccessor &)=default

Copies the handle, sharing ownership of the same underlying node.

NodeAccessor(NodeAccessor &&) noexcept=default

Moves the handle; the source is left wrapping no node.

ua::NodeDescription

class

A Node's non-Value Attributes, as one immutable value.

This is what Node::attributes() returns and what every reader of a Node's Attributes reads: the accessor getters, Browse and TranslateBrowsePaths, access control, event filters and the Read service for every Attribute but a Variable's Value. A namespace author builds descriptions with the factories below (or try_from_attributes from an AddNodes-shaped attribute list) and never writes a class that stores Attributes.

Not in a description. A Variable's Value, which is read through Namespace::read_values_async because it is live and may differ per caller; and the four Attributes derived per Session (UserAccessLevel, UserWriteMask, UserExecutable, UserRolePermissions), which the services compute from the stored Attribute and the Session's permissions (see is_session_derived_attribute). A VariableType's Value is a description Attribute: it is the type's static default.

Storage and copying. A description is a handle to one immutable body. Copying a description copies a pointer; no Attribute is copied. A body never changes once built: each with_... member builds a new body holding every field of the old one with one field replaced, and leaves the original untouched. A reader that took a description before a change keeps reading the old body, consistently, until it lets go of it. The body's layout is private to the implementation and may change without an API change.

Readers return references into the body and are deleted on rvalues. node->attributes().browse_name() does not compile: hold the description in a variable first, so the reference cannot outlive the body it points into.

NodeClass-specific Attributes. A reader of an Attribute the NodeClass does not define answers absent (nullopt or nullptr), as it does for an optional Attribute the Node does not carry. A with_... of an Attribute the NodeClass does not define throws UaException with Bad_InvalidArgument; its try_with_... form returns that status instead. Attributes of every NodeClass have only the with_... form, which cannot fail.

Attribute applicability follows OPC 10000-3 clause 5 (Tables 7 to 16).

Static functions

NodeDescription object(NodeId nodeId, QualifiedName browseName)

An Object (OPC 10000-3 5.5.1).

Returns: The description.

NodeDescription variable(NodeId nodeId, QualifiedName browseName, NodeId dataType, ValueRank valueRank=ValueRank::scalar)

A Variable (OPC 10000-3 5.6.2).

  • nodeId (NodeId) - The Node's NodeId.
  • browseName (QualifiedName) - The Node's BrowseName.
  • dataType (NodeId) - The NodeId of the Variable's DataType.
  • valueRank (ValueRank) - The Variable's ValueRank; scalar by default.

Returns: The description.

NodeDescription method(NodeId nodeId, QualifiedName browseName)

A Method (OPC 10000-3 5.7).

Returns: The description.

NodeDescription object_type(NodeId nodeId, QualifiedName browseName, bool isAbstract=false)

An ObjectType (OPC 10000-3 5.5.2).

  • nodeId (NodeId) - The Node's NodeId.
  • browseName (QualifiedName) - The Node's BrowseName.
  • isAbstract (bool) - The IsAbstract Attribute.

Returns: The description.

NodeDescription variable_type(NodeId nodeId, QualifiedName browseName, NodeId dataType, ValueRank valueRank, bool isAbstract=false)

A VariableType (OPC 10000-3 5.6.5), with no default Value.

  • nodeId (NodeId) - The Node's NodeId.
  • browseName (QualifiedName) - The Node's BrowseName.
  • dataType (NodeId) - The NodeId of the type's DataType.
  • valueRank (ValueRank) - The type's ValueRank.
  • isAbstract (bool) - The IsAbstract Attribute.

Returns: The description.

NodeDescription data_type(NodeId nodeId, QualifiedName browseName, bool isAbstract=false)

A DataType (OPC 10000-3 5.8.3), with no DataTypeDefinition.

  • nodeId (NodeId) - The Node's NodeId.
  • browseName (QualifiedName) - The Node's BrowseName.
  • isAbstract (bool) - The IsAbstract Attribute.

Returns: The description.

NodeDescriptionResult try_reference_type(NodeId nodeId, QualifiedName browseName, bool isAbstract, bool symmetric, std::optional< LocalizedText > inverseName) noexcept

A ReferenceType (OPC 10000-3 5.3).

  • nodeId (NodeId) - The Node's NodeId.
  • browseName (QualifiedName) - The Node's BrowseName.
  • isAbstract (bool) - The IsAbstract Attribute.
  • symmetric (bool) - The Symmetric Attribute.
  • inverseName (std::optional< LocalizedText >) - The InverseName; engaged exactly when symmetric is false.

Returns: The description, or Bad_InvalidArgument with an ErrorDetail naming the conflict. Never throws.

NodeDescription view(NodeId nodeId, QualifiedName browseName, bool containsNoLoops=false)

A View (OPC 10000-3 5.4).

  • nodeId (NodeId) - The Node's NodeId.
  • browseName (QualifiedName) - The Node's BrowseName.
  • containsNoLoops (bool) - The ContainsNoLoops Attribute.

Returns: The description.

NodeDescriptionResult try_from_attributes(const NodeId &nodeId, NodeClass nodeClass, const InitialAttributes &attributes) noexcept

Builds a description from an AddNodes-shaped attribute list, in one body.

  • nodeId (const NodeId &) - The new Node's NodeId.
  • nodeClass (NodeClass) - The new Node's NodeClass.
  • attributes (const InitialAttributes &) - Attribute values in wire form; may be empty.

Returns: The description; or Bad_NodeClassInvalid when nodeClass is Unspecified or not a NodeClass; or Bad_NodeAttributesInvalid when the list carries an Attribute that nodeClass does not have (a Session-derived Attribute and a Variable's Value included); or Bad_TypeMismatch when a value is not of its Attribute's type; or Bad_InvalidArgument for a ValueRank below the lowest defined ValueRank. Each failure carries an ErrorDetail naming the Attribute. Never throws.

Functions

NodeDescription(const NodeDescription &) noexcept=default

Copies share the immutable body; both descriptions remain valid.

NodeDescription & operator=(const NodeDescription &) noexcept=default

Copy-assigns, sharing the immutable body and retaining both descriptions.

Returns: This object after assignment.

NodeDescription(NodeDescription &&other) noexcept

Moving copies the pointer: a moved-from description still reads the same body, so no reader can reach a description without one.

  • other (NodeDescription &&) - Description whose body is shared; remains valid.
NodeDescription & operator=(NodeDescription &&other) noexcept

Moving copies the pointer; see the move constructor.

  • other (NodeDescription &&) - Description whose body is shared; remains valid.

Returns: This object after assignment.

~NodeDescription()=default
NodeDescription with_browse_name(QualifiedName value) const

Returns: A copy with the BrowseName replaced.

NodeDescription with_display_name(LocalizedText value) const
  • value (LocalizedText) - The new DisplayName, replaced whole (merging per locale is the writer's step).

Returns: A copy with the DisplayName replaced.

NodeDescription with_description(std::optional< LocalizedText > value) const

Returns: A copy with the Description replaced.

NodeDescription with_write_mask(std::optional< AttributeWriteMask > value) const

Returns: A copy with the WriteMask replaced.

NodeDescription with_role_permissions(std::optional< std::vector< RolePermissionType > > value) const

Returns: A copy with the RolePermissions replaced.

NodeDescription with_access_restrictions(std::optional< AccessRestrictionType > value) const

Returns: A copy with the AccessRestrictions replaced.

NodeDescription with_is_abstract(bool value) const
  • value (bool) - IsAbstract (ObjectType, VariableType, ReferenceType, DataType).

Returns: A copy with the Attribute replaced.

NodeDescriptionResult try_with_is_abstract(bool value) const noexcept
  • value (bool) - IsAbstract.

Returns: A copy, or Bad_InvalidArgument.

NodeDescription with_symmetric(bool value) const
  • value (bool) - Symmetric (ReferenceType). The InverseName constraint is not checked here.

Returns: A copy with the Attribute replaced.

NodeDescriptionResult try_with_symmetric(bool value) const noexcept
  • value (bool) - Symmetric.

Returns: A copy, or Bad_InvalidArgument.

NodeDescription with_inverse_name(std::optional< LocalizedText > value) const

Returns: A copy with the Attribute replaced.

NodeDescriptionResult try_with_inverse_name(std::optional< LocalizedText > value) const noexcept

Returns: A copy, or Bad_InvalidArgument.

NodeDescription with_contains_no_loops(bool value) const
  • value (bool) - ContainsNoLoops (View).

Returns: A copy with the Attribute replaced.

NodeDescriptionResult try_with_contains_no_loops(bool value) const noexcept
  • value (bool) - ContainsNoLoops.

Returns: A copy, or Bad_InvalidArgument.

NodeDescription with_event_notifier(EventNotifierType value) const

Returns: A copy with the Attribute replaced.

NodeDescriptionResult try_with_event_notifier(EventNotifierType value) const noexcept

Returns: A copy, or Bad_InvalidArgument.

NodeDescription with_data_type(NodeId value) const
  • value (NodeId) - DataType (Variable, VariableType).

Returns: A copy with the Attribute replaced.

NodeDescriptionResult try_with_data_type(NodeId value) const noexcept

Returns: A copy, or Bad_InvalidArgument.

NodeDescription with_value_rank(ValueRank value) const
  • value (ValueRank) - ValueRank (Variable, VariableType).

Returns: A copy with the Attribute replaced.

NodeDescriptionResult try_with_value_rank(ValueRank value) const noexcept

Returns: A copy, or Bad_InvalidArgument.

NodeDescription with_array_dimensions(std::optional< std::vector< uint32_t > > value) const

Returns: A copy with the Attribute replaced.

NodeDescriptionResult try_with_array_dimensions(std::optional< std::vector< uint32_t > > value) const noexcept

Returns: A copy, or Bad_InvalidArgument.

NodeDescription with_access_level(AccessLevelType value) const

Returns: A copy with the Attribute replaced.

NodeDescriptionResult try_with_access_level(AccessLevelType value) const noexcept

Returns: A copy, or Bad_InvalidArgument.

NodeDescription with_minimum_sampling_interval(std::optional< Duration > value) const

Returns: A copy with the Attribute replaced.

NodeDescriptionResult try_with_minimum_sampling_interval(std::optional< Duration > value) const noexcept

Returns: A copy, or Bad_InvalidArgument.

NodeDescription with_historizing(bool value) const
  • value (bool) - Historizing (Variable).

Returns: A copy with the Attribute replaced.

NodeDescriptionResult try_with_historizing(bool value) const noexcept
  • value (bool) - Historizing.

Returns: A copy, or Bad_InvalidArgument.

NodeDescription with_access_level_ex(std::optional< AccessLevelExType > value) const

Returns: A copy with the Attribute replaced.

NodeDescriptionResult try_with_access_level_ex(std::optional< AccessLevelExType > value) const noexcept

Returns: A copy, or Bad_InvalidArgument.

NodeDescription with_executable(bool value) const
  • value (bool) - Executable (Method).

Returns: A copy with the Attribute replaced.

NodeDescriptionResult try_with_executable(bool value) const noexcept
  • value (bool) - Executable.

Returns: A copy, or Bad_InvalidArgument.

NodeDescription with_data_type_definition(shared_ptr< const DataTypeDefinition > value) const
  • value (shared_ptr< const DataTypeDefinition >) - DataTypeDefinition (DataType), or null to remove it. Shared, not copied: the new body holds the same object. OPC 10000-3 5.8.4 forbids changing a definition once provided to Clients; that is the namespace's rule to keep.

Returns: A copy with the Attribute replaced.

NodeDescriptionResult try_with_data_type_definition(shared_ptr< const DataTypeDefinition > value) const noexcept
  • value (shared_ptr< const DataTypeDefinition >) - DataTypeDefinition, or null.

Returns: A copy, or Bad_InvalidArgument.

NodeDescription with_value(std::optional< DataValue > value) const
  • value (std::optional< DataValue >) - A VariableType's default Value, or nullopt to remove it. A held DataValue with an empty value is a held null, distinct from no Value.

Returns: A copy with the Attribute replaced.

NodeDescriptionResult try_with_value(std::optional< DataValue > value) const noexcept

Returns: A copy, or Bad_InvalidArgument (also for a Variable, whose Value is not a description Attribute).

NodeDescriptionResult try_with_attribute(AttributeId attributeId, const Variant &value) const noexcept

A copy with one Attribute set from its wire form, as a successful Write of it leaves the Node.

  • attributeId (AttributeId) - The Attribute written.
  • value (const Variant &) - The written value in wire form, as the Write service delivers it.

Returns: The copy; or Bad_AttributeIdInvalid for NodeId, NodeClass, a Session-derived Attribute, an Attribute the NodeClass does not define or a Variable's Value; or Bad_TypeMismatch when the value does not fit the Attribute, a null on any Attribute but those above included; or Bad_InvalidArgument for a ValueRank below the lowest defined ValueRank. Never throws.

const NodeId & node_id() const &noexcept

Returns: The NodeId.

NodeClass node_class() const noexcept

Returns: The NodeClass.

const QualifiedName & browse_name() const &noexcept

Returns: The BrowseName; empty for a bare Node not yet named.

const LocalizedText & display_name() const &noexcept

Returns: The DisplayName, in every locale the Node holds.

const LocalizedText * description() const &noexcept

Returns: The Description, or nullptr when the Node has none.

std::optional< AttributeWriteMask > write_mask() const noexcept

Returns: The WriteMask, or nullopt when the Node has none.

const std::vector< RolePermissionType > * role_permissions() const &noexcept

Returns: The Node's own RolePermissions, or nullptr when it has none and the namespace's DefaultRolePermissions apply. An empty array is never held: every member reads an empty RolePermissions as removing the Node's own (OPC 10000-3 5.2.9).

std::optional< AccessRestrictionType > access_restrictions() const noexcept

Returns: The AccessRestrictions, or nullopt when the Node has none.

std::optional< bool > is_abstract() const noexcept

Returns: IsAbstract, or nullopt when the NodeClass does not define it.

std::optional< bool > symmetric() const noexcept

Returns: Symmetric, or nullopt when the NodeClass does not define it.

const LocalizedText * inverse_name() const &noexcept

Returns: The InverseName, or nullptr when the Node has none.

std::optional< bool > contains_no_loops() const noexcept

Returns: ContainsNoLoops, or nullopt when the NodeClass does not define it.

std::optional< EventNotifierType > event_notifier() const noexcept

Returns: EventNotifier, or nullopt when the NodeClass does not define it.

const NodeId * data_type() const &noexcept

Returns: The DataType's NodeId, or nullptr when the NodeClass does not define it.

std::optional< ValueRank > value_rank() const noexcept

Returns: ValueRank, or nullopt when the NodeClass does not define it.

const std::vector< uint32_t > * array_dimensions() const &noexcept

Returns: ArrayDimensions, or nullptr when the Node has none.

std::optional< AccessLevelType > access_level() const noexcept

Returns: AccessLevel, or nullopt when the NodeClass does not define it.

std::optional< Duration > minimum_sampling_interval() const noexcept

Returns: MinimumSamplingInterval in milliseconds, or nullopt when the Node has none.

std::optional< bool > historizing() const noexcept

Returns: Historizing, or nullopt when the NodeClass does not define it.

std::optional< AccessLevelExType > access_level_ex() const noexcept

Returns: AccessLevelEx, or nullopt when the Node has none.

std::optional< bool > executable() const noexcept

Returns: Executable, or nullopt when the NodeClass does not define it.

const shared_ptr< const DataTypeDefinition > & data_type_definition() const &noexcept

Returns: The DataTypeDefinition, or null when the Node has none.

const DataValue * value() const &noexcept

Returns: A VariableType's default Value, or nullptr when it has none or the Node is not a VariableType.

DataValueResult attribute(AttributeId attributeId) const noexcept

Reads one Attribute in its wire form, as the Read service returns it.

  • attributeId (AttributeId) - The Attribute to read.

Returns: The value; or Bad_AttributeIdInvalid for an Attribute the NodeClass does not define, an optional Attribute the Node does not carry, a Session-derived Attribute, or a Variable's Value (read through Namespace::read_values_async). Never throws.

ua::node_utils::NodeIdPairHash

struct

Hash functor for an ordered pair of NodeId values.

Combines the two element hashes into a single bucket index so that (refTypeId, typeId) keys can be stored in an unordered container.

Functions

size_t operator()(const std::pair< NodeId, NodeId > &pair) const

Returns a combined hash of the pair's two NodeId elements.

  • pair (const std::pair< NodeId, NodeId > &) - The (first, second) NodeId pair to hash; order is significant.

Returns: A bucket-index hash mixing both element hashes.

ua::node_utils::RefTypeCache

class

Internally-synchronised memoisation cache for reference-type subtype checks.

Keyed on (refTypeId, typeId) with the cached is-subtype-of result. is_ref_of_type_cached_async looks the key up on the caller's executor but, on a miss, stores the walk's result from the walk's completion which runs on a DIFFERENT executor (the address-space pool, not the caller's strand). With concurrent operations sharing one cache, a find on one executor races an emplace on another, so the map must be synchronised (concurrent std::unordered_map access is UB - rehash/iterator corruption). Held via std::shared_ptr and captured BY VALUE into the async walk so the cache outlives any in-flight walk even if the owning service/AddressSpace is destroyed mid-walk (otherwise a use-after-free). lookup/store release the lock before returning so callers never invoke a continuation under it.

Functions

std::optional< bool > lookup(const std::pair< NodeId, NodeId > &key) const

Returns the cached result for key, or nullopt if not yet memoised.

  • key (const std::pair< NodeId, NodeId > &) - The (refTypeId, typeId) pair to look up.

Returns: The memoised is-subtype-of result, or std::nullopt when the key is not cached.

void store(const std::pair< NodeId, NodeId > &key, bool value)

Memoises value for key (first writer wins; concurrent stores of the same key are idempotent).

  • key (const std::pair< NodeId, NodeId > &) - The (refTypeId, typeId) pair to memoise.
  • value (bool) - The is-subtype-of result to cache for key.

ua::Reference

class

A directed, typed edge between two nodes in the address space.

A reference connects a source node to a target node via a reference type (e.g. HasComponent, Organizes) and records the direction in which the edge is traversed. The source node is implied by the context that owns the reference; only the reference type, the target, and the direction are stored.

Functions

Reference()=default

Constructs an empty reference with default type and target and a forward direction.

Reference(NodeId type, ExpandedNodeId target, bool isForward, std::optional< LocalizedText > targetDisplayName=std::nullopt)

Constructs a reference of the given type to the given target.

  • type (NodeId) - Reference-type node id (e.g. HasComponent).
  • target (ExpandedNodeId) - Target node, which may be local or remote.
  • isForward (bool) - true for a forward edge from source to target; false for the inverse edge.
  • targetDisplayName (std::optional< LocalizedText >) - DisplayName supplied by the authority for a remote target. Local targets normally omit it because Browse resolves their attributes.
bool operator==(const Reference &other) const

Compares two references for equality of type, target, and direction.

  • other (const Reference &) - The reference to compare against.

Returns: true if both references have the same type, target, and direction.

bool identifies_same_reference_as(const Reference &other) const

Whether this and other are the same Reference of one source Node, as OPC 10000-3 section 4.3.4 identifies References: the same direction and target, and the same ReferenceType once a subtype of a concrete namespace-0 ReferenceType is taken as its base concrete type (reference_identity_type).

  • other (const Reference &) - The reference to compare against.

Returns: true if a source Node may hold only one of the two.

bool is_forward() const

Returns true if this is a forward edge, false if it is the inverse edge.

Returns: true for a forward edge from source to target; false for the inverse edge.

bool is_remote() const

Returns true if the target lives in a remote server or namespace.

Returns: true if the target has a non-zero server index (a remote server/namespace).

const NodeId & type_id() const

Returns the reference-type node id (e.g.

Returns: The reference-type node id.

const ExpandedNodeId & target_id() const

Returns the target the reference points to.

Returns: The reference's target node.

const std::optional< LocalizedText > & target_display_name() const

Returns authority-supplied DisplayName metadata for the target, when available.

Returns: The target DisplayName, or std::nullopt when none was supplied.

ua::References

class

A zero-copy, immutable collection of references over shared storage.

The references are held in a shared_ptr<const std::vector<Reference>>, so copying a References shares ownership of the underlying storage rather than duplicating it. For in-memory namespaces this points directly at the copy-on-write node storage, so iterating involves no copy. For database/remote namespaces the vector is materialized from query results and owned by the collection. Instances are lightweight value handles and are safe to copy and pass across threads.

Functions

References()=default

Constructs an empty collection backed by no storage.

References(std::shared_ptr< const std::vector< Reference > > storage)

Constructs a view that shares ownership of existing reference storage.

References(std::vector< Reference > owned)

Constructs a collection that takes ownership of a newly-built vector.

References slice(uint32_t offset, uint32_t count) const

Returns a sub-range view that shares the same backing storage.

  • offset (uint32_t) - Index of the first reference to include, from the start of this collection's window.
  • count (uint32_t) - Number of references to include.

Returns: A collection viewing references in [offset, offset + count).

std::span< const Reference > span() const

Returns a contiguous, non-owning view of the references in this collection.

Returns: A span over the references in this collection's window.

auto begin() const

Returns an iterator to the first reference.

Returns: An iterator to the first reference, or the end iterator when empty.

auto end() const

Returns an iterator one past the last reference.

Returns: An iterator one past the last reference.

bool empty() const

Returns true if the collection holds no references.

Returns: true when the collection has no backing storage or an empty window.

size_t size() const

Returns the number of references in the collection.

Returns: The number of references in this collection's window.

ua::RequestInfo

struct

The request a call into a namespace serves: its deadlines, its cancellation flag and the Session's locales.

Every asynchronous Namespace member takes one as its first argument, so every member, lookups and monitoring included, can be cancelled and has a deadline. The struct is plain data: the address space fills it from the request, and a namespace that answers inline can ignore it.

Lifetime. Passed by const& and valid only until the member returns. A namespace that answers later copies the struct (it is cheap: two time points, a shared flag and the locale list) or the fields it needs.

The server's own calls (sampling, rollbacks, the SDK's internal lookups) carry a deadline of time_point::max(), no answerBy, a flag that is never set and no locales.

Public attributes

std::optional< std::chrono::steady_clock::time_point > answerBy

The partial-results deadline: the time by which a namespace that can answer part of a batch should return what it has.

std::chrono::steady_clock::time_point deadline

The hard deadline: the request's arrival plus its timeoutHint (OPC 10000-4 7.33).

shared_ptr< const std::atomic_bool > cancelled

Set when the client cancelled the request or the Session ended.

std::vector< LocaleId > locales

The Session's locales, most preferred first (OPC 10000-4 5.6.3).

ua::CallerInfo

struct

On whose behalf a namespace member is called: the Session's committed identity and the Session facts a value source or a method handler may need.

Passed as const CallerInfo* to read_values_async, write_async, call_async and create_monitoring_async. A null pointer is the server's own call (an internal read, a sampling read of a subscription with no Session, a write the SDK makes for itself), not an anonymous client. Lookups, References and View membership take no caller: what a Node is and what it references does not depend on who asks.

A namespace whose answers do not depend on the caller ignores it. One that does - a per-user source, a gateway that impersonates the client's user upstream (OPC 10000-4 5.6.3.1) - answers from it, because no later stage can: the value has left the namespace by then.

Lifetime. The pointer is valid until the member RETURNS: the address space passes on the pointer it was given, which may be the application's own (an accessor's value forms take one), and does not copy it. A namespace that answers later copies the struct, or the identity shared_ptr, before it returns.

The Session's locales are in RequestInfo::locales, not here.

Public attributes

shared_ptr< const AccessIdentity > identity

The Session's committed identity: its granted Roles, its user and its endpoint.

NodeId sessionId

The NodeId of the calling Session.

String clientUserId

The authenticated user's id as audit events report it (ClientUserId).

MessageSecurityMode channelSecurityMode

The security mode of the SecureChannel the Session is activated on.

ua::ServerArray

class

Maps server indices to server application URIs for the address space.

Backs the standard Server.ServerArray variable: each entry is a server application URI, and its position is the server index used by ExpandedNodeId and AddReferencesItem.TargetServerUri to name a remote server. Index 0 is reserved for the local server's own URI, which is added when the address space is initialised.

URIs are unique within the array; a URI's index is assigned on insertion and never changes. Access is thread-safe - the array is internally synchronised and every method may be called concurrently from any thread.

Functions

uint32_t get_server_index(string_view uri) const

Returns the index of a registered server URI.

  • uri (string_view) - Server application URI to look up.

Returns: The index at which uri is registered.

String get_server_uri(uint32_t index) const

Returns the server URI registered at an index.

  • index (uint32_t) - Server index, in the range [0, size()).

Returns: The server application URI at index.

uint32_t add_server_uri(string_view uri)

Registers a server URI and returns its index.

  • uri (string_view) - Server application URI to register; must not already be present.

Returns: The index assigned to uri.

Array< String > get_server_array() const

Returns a snapshot of all registered server URIs in index order.

Returns: An array whose element at position i is the URI for server index i; this is the value of the Server.ServerArray node.

ua::EventSink

class

Sink that accepts OPC UA events for routing into the server's event pipeline.

Implementations are thread-safe: an event may be submitted from any thread, and the implementation posts it to an internal strand for routing and dispatch to subscribers. A reference to a sink is handed to each namespace (via its namespace context) so that proxy namespaces can inject events originating in external systems.

Functions

EventSink()=default
void emit(BaseEvent &event)=0

Submits an event for delivery through the server's event pipeline.

  • event (BaseEvent &) - Event to emit. Borrowed for the duration of the call only and not retained; the implementation may mutate the auto-filled fields described above. The caller retains ownership.
~EventSink()=default

Destroys the sink. Virtual to allow destruction through this interface.

ua::SampleSink

class

Batch delivery interface through which a namespace pushes sampled values into a subscription.

One SampleSink exists per Subscription and is shared (via shared_ptr) across all monitored items of that subscription, regardless of which namespace owns the source nodes. The namespace accumulates samples internally and posts them in batches at whatever granularity it chooses (per sampling tick, per event cycle, etc.), rather than one call per sample.

All methods are thread-safe and callable from any thread; implementations must not block the caller. The sink is held by shared_ptr, so it remains alive for the duration of any in-flight call even if the subscription is concurrently torn down.

Functions

SampleSink()=default
~SampleSink()=default
void push(std::vector< std::pair< IntegerId, DataValue > > samples)=0

Posts a batch of sampled values into the subscription.

void invalidate(IntegerId monitoredItemId, StatusCode reason)=0

Reports that a monitored item's source node was deleted or became unavailable.

  • monitoredItemId (IntegerId) - Item whose source is no longer sampleable.
  • reason (StatusCode) - Status code describing why the source became unavailable.
void mark_semantics_changed(IntegerId monitoredItemId)

Reports that a semantic property of a monitored item's value changed.

  • monitoredItemId (IntegerId) - Item whose value semantics changed.
void mark_structure_changed(IntegerId monitoredItemId)

Reports that the structure of a monitored item's value changed: the DataTypeEncoding its Variable's Value is serialized with, as when the Variable's DataType changes.

  • monitoredItemId (IntegerId) - Item whose value structure changed.
std::shared_ptr< const CallerInfo > caller() const

The caller this subscription's items are sampled for now: its Session's current CallerInfo, which changes when the Session's user changes, the subscription is transferred, or the Session's Roles are refreshed.

Returns: The current caller, or null.

void detach()=0

Disconnects the namespace from this sink.

ua::ValueSource

class

The owner of the Values of one or more Variables: it produces a Value for each read and applies each write.

Attached to a Variable with ExternalValueSource::set_value_source; one source may serve many Variables, and receives each item's Variable so that it can tell them apart. The namespace that holds the Variables calls each source once per request for all of that source's items (read_async for a Read or a sampling tick, write_async for a Write), in item order.

The source applies what a request asks of its data. A read item's IndexRange selects the elements to return (Part 4 7.27); a write item's IndexRange names the elements its partial Value replaces, and an OptionSet write's ValidBits the bits it replaces (Part 3 OptionSet: "new value = (value & validBits) | (current value & ~validBits)"). The SDK never merges on the source's behalf: index_range_utils::apply_write and merge_option_set_value are the helpers. Before calling a source, the namespace refuses a ranged access to a Scalar Variable whose DataType can hold neither a String nor a ByteString with Bad_IndexRangeNoData.

Lifetime. The context, the items, every Node and every value they refer to are valid only until the call returns: a source that answers later copies what it needs first. A source calls complete exactly once per call, inline or later, with one result per item in item order.

Thread safety. Calls to one source may run concurrently, from any thread of the address space's executor or the caller's.

Monitoring. A MonitoredItem on the Value at sampling interval 0 is fed by the source's reports, not sampled, only when the Variable's MinimumSamplingInterval is 0: an explicit 0 is the source's claim that it reports every change of the Value through ExternalValueSource::notify_value_changed (OPC 10000-4 5.12.1.2: interval 0 "indicates that the data item is exception-based"). With the MinimumSamplingInterval absent, or any other figure, the item is sampled through read_async at the subscription's tick. A source whose Value differs per caller cannot report it, since a report pushes one Value to every item: its Variable's MinimumSamplingInterval is -1 or the source's own figure, and its items are sampled for each subscription's current caller. How an item is fed is decided when it is created or modified, so a source attached later does not change it. A committed write is reported to items fed by reports with the Value the source then holds, read back whole with no caller, so a source that clamps, rounds or converts what it is given is reported as a Read sees it.

Member types

Result< Written > WriteResult

One write item's answer.

std::function< void(const ReadContext &, const Node &, const ReadValueId &, std::function< void(DataValueResult)>)> ReadValueHandler

One read of one Variable, for a source written as a function (make_value_source).

std::function< void(const WriteContext &, const Node &, const WriteValue &, std::function< void(WriteResult)>)> WriteValueHandler

One write of one Variable, for a source written as a function (make_value_source).

Functions

ValueSource()=default
~ValueSource()=default
void read_async(const ReadContext &context, std::span< const ReadItem > items, std::function< void(BatchResult< DataValueResult >)> complete)=0

Produces the Value of each of items, then calls complete once, with one result per item in item order.

void write_async(const WriteContext &context, std::span< const WriteItem > items, std::function< void(BatchResult< WriteResult >)> complete)

Applies each of items, then calls complete once, with one result per item in item order.

ua::FiniteStateVariableState

struct

Snapshot of a FiniteStateMachine's CurrentState for an event payload.

Carries the two fields a client selects via an EventFilter on a state-machine component (e.g. ExclusiveLimitAlarmType's LimitState): the CurrentState Value (the human-readable state name, a LocalizedText) and its Id property (the NodeId of the active state). Mirrors TwoStateVariableState but for a FiniteStateVariableType, whose Id is a NodeId rather than a boolean.

Public attributes

LocalizedText currentState

CurrentState Value: the active state's display name.

NodeId id

CurrentState.Id: the NodeId of the active state.

ua::ShelvedStateVariableState

struct

Snapshot of an AlarmCondition's ShelvingState (a ShelvedStateMachineType) for event field resolution.

The FiniteStateVariableState pair plus the machine's Mandatory UnshelveTime Property, which OPC 10000-9 5.8.17.1 defines as "the remaining time in milliseconds until the Alarm automatically transitions into the Un-shelved state": the ShelvingTime for a TimedShelve, MaxTimeShelved (or the maximum Duration) for a OneShotShelve.

Public attributes

LocalizedText currentState

ShelvingState/CurrentState Value.

NodeId id

ShelvingState/CurrentState/Id.

double unshelveTime

ShelvingState/UnshelveTime, a Duration in milliseconds.

ua::ConditionVariableState

struct

Snapshot of a ConditionVariableType instance's state for event field resolution.

Used as a compound field in generated condition event structs. Holds the current value and the source timestamp of that value, mirroring the Value attribute and its SourceTimestamp on a ConditionVariableType instance.

Public attributes

Variant value

Current value of the condition variable.

DateTime sourceTimestamp

Source timestamp of value.

ua::TwoStateVariableState

struct

Snapshot of a TwoStateVariableType instance's state for event field resolution.

Used as a compound field in generated condition event structs. Mirrors the Id and EffectiveDisplayName (CurrentState) of a TwoStateVariableType instance together with the timestamp of the last state transition.

Public attributes

bool id

Current boolean state: the Id property of the TwoStateVariableType.

LocalizedText currentState

Display text for the active state, e.g. "Enabled"/"Disabled".

DateTime transitionTime

Timestamp of the most recent transition of id.

ua::WeakAddressSpace

class

A non-owning weak handle to an AddressSpace.

Holds a weak reference to the shared graph; lock() yields an owning AddressSpace if the graph is still alive. Use this to break ownership cycles and to safely reference an address space from async work.

Functions

WeakAddressSpace()=default

Constructs an empty handle that locks to nullopt.

WeakAddressSpace(const AddressSpace &addressSpace)

Constructs a weak handle referencing addressSpace.

  • addressSpace (const AddressSpace &) - Address space to observe; not kept alive by this handle.
optional< AddressSpace > lock() const

Attempts to obtain an owning handle to the referenced address space.

Returns: The AddressSpace if it is still alive, otherwise nullopt.

Enumerations

ua::NodeReleaseStatus

enum

A node's <ReleaseStatus> annotation.

  • Released - The node is released for production use.
  • Draft - The node is provisional; skipped by the default import filter.
  • Deprecated - The node is deprecated; skipped by the default import filter.

ua::instance_utils::ValueQualityPolicy

enum

Which layer reports a bad VALUE quality: the Result, or the DataValue inside it.

  • PreserveQuality - Two-layer, and the model the rest of the SDK and the documentation use: the read SUCCEEDS and the bad quality rides on DataValue::status().
  • FlattenBadQuality - Single-layer: a Bad-severity DataValue::status() is surfaced AS a bad Result carrying a BadVariableStatus ErrorDetail, and no DataValue is handed back.

ua::ReferenceHalves

enum

Which halves of a Reference an add, a removal or a Node deletion changes.

  • Both - The named half and the other half, on a target in this Server.
  • ThisHalfOnly - Only the named half.

Type aliases

ua::EffectivePermissionsResult

type alias

Result returned by Namespace::effective_permissions_async.

ua::EffectivePermissionsCallback

type alias
using EffectivePermissionsCallback = std::function< void(EffectivePermissionsResult)>;

Completion of Namespace::effective_permissions_async.

ua::MonitoringHandle

type alias
using MonitoringHandle = uint32_t;

Opaque handle that identifies one monitoring registration within a namespace.

ua::CallMethodCompleteCallback

type alias
using CallMethodCompleteCallback = std::function< void(CallResult)>;

The completion a Method call is answered through: by a method handler, a MethodCallSource's handler and MethodAccessor::call_async.

ua::NodeResult

type alias
using NodeResult = Result< shared_ptr< Node > >;

The outcome of looking one Node up, or of creating one: the Node its namespace hands out, or a bad StatusCode carrying any ErrorDetail (Bad_NodeIdUnknown for a NodeId the namespace does not hold).

Was this page helpful?