/* ======================================================================== * Copyright (c) 2005-2025 The OPC Foundation, Inc. All rights reserved. * * OPC Foundation MIT License 1.00 * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * The complete license agreement can be found here: * http://opcfoundation.org/License/MIT/1.00/ * ======================================================================*/ using System; using System.Collections.Generic; using System.Xml; using System.Xml.Serialization; namespace Opc.Ua.Schema.Model { public partial class Namespace : IEquatable { /// public override bool Equals(object? obj) { return obj is Namespace other && Equals(other); } /// public bool Equals(Namespace? other) { if (ReferenceEquals(this, other)) { return true; } return other is not null && Name == other.Name && Prefix == other.Prefix && InternalPrefix == other.InternalPrefix && XmlNamespace == other.XmlNamespace && XmlPrefix == other.XmlPrefix && FilePath == other.FilePath && Version == other.Version && PublicationDate == other.PublicationDate && Value == other.Value; } /// public override int GetHashCode() { var hash = new HashCode(); hash.Add(Name); hash.Add(Prefix); hash.Add(InternalPrefix); hash.Add(XmlNamespace); hash.Add(XmlPrefix); hash.Add(FilePath); hash.Add(Version); hash.Add(PublicationDate); hash.Add(Value); return hash.ToHashCode(); } /// public static bool operator ==(Namespace? left, Namespace? right) { return EqualityComparer.Default.Equals(left, right); } /// public static bool operator !=(Namespace? left, Namespace? right) { return !(left == right); } } public partial class ListOfChildren : IEquatable { /// public override bool Equals(object? obj) { return obj is ListOfChildren other && Equals(other); } /// public bool Equals(ListOfChildren? other) { if (ReferenceEquals(this, other)) { return true; } if (other is null) { return false; } if (other.Items is null || Items is null) { return other.Items == Items; } if (other.Items.Length != Items.Length) { return false; } // Only compare symbolicid to prevent circular loops for (int ii = 0; ii < Items.Length; ii++) { if (!XmlQualifiedNameEqualityComparer.Default.Equals( Items[ii].SymbolicId, other.Items[ii].SymbolicId)) { return false; } } return true; } /// public override int GetHashCode() { if (Items is null || Items.Length == 0) { return 0; } var hash = new HashCode(); foreach (InstanceDesign child in Items) { hash.Add(XmlQualifiedNameEqualityComparer.Default.GetHashCode(child.SymbolicId)); } return hash.ToHashCode(); } /// public static bool operator ==(ListOfChildren? left, ListOfChildren? right) { return EqualityComparer.Default.Equals(left, right); } /// public static bool operator !=(ListOfChildren? left, ListOfChildren? right) { return !(left == right); } } public partial class RolePermissionSet : IEquatable { /// public override bool Equals(object? obj) { return obj is RolePermissionSet other && Equals(other); } /// public bool Equals(RolePermissionSet? other) { if (ReferenceEquals(this, other)) { return true; } return other is not null && ArrayEqualityComparer.Default.Equals(RolePermission, other.RolePermission) && Name == other.Name && DoNotInheirit == other.DoNotInheirit; } /// public override int GetHashCode() { var hash = new HashCode(); hash.Add(RolePermission, ArrayEqualityComparer.Default); hash.Add(Name); hash.Add(DoNotInheirit); return hash.ToHashCode(); } /// public static bool operator ==(RolePermissionSet? left, RolePermissionSet? right) { return EqualityComparer.Default.Equals(left, right); } /// public static bool operator !=(RolePermissionSet? left, RolePermissionSet? right) { return !(left == right); } } public partial class RolePermission : IEquatable { /// public override bool Equals(object? obj) { return obj is RolePermission other && Equals(other); } /// public bool Equals(RolePermission? other) { if (ReferenceEquals(this, other)) { return true; } return other is not null && ArrayEqualityComparer.Default.Equals(Permission, other.Permission) && XmlQualifiedNameEqualityComparer.Default.Equals(Role, other.Role); } /// public override int GetHashCode() { var hash = new HashCode(); hash.Add(Permission, ArrayEqualityComparer.Default); hash.Add(Role, XmlQualifiedNameEqualityComparer.Default); return hash.ToHashCode(); } /// public static bool operator ==(RolePermission left, RolePermission right) { return EqualityComparer.Default.Equals(left, right); } /// public static bool operator !=(RolePermission left, RolePermission right) { return !(left == right); } } public partial class ReferenceTypeDesign : IEquatable { /// public override bool Equals(object? obj) { return obj is ReferenceTypeDesign other && Equals(other); } /// public bool Equals(ReferenceTypeDesign? other) { if (ReferenceEquals(this, other)) { return true; } return other is not null && base.Equals(other) && EqualityComparer.Default.Equals(InverseName, other.InverseName) && Symmetric == other.Symmetric && SymmetricSpecified == other.SymmetricSpecified; } /// public override int GetHashCode() { return HashCode.Combine(base.GetHashCode(), InverseName, Symmetric, SymmetricSpecified); } /// public static bool operator ==(ReferenceTypeDesign? left, ReferenceTypeDesign? right) { return EqualityComparer.Default.Equals(left, right); } /// public static bool operator !=(ReferenceTypeDesign? left, ReferenceTypeDesign? right) { return !(left == right); } } public partial class EncodingDesign : IEquatable { /// public bool Equals(EncodingDesign? other) { if (ReferenceEquals(this, other)) { return true; } return other is not null && base.Equals(other); } /// public override bool Equals(object? obj) { return obj is EncodingDesign other && base.Equals(other); } /// public override int GetHashCode() { return base.GetHashCode(); } } public partial class ObjectDesign : IEquatable { /// public override bool Equals(object? obj) { return obj is ObjectDesign other && Equals(other); } /// public bool Equals(ObjectDesign? other) { if (ReferenceEquals(this, other)) { return true; } return other is not null && base.Equals(other) && SupportsEvents == other.SupportsEvents && SupportsEventsSpecified == other.SupportsEventsSpecified; } /// public override int GetHashCode() { return HashCode.Combine(base.GetHashCode(), SupportsEvents, SupportsEventsSpecified); } /// public static bool operator ==(ObjectDesign? left, ObjectDesign? right) { return EqualityComparer.Default.Equals(left, right); } /// public static bool operator !=(ObjectDesign? left, ObjectDesign? right) { return !(left == right); } } public partial class ObjectTypeDesign : IEquatable { /// public override bool Equals(object? obj) { return obj is ObjectTypeDesign other && Equals(other); } /// public bool Equals(ObjectTypeDesign? other) { if (ReferenceEquals(this, other)) { return true; } return other is not null && base.Equals(other) && SupportsEvents == other.SupportsEvents && SupportsEventsSpecified == other.SupportsEventsSpecified; } /// public override int GetHashCode() { return HashCode.Combine(base.GetHashCode(), SupportsEvents, SupportsEventsSpecified); } /// public static bool operator ==(ObjectTypeDesign? left, ObjectTypeDesign? right) { return EqualityComparer.Default.Equals(left, right); } /// public static bool operator !=(ObjectTypeDesign? left, ObjectTypeDesign? right) { return !(left == right); } } public partial class DictionaryDesign : IEquatable { /// public override bool Equals(object? obj) { return obj is DictionaryDesign other && Equals(other); } /// public bool Equals(DictionaryDesign? other) { if (ReferenceEquals(this, other)) { return true; } return other is not null && base.Equals(other) && XmlQualifiedNameEqualityComparer.Default.Equals(EncodingName, other.EncodingName); } /// public override int GetHashCode() { var hash = new HashCode(); hash.Add(base.GetHashCode()); hash.Add(EncodingName, XmlQualifiedNameEqualityComparer.Default); return hash.ToHashCode(); } /// public static bool operator ==(DictionaryDesign left, DictionaryDesign right) { return EqualityComparer.Default.Equals(left, right); } /// public static bool operator !=(DictionaryDesign left, DictionaryDesign right) { return !(left == right); } } public partial class PropertyDesign : IEquatable { /// public bool Equals(PropertyDesign? other) { if (ReferenceEquals(this, other)) { return true; } return other is not null && base.Equals(other); } /// public override bool Equals(object? obj) { return obj is PropertyDesign other && Equals(other); } /// public override int GetHashCode() { return base.GetHashCode(); } } public partial class ViewDesign : IEquatable { /// public override bool Equals(object? obj) { return obj is ViewDesign other && Equals(other); } /// public bool Equals(ViewDesign? other) { if (ReferenceEquals(this, other)) { return true; } return other is not null && base.Equals(other) && SupportsEvents == other.SupportsEvents && ContainsNoLoops == other.ContainsNoLoops; } /// public override int GetHashCode() { return HashCode.Combine(base.GetHashCode(), SupportsEvents, ContainsNoLoops); } /// public static bool operator ==(ViewDesign left, ViewDesign? right) { return EqualityComparer.Default.Equals(left, right); } /// public static bool operator !=(ViewDesign left, ViewDesign right) { return !(left == right); } } public partial class ModelDesign : IEquatable { /// /// Namespace table /// [XmlIgnore] #pragma warning disable CA2235 // Mark all non-serializable fields public NamespaceTable NamespaceUris { get; set; } #pragma warning restore CA2235 // Mark all non-serializable fields /// /// Source file path /// [XmlIgnore] public string SourceFilePath { get; set; } /// /// Is source node set /// [XmlIgnore] public bool IsSourceNodeSet { get; set; } /// public override bool Equals(object? obj) { return obj is ModelDesign other && Equals(other); } /// public bool Equals(ModelDesign? design) { if (ReferenceEquals(this, design)) { return true; } return ArrayEqualityComparer.Default.Equals(Namespaces, design!.Namespaces) && ArrayEqualityComparer.Default.Equals(PermissionSets, design.PermissionSets) && ArrayEqualityComparer.Default.Equals(Items, design.Items) && XmlElementArrayStringEqualityComparer.Default.Equals(Extensions, design.Extensions) && TargetNamespace == design.TargetNamespace && TargetVersion == design.TargetVersion && TargetPublicationDate == design.TargetPublicationDate && TargetXmlNamespace == design.TargetXmlNamespace && DefaultLocale == design.DefaultLocale; } /// public override int GetHashCode() { var hash = new HashCode(); hash.Add(Namespaces, ArrayEqualityComparer.Default); hash.Add(PermissionSets, ArrayEqualityComparer.Default); hash.Add(Items, ArrayEqualityComparer.Default); hash.Add(Extensions, XmlElementArrayStringEqualityComparer.Default); hash.Add(TargetNamespace); hash.Add(TargetVersion); hash.Add(TargetPublicationDate); hash.Add(TargetXmlNamespace); hash.Add(DefaultLocale); return hash.ToHashCode(); } /// public static bool operator ==(ModelDesign left, ModelDesign? right) { return EqualityComparer.Default.Equals(left, right); } /// public static bool operator !=(ModelDesign left, ModelDesign? right) { return !(left == right); } } public partial class LocalizedText : IEquatable { /// /// Text is autogenerated /// [XmlIgnore] public bool IsAutogenerated { get; set; } /// public override bool Equals(object? obj) { return obj is LocalizedText other && Equals(other); } /// public bool Equals(LocalizedText? other) { if (ReferenceEquals(this, other)) { return true; } return other is not null && Key == other.Key && DoNotIgnore == other.DoNotIgnore && Value == other.Value && IsAutogenerated == other.IsAutogenerated; } /// public override int GetHashCode() { return HashCode.Combine(Key, DoNotIgnore, Value, IsAutogenerated); } /// public static bool operator ==(LocalizedText? left, LocalizedText? right) { return EqualityComparer.Default.Equals(left, right); } /// public static bool operator !=(LocalizedText? left, LocalizedText? right) { return !(left == right); } } /// /// Hierarchy node information /// public record class HierarchyNode { /// /// Relative path /// public string? RelativePath { get; set; } /// /// Instance /// public NodeDesign? Instance { get; set; } /// /// Overridden nodes /// public List? OverriddenNodes { get; set; } /// /// Explicitly defined /// public bool ExplicitlyDefined { get; set; } /// /// Ad hoc instance /// public bool AdHocInstance { get; set; } /// /// Static value /// public bool StaticValue { get; set; } /// /// Inherited /// public bool Inherited { get; set; } /// /// The modelling rule defined on the type definition for this node, /// before any instance-level overrides are applied. /// public ModellingRule? TypeDefinitionModellingRule { get; set; } /// /// Identifier /// public object? Identifier { get; set; } /// /// Returns the string representation of the object. /// public override string? ToString() { if (Instance != null && Instance.SymbolicId != null) { return CoreUtils.Format("{0}={1}", RelativePath, Instance.SymbolicId.Name); } return RelativePath; } } /// /// Reference between hierarchy nodes /// public record class HierarchyReference { /// /// Source path /// public string? SourcePath { get; set; } /// /// reference type /// public XmlQualifiedName? ReferenceType { get; set; } /// /// Is inverse /// public bool IsInverse { get; set; } /// /// Target path /// public string? TargetPath { get; set; } /// /// Target id /// public XmlQualifiedName? TargetId { get; set; } /// /// Declared on a type rather than on an instance or instance declaration. /// public bool DefinedOnType { get; set; } /// /// Returns the string representation of the object. /// public override string ToString() { if (TargetId != null) { return CoreUtils.Format("{0} => {1}", SourcePath, TargetId.Name); } return CoreUtils.Format("{0} => {1}", SourcePath, TargetPath); } } /// /// Hierarchy information for a type or instance. /// public record class Hierarchy { /// /// Type /// public TypeDesign? Type { get; set; } /// /// Nodes /// public Dictionary Nodes { get; } = []; /// /// Node list /// public List NodeList { get; } = []; /// /// References /// public List References { get; set; } = []; } /// /// A class that stores the model design for a Node. /// public partial class NodeDesign : IFormattable, IEquatable { /// /// Parent node /// [XmlIgnore] public NodeDesign? Parent { get; set; } /// /// Has children /// [XmlIgnore] public bool HasChildren { get; set; } /// /// Has references /// [XmlIgnore] public bool HasReferences { get; set; } /// /// Hierarchy /// [XmlIgnore] #pragma warning disable CA2235 // Mark all non-serializable fields public Hierarchy Hierarchy { get; set; } #pragma warning restore CA2235 // Mark all non-serializable fields /// /// Returns the string representation of the object. /// public override string ToString() { return ToString(null, null); } /// /// Returns the string representation of the object. /// /// public string ToString(string? format, IFormatProvider? formatProvider) { if (format == null) { if (SymbolicName != null) { return string.Format(formatProvider, "{0}", SymbolicName.Name); } return string.Format(formatProvider, "{0}", GetType().Name); } throw new FormatException(CoreUtils.Format("Invalid format string: '{0}'.", format)); } /// /// Create symbol /// public static string CreateSymbolicId(XmlQualifiedName? parentId, string childName) { if (parentId == null) { return childName; } return CreateSymbolicId(parentId.Name, childName); } /// /// Create symbol /// public static string CreateSymbolicId(string parentId, string childName) { if (string.IsNullOrEmpty(childName)) { return parentId; } if (string.IsNullOrEmpty(parentId)) { return childName; } return CoreUtils.Format("{0}{1}{2}", parentId, PathChar, childName); } /// public override bool Equals(object? obj) { return obj is NodeDesign other && Equals(other); } /// public bool Equals(NodeDesign? other) { if (ReferenceEquals(this, other)) { return true; } return other is not null && BrowseName == other.BrowseName && EqualityComparer.Default.Equals(DisplayName, other.DisplayName) && EqualityComparer.Default.Equals(Description, other.Description) && EqualityComparer.Default.Equals(Children, other.Children) && ArrayEqualityComparer.Default.Equals(References, other.References) && EqualityComparer.Default.Equals(RolePermissions, other.RolePermissions) && EqualityComparer.Default.Equals(DefaultRolePermissions, other.DefaultRolePermissions) && AccessRestrictions == other.AccessRestrictions && AccessRestrictionsSpecified == other.AccessRestrictionsSpecified && DefaultAccessRestrictions == other.DefaultAccessRestrictions && DefaultAccessRestrictionsSpecified == other.DefaultAccessRestrictionsSpecified && XmlElementArrayStringEqualityComparer.Default.Equals(Extensions, other.Extensions) && XmlQualifiedNameEqualityComparer.Default.Equals(SymbolicName, other.SymbolicName) && XmlQualifiedNameEqualityComparer.Default.Equals(SymbolicId, other.SymbolicId) && IsDeclaration == other.IsDeclaration && NumericId == other.NumericId && NumericIdSpecified == other.NumericIdSpecified && StringId == other.StringId && GuidId == other.GuidId && GuidIdSpecified == other.GuidIdSpecified && ArrayEqualityComparer.Default.Equals(OpaqueId, other.OpaqueId) && WriteAccess == other.WriteAccess && PartNo == other.PartNo && Category == other.Category && NotInAddressSpace == other.NotInAddressSpace && ReleaseStatus == other.ReleaseStatus && Purpose == other.Purpose && IsDynamic == other.IsDynamic; } /// public override int GetHashCode() { var hash = new HashCode(); hash.Add(BrowseName); hash.Add(DisplayName); hash.Add(Description); hash.Add(Children); hash.Add(References, ArrayEqualityComparer.Default); hash.Add(RolePermissions); hash.Add(DefaultRolePermissions); hash.Add(AccessRestrictions); hash.Add(AccessRestrictionsSpecified); hash.Add(DefaultAccessRestrictions); hash.Add(DefaultAccessRestrictionsSpecified); hash.Add(Extensions, XmlElementArrayStringEqualityComparer.Default); hash.Add(SymbolicName, XmlQualifiedNameEqualityComparer.Default); hash.Add(SymbolicId, XmlQualifiedNameEqualityComparer.Default); hash.Add(IsDeclaration); hash.Add(NumericId); hash.Add(NumericIdSpecified); hash.Add(StringId); hash.Add(GuidId); hash.Add(GuidIdSpecified); hash.Add(OpaqueId, ArrayEqualityComparer.Default); hash.Add(WriteAccess); hash.Add(PartNo); hash.Add(Category); hash.Add(NotInAddressSpace); hash.Add(ReleaseStatus); hash.Add(Purpose); hash.Add(IsDynamic); return hash.ToHashCode(); } /// /// Path character to use when constructing symbolic ids. /// public const char PathChar = '_'; /// /// Static array for splitting /// public static readonly char[] PathChars = [PathChar]; /// public static bool operator ==(NodeDesign? left, NodeDesign? right) { return EqualityComparer.Default.Equals(left, right); } /// public static bool operator !=(NodeDesign? left, NodeDesign? right) { return !(left == right); } } /// /// A class that stores the model design for a Variable. /// public partial class VariableDesign : IEquatable { /// /// Decoded value /// [XmlIgnore] public object? DecodedValue { get; set; } /// /// The namespace table the namespace indexes inside /// (NodeId, ExpandedNodeId, QualifiedName) /// refer to - the table of the NodeSet the value was read from. Null /// when the value was authored in a ModelDesign, whose indexes refer to /// the design's own namespaces (OPC UA first). /// [XmlIgnore] [field: NonSerialized] public NamespaceTable? DecodedValueNamespaceUris { get; set; } /// /// Data type node /// [XmlIgnore] public DataTypeDesign? DataTypeNode { get; set; } /// /// Whether the node was imported from a NodeSet2 that declares no /// Value for it. Its Value is then null (OPC 10000-6 F.5) rather than /// the default value of its DataType, which a ModelDesign implies. /// [XmlIgnore] public bool NodeSetValueIsNull { get; set; } /// /// The verbatim OPC UA AccessLevel bitmask imported from a /// NodeSet2 model. The ModelDesign /// enumeration cannot represent combinations such as /// CurrentRead | HistoryRead, so the raw bits are carried /// alongside it and preferred by code generation when present. /// [XmlIgnore] public uint? RawAccessLevel { get; set; } /// /// The verbatim OPC UA UserAccessLevel bitmask imported from a /// NodeSet2 model when the UserAccessLevel attribute is /// explicitly present. When null the UserAccessLevel is /// derived from the AccessLevel, matching the runtime importer. /// [XmlIgnore] public uint? RawUserAccessLevel { get; set; } /// public override bool Equals(object? obj) { return obj is VariableDesign other && Equals(other); } /// public bool Equals(VariableDesign? other) { if (ReferenceEquals(this, other)) { return true; } return other is not null && base.Equals(other) && XmlElementStringEqualityComparer.Default.Equals(DefaultValue, other.DefaultValue) && XmlQualifiedNameEqualityComparer.Default.Equals(DataType, other.DataType) && ValueRank == other.ValueRank && ArrayDimensions == other.ArrayDimensions && AccessLevel == other.AccessLevel && AccessLevelSpecified == other.AccessLevelSpecified && RawAccessLevel == other.RawAccessLevel && RawUserAccessLevel == other.RawUserAccessLevel && NodeSetValueIsNull == other.NodeSetValueIsNull && InstanceAccessLevel == other.InstanceAccessLevel && InstanceAccessLevelSpecified == other.InstanceAccessLevelSpecified && MinimumSamplingInterval == other.MinimumSamplingInterval && MinimumSamplingIntervalSpecified == other.MinimumSamplingIntervalSpecified && Historizing == other.Historizing && HistorizingSpecified == other.HistorizingSpecified; } /// public override int GetHashCode() { var hash = new HashCode(); hash.Add(base.GetHashCode()); hash.Add(DefaultValue, XmlElementStringEqualityComparer.Default); hash.Add(DataType, XmlQualifiedNameEqualityComparer.Default); hash.Add(ValueRank); hash.Add(ArrayDimensions); hash.Add(AccessLevel); hash.Add(AccessLevelSpecified); hash.Add(RawAccessLevel); hash.Add(RawUserAccessLevel); hash.Add(NodeSetValueIsNull); hash.Add(InstanceAccessLevel); hash.Add(InstanceAccessLevelSpecified); hash.Add(MinimumSamplingInterval); hash.Add(MinimumSamplingIntervalSpecified); hash.Add(Historizing); hash.Add(HistorizingSpecified); return hash.ToHashCode(); } /// public static bool operator ==(VariableDesign? left, VariableDesign? right) { return EqualityComparer.Default.Equals(left, right); } /// public static bool operator !=(VariableDesign? left, VariableDesign? right) { return !(left == right); } } /// /// A class that stores the model design for a VariableType. /// public partial class VariableTypeDesign : IEquatable { /// /// Decoded value /// [XmlIgnore] public object? DecodedValue { get; set; } /// /// The namespace table the namespace indexes inside /// refer to. See /// . /// [XmlIgnore] [field: NonSerialized] public NamespaceTable? DecodedValueNamespaceUris { get; set; } /// /// Data type node /// [XmlIgnore] public DataTypeDesign? DataTypeNode { get; set; } /// /// Whether the node was imported from a NodeSet2 that declares no /// Value for it. Its Value is then null (OPC 10000-6 F.5) rather than /// the default value of its DataType, which a ModelDesign implies. /// [XmlIgnore] public bool NodeSetValueIsNull { get; set; } /// public override bool Equals(object? obj) { return obj is VariableTypeDesign other && Equals(other); } /// public bool Equals(VariableTypeDesign? other) { if (ReferenceEquals(this, other)) { return true; } return other is not null && base.Equals(other) && XmlElementStringEqualityComparer.Default.Equals(DefaultValue, other.DefaultValue) && XmlQualifiedNameEqualityComparer.Default.Equals(DataType, other.DataType) && ValueRank == other.ValueRank && ValueRankSpecified == other.ValueRankSpecified && ArrayDimensions == other.ArrayDimensions && AccessLevel == other.AccessLevel && AccessLevelSpecified == other.AccessLevelSpecified && MinimumSamplingInterval == other.MinimumSamplingInterval && MinimumSamplingIntervalSpecified == other.MinimumSamplingIntervalSpecified && Historizing == other.Historizing && HistorizingSpecified == other.HistorizingSpecified && NodeSetValueIsNull == other.NodeSetValueIsNull && ExposesItsChildren == other.ExposesItsChildren; } /// public override int GetHashCode() { var hash = new HashCode(); hash.Add(base.GetHashCode()); hash.Add(DefaultValue, XmlElementStringEqualityComparer.Default); hash.Add(DataType, XmlQualifiedNameEqualityComparer.Default); hash.Add(ValueRank); hash.Add(ValueRankSpecified); hash.Add(ArrayDimensions); hash.Add(AccessLevel); hash.Add(AccessLevelSpecified); hash.Add(MinimumSamplingInterval); hash.Add(MinimumSamplingIntervalSpecified); hash.Add(Historizing); hash.Add(HistorizingSpecified); hash.Add(NodeSetValueIsNull); hash.Add(ExposesItsChildren); return hash.ToHashCode(); } /// public static bool operator ==(VariableTypeDesign? left, VariableTypeDesign? right) { return EqualityComparer.Default.Equals(left, right); } /// public static bool operator !=(VariableTypeDesign? left, VariableTypeDesign? right) { return !(left == right); } } /// /// A class that stores the model design for a Method. /// public partial class MethodDesign : IEquatable { /// /// Has arguments /// [XmlIgnore] public bool HasArguments { get; set; } /// /// Method type node /// [XmlIgnore] public MethodDesign? MethodType { get; set; } /// /// Method declaration node /// [XmlIgnore] public MethodDesign? MethodDeclarationNode { get; set; } /// public override bool Equals(object? obj) { return obj is MethodDesign other && Equals(other); } /// public bool Equals(MethodDesign? other) { if (ReferenceEquals(this, other)) { return true; } return other is not null && base.Equals(other) && ArrayEqualityComparer.Default.Equals(InputArguments, other.InputArguments) && ArrayEqualityComparer.Default.Equals(OutputArguments, other.OutputArguments) && NonExecutable == other.NonExecutable && NonExecutableSpecified == other.NonExecutableSpecified; } /// public override int GetHashCode() { var hash = new HashCode(); hash.Add(base.GetHashCode()); hash.Add(InputArguments, ArrayEqualityComparer.Default); hash.Add(OutputArguments, ArrayEqualityComparer.Default); hash.Add(NonExecutable); hash.Add(NonExecutableSpecified); return hash.ToHashCode(); } /// public static bool operator ==(MethodDesign? left, MethodDesign? right) { return EqualityComparer.Default.Equals(left, right); } /// public static bool operator !=(MethodDesign? left, MethodDesign? right) { return !(left == right); } } /// /// A class that stores the model design for a Type. /// public partial class TypeDesign : IEquatable { /// /// Base type node /// [XmlIgnore] public TypeDesign? BaseTypeNode { get; set; } /// /// True if the type is excluded from generation (for example a /// Draft type with the Draft exclusion), so no state class is /// emitted for it. Set by the validator. /// [XmlIgnore] public bool IsExcludedFromGeneration { get; set; } /// /// Deep copy the type design. /// /// public TypeDesign Copy() { return (TypeDesign)MemberwiseClone(); } /// public override bool Equals(object? obj) { return obj is TypeDesign other && Equals(other); } /// public bool Equals(TypeDesign? other) { if (ReferenceEquals(this, other)) { return true; } return other is not null && base.Equals(other) && ClassName == other.ClassName && XmlQualifiedNameEqualityComparer.Default.Equals(BaseType, other.BaseType) && IsAbstract == other.IsAbstract && NoClassGeneration == other.NoClassGeneration && EqualityComparer.Default.Equals(BaseTypeNode, other.BaseTypeNode); } /// public override int GetHashCode() { var hash = new HashCode(); hash.Add(base.GetHashCode()); hash.Add(ClassName); hash.Add(BaseType, XmlQualifiedNameEqualityComparer.Default); hash.Add(IsAbstract); hash.Add(NoClassGeneration); hash.Add(BaseTypeNode); return hash.ToHashCode(); } /// public static bool operator ==(TypeDesign? left, TypeDesign? right) { return EqualityComparer.Default.Equals(left, right); } /// public static bool operator !=(TypeDesign? left, TypeDesign? right) { return !(left == right); } } /// /// A class that stores the model design for a Type. /// public partial class InstanceDesign : IEquatable { /// /// Type definition node /// [XmlIgnore] public TypeDesign? TypeDefinitionNode { get; set; } /// /// Overidden node /// [XmlIgnore] public InstanceDesign? OveriddenNode { get; set; } /// /// Identifier required /// [XmlIgnore] public bool IdentifierRequired { get; set; } /// /// Deep copy the instance design. /// public InstanceDesign Copy() { return (InstanceDesign)MemberwiseClone(); } /// public override bool Equals(object? obj) { return obj is InstanceDesign other && Equals(other); } /// public bool Equals(InstanceDesign? other) { if (ReferenceEquals(this, other)) { return true; } return other is not null && base.Equals(other) && XmlQualifiedNameEqualityComparer.Default.Equals(ReferenceType, other.ReferenceType) && XmlQualifiedNameEqualityComparer.Default.Equals(Declaration, other.Declaration) && XmlQualifiedNameEqualityComparer.Default.Equals(TypeDefinition, other.TypeDefinition) && ModellingRule == other.ModellingRule && ModellingRuleSpecified == other.ModellingRuleSpecified && MinCardinality == other.MinCardinality && MaxCardinality == other.MaxCardinality && PreserveDefaultAttributes == other.PreserveDefaultAttributes && DesignToolOnly == other.DesignToolOnly && XmlQualifiedNameEqualityComparer.Default.Equals( TypeDefinitionNode?.SymbolicId, other.TypeDefinitionNode?.SymbolicId) && XmlQualifiedNameEqualityComparer.Default.Equals( OveriddenNode?.SymbolicId, other.OveriddenNode?.SymbolicId) && IdentifierRequired == other.IdentifierRequired; } /// public override int GetHashCode() { var hash = new HashCode(); hash.Add(base.GetHashCode()); hash.Add(ReferenceType, XmlQualifiedNameEqualityComparer.Default); hash.Add(Declaration, XmlQualifiedNameEqualityComparer.Default); hash.Add(TypeDefinition, XmlQualifiedNameEqualityComparer.Default); hash.Add(ModellingRule); hash.Add(ModellingRuleSpecified); hash.Add(MinCardinality); hash.Add(MaxCardinality); hash.Add(PreserveDefaultAttributes); hash.Add(DesignToolOnly); hash.Add(TypeDefinitionNode?.SymbolicId!, XmlQualifiedNameEqualityComparer.Default); hash.Add(OveriddenNode?.SymbolicId!, XmlQualifiedNameEqualityComparer.Default); hash.Add(IdentifierRequired); return hash.ToHashCode(); } /// public static bool operator ==(InstanceDesign? left, InstanceDesign? right) { return EqualityComparer.Default.Equals(left, right); } /// public static bool operator !=(InstanceDesign? left, InstanceDesign? right) { return !(left == right); } } /// /// A class that stores a reference between nodes. /// public partial class Reference : IEquatable { /// /// Source node /// [XmlIgnore] public NodeDesign SourceNode { get; set; } /// /// Source relative path /// [XmlIgnore] #pragma warning disable CA2235 // Mark all non-serializable fields public RelativePath SourceRelativePath { get; set; } #pragma warning restore CA2235 // Mark all non-serializable fields /// /// Target node /// [XmlIgnore] public NodeDesign TargetNode { get; set; } /// /// Target relative path /// [XmlIgnore] #pragma warning disable CA2235 // Mark all non-serializable fields public RelativePath TargetRelativePath { get; set; } #pragma warning restore CA2235 // Mark all non-serializable fields /// public override bool Equals(object? obj) { return obj is Reference other && Equals(other); } /// public bool Equals(Reference? other) { if (ReferenceEquals(this, other)) { return true; } return other is not null && XmlQualifiedNameEqualityComparer.Default.Equals(ReferenceType, other.ReferenceType) && XmlQualifiedNameEqualityComparer.Default.Equals(TargetId, other.TargetId) && IsInverse == other.IsInverse && IsOneWay == other.IsOneWay; } /// public override int GetHashCode() { var hash = new HashCode(); hash.Add(ReferenceType, XmlQualifiedNameEqualityComparer.Default); hash.Add(TargetId, XmlQualifiedNameEqualityComparer.Default); hash.Add(IsInverse); hash.Add(IsOneWay); return hash.ToHashCode(); } /// public static bool operator ==(Reference left, Reference? right) { return EqualityComparer.Default.Equals(left, right); } /// public static bool operator !=(Reference left, Reference right) { return !(left == right); } } /// /// A class that stores a parameter for a node. /// public partial class Parameter : IEquatable { /// /// Parent node /// [XmlIgnore] public NodeDesign Parent { get; set; } /// /// Data type node /// [XmlIgnore] public DataTypeDesign? DataTypeNode { get; set; } /// /// Identifier is in name /// [XmlIgnore] public bool IdentifierInName { get; set; } /// /// Is inherited /// [XmlIgnore] public bool IsInherited { get; set; } /// /// The bit position an OptionSet field names (the EnumField Value, /// OPC 10000-3 8.52), when known as a position rather than through /// the mask. A subtype of the OptionSet /// structure (8.40) has no upper bit, while the decimal Identifier /// only holds masks up to bit 95; for a higher bit the Identifier /// is 0 and this carries the bit. Read the bit with /// . /// [XmlIgnore] public int? OptionSetBit { get; set; } /// public override bool Equals(object? obj) { return obj is Parameter other && Equals(other); } /// public bool Equals(Parameter? other) { if (ReferenceEquals(this, other)) { return true; } return other is not null && EqualityComparer.Default.Equals(Description, other.Description) && EqualityComparer.Default.Equals(DefaultValue, other.DefaultValue) && EqualityComparer.Default.Equals(DisplayName, other.DisplayName) && Name == other.Name && Identifier == other.Identifier && IdentifierSpecified == other.IdentifierSpecified && BitMask == other.BitMask && OptionSetBit == other.OptionSetBit && XmlQualifiedNameEqualityComparer.Default.Equals(DataType, other.DataType) && ValueRank == other.ValueRank && ArrayDimensions == other.ArrayDimensions && AllowSubTypes == other.AllowSubTypes && IsOptional == other.IsOptional && ReleaseStatus == other.ReleaseStatus; } /// public override int GetHashCode() { var hash = new HashCode(); hash.Add(Description); hash.Add(DefaultValue); hash.Add(DisplayName); hash.Add(Name); hash.Add(Identifier); hash.Add(IdentifierSpecified); hash.Add(BitMask); hash.Add(OptionSetBit); hash.Add(DataType, XmlQualifiedNameEqualityComparer.Default); hash.Add(ValueRank); hash.Add(ArrayDimensions); hash.Add(AllowSubTypes); hash.Add(IsOptional); hash.Add(ReleaseStatus); return hash.ToHashCode(); } /// public static bool operator ==(Parameter? left, Parameter? right) { return EqualityComparer.Default.Equals(left, right); } /// public static bool operator !=(Parameter? left, Parameter? right) { return !(left == right); } } /// /// The set of basic data types /// public enum BasicDataType { /// /// Boolean data type /// Boolean, /// /// Signed byte data type /// SByte, /// /// Unsigned byte data type /// Byte, /// /// 16-bit signed integer data type /// Int16, /// /// 16-bit unsigned integer data type /// UInt16, /// /// 32-bit signed integer data type /// Int32, /// /// 32-bit unsigned integer data type /// UInt32, /// /// 64-bit signed integer data type /// Int64, /// /// 64-bit unsigned integer data type /// UInt64, /// /// Single-precision floating point data type /// Float, /// /// Double-precision floating point data type /// Double, /// /// String data type /// String, /// /// DateTime data type /// DateTime, /// /// Globally unique identifier data type /// Guid, /// /// Byte string data type /// ByteString, /// /// XML element data type /// XmlElement, /// /// Node identifier data type /// NodeId, /// /// Expanded node identifier data type /// ExpandedNodeId, /// /// Status code data type /// StatusCode, /// /// Diagnostic information data type /// DiagnosticInfo, /// /// Qualified name data type /// QualifiedName, /// /// Localized text data type /// LocalizedText, /// /// Data value data type /// DataValue, /// /// Numeric data type /// Number, /// /// Integer data type /// Integer, /// /// Unsigned integer data type /// UInteger, /// /// Enumeration data type /// Enumeration, /// /// Structure data type /// Structure, /// /// Base data type /// BaseDataType, /// /// User-defined data type /// UserDefined } /// /// A class that stores the model design for a DataType. /// public partial class DataTypeDesign : IEquatable { /// /// Has encodings /// [XmlIgnore] public bool HasEncodings { get; set; } /// /// Has fields /// [XmlIgnore] public bool HasFields { get; set; } /// /// Is structure /// [XmlIgnore] public bool IsStructure { get; set; } /// /// Is enumeration /// [XmlIgnore] public bool IsEnumeration { get; set; } /// /// Name of the service the data type belongs to /// [XmlIgnore] public Service Service { get; set; } /// /// Is service response type /// [XmlIgnore] public bool IsServiceResponse { get; set; } /// /// Built in data type /// [XmlIgnore] public BasicDataType BasicDataType { get; set; } /// public override bool Equals(object? obj) { return obj is DataTypeDesign other && Equals(other); } /// public bool Equals(DataTypeDesign? other) { if (ReferenceEquals(this, other)) { return true; } return other is not null && base.Equals(other) && ArrayEqualityComparer.Default.Equals(Fields, other.Fields) && ArrayEqualityComparer.Default.Equals(Encodings, other.Encodings) && IsOptionSet == other.IsOptionSet && IsUnion == other.IsUnion && NoArraysAllowed == other.NoArraysAllowed && ForceEnumValues == other.ForceEnumValues && NoEncodings == other.NoEncodings && IsServiceResponse == other.IsServiceResponse && Service == other.Service; } /// public override int GetHashCode() { var hash = new HashCode(); hash.Add(base.GetHashCode()); hash.Add(Fields, ArrayEqualityComparer.Default); hash.Add(Encodings, ArrayEqualityComparer.Default); hash.Add(IsOptionSet); hash.Add(IsUnion); hash.Add(NoArraysAllowed); hash.Add(ForceEnumValues); hash.Add(NoEncodings); hash.Add(Service); hash.Add(IsServiceResponse); return hash.ToHashCode(); } /// public static bool operator ==(DataTypeDesign? left, DataTypeDesign? right) { return EqualityComparer.Default.Equals(left, right); } /// public static bool operator !=(DataTypeDesign? left, DataTypeDesign? right) { return !(left == right); } } /// /// Service descriptor /// [Serializable] public sealed class Service : IEquatable { /// /// Service category of the service the data type belongs to /// [XmlIgnore] public ServiceCategory Category { get; init; } /// /// Name of the service the data type belongs to /// [XmlIgnore] public string? Name { get; init; } /// /// Service request data type /// [XmlIgnore] public DataTypeDesign? Request { get; set; } /// /// Service response data type /// [XmlIgnore] public DataTypeDesign? Response { get; set; } /// public override bool Equals(object? obj) { return obj is Service other && Equals(other); } /// public bool Equals(Service? other) { if (ReferenceEquals(this, other)) { return true; } return other is not null && Category == other.Category && Name == other.Name; } /// public override int GetHashCode() { return HashCode.Combine(Category, Name); } /// public static bool operator ==(Service left, Service? right) { return EqualityComparer.Default.Equals(left, right); } /// public static bool operator !=(Service left, Service? right) { return !(left == right); } } /// /// Service /// public enum ServiceCategory { /// /// Not part of a service /// None, /// /// Session /// Session, /// /// Secure channel /// SecureChannel, /// /// Discovery /// Discovery, /// /// Registration /// Registration, /// /// Attribute service set (Read, Write, HistoryRead, HistoryUpdate) /// Attribute, /// /// View service set (Browse, BrowseNext, TranslateBrowsePathsToNodeIds, RegisterNodes, UnregisterNodes) /// View, /// /// Method service set (Call) /// Method, /// /// MonitoredItem service set (CreateMonitoredItems, ModifyMonitoredItems, SetMonitoringMode, SetTriggering, DeleteMonitoredItems) /// MonitoredItem, /// /// Subscription service set (CreateSubscription, ModifySubscription, SetPublishingMode, Publish, Republish, TransferSubscriptions, DeleteSubscriptions) /// Subscription, /// /// Node management service set (AddNodes, AddReferences, DeleteNodes, DeleteReferences) /// NodeManagement, /// /// Query service set (QueryFirst, QueryNext) /// Query, /// /// Test /// Test } /// /// Core standard versions /// public enum SpecificationVersion { /// /// Version 1.03 /// V103 = 103, /// /// Version 1.04 /// V104 = 104, /// /// Version 1.05 /// V105 = 105 } }