Exemple #1
0
        internal UAReferenceContext(Reference reference, IAddressSpaceBuildContext addressSpaceContext, IUANodeContext parentNode)
        {
            IUANodeContext targetNode = addressSpaceContext.GetOrCreateNodeContext(NodeId.Parse(reference.Value), parentNode.CreateUANodeContext);

            this.m_AddressSpace = addressSpaceContext;
            this.ParentNode     = parentNode;
            this.SourceNode     = reference.IsForward ? parentNode : targetNode;
            this.Reference      = reference;
            this.TargetNode     = reference.IsForward ? targetNode : parentNode;
            this.TypeNode       = addressSpaceContext.GetOrCreateNodeContext(NodeId.Parse(reference.ReferenceType), parentNode.CreateUANodeContext);
        }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UAModelContext" /> class.
 /// </summary>
 /// <param name="model">The imported OPC UA address space model represented by the instance of <see cref="UANodeSet"/>.</param>
 /// <param name="addressSpaceContext">The address space context represented by an instance of <see cref="IAddressSpaceBuildContext"/>.</param>
 /// <exception cref="ArgumentNullException">addressSpaceContext
 /// or
 /// model.Aliases
 /// </exception>
 internal UAModelContext(UANodeSet model, IAddressSpaceBuildContext addressSpaceContext)
 {
     AddressSpaceContext = addressSpaceContext ?? throw new ArgumentNullException(nameof(addressSpaceContext));
     if (model is null)
     {
         throw new ArgumentNullException(nameof(model));
     }
     AddNamespaceUriTable(model.NamespaceUris);
     AddAliases(model.Aliases);
     model.NamespaceUris = model.NamespaceUris ?? new string[] { };
 }
Exemple #3
0
        internal static UAReferenceContext NewReferenceStub
            (Reference reference, IAddressSpaceBuildContext addressSpaceContext, IUAModelContext modelContext, IUANodeContext parentNode, Action <TraceMessage> traceEvent)
        {
            IUANodeContext     targetNode = modelContext.GetOrCreateNodeContext(reference.Value, true);
            UAReferenceContext _stb       = new UAReferenceContext()
            {
                m_Context  = addressSpaceContext,
                ParentNode = parentNode,
                SourceNode = reference.IsForward ? parentNode : targetNode,
                ModelNode  = reference,
                TargetNode = reference.IsForward ? targetNode : parentNode,
                TypeNode   = modelContext.GetOrCreateNodeContext(reference.ReferenceType, true),
            };

            if (_stb.TypeNode != null && _stb.TypeNode.NodeIdContext.NamespaceIndex == 0)
            {
                _stb.ReferenceKind = _stb.GetReferenceKind(_stb.TypeNode);
            }
            return(_stb);
        }
Exemple #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UANodeContext" /> class.
 /// </summary>
 /// <param name="nodeId">An object of <see cref="NodeId" /> that stores an identifier for a node in a server's address space.</param>
 /// <param name="addressSpaceContext">The address space context.</param>
 internal UANodeContext(NodeId nodeId, IAddressSpaceBuildContext addressSpaceContext)
 {
     NodeIdContext = nodeId;
     this.m_AddressSpaceContext = addressSpaceContext;
 }
Exemple #5
0
 public Validator(IAddressSpaceBuildContext addressSpace)
 {
     AS = addressSpace;
 }
Exemple #6
0
 internal static void GetParameters(this XML.DataTypeDefinition dataTypeDefinition, IDataTypeDefinitionFactory dataTypeDefinitionFactory, IAddressSpaceBuildContext nodeContext, Action <TraceMessage> traceEvent)
 {
     if (dataTypeDefinition is null)
     {
         return;
     }
     //xsd comment  < !--BaseType is obsolete and no longer used.Left in for backwards compatibility. -->
     //definition.BaseType = modelContext.ExportBrowseName(dataTypeDefinition.BaseType, DataTypes.BaseDataType);
     dataTypeDefinitionFactory.IsOptionSet  = dataTypeDefinition.IsOptionSet;
     dataTypeDefinitionFactory.IsUnion      = dataTypeDefinition.IsUnion;
     dataTypeDefinitionFactory.Name         = null; //TODO UADataType.Definition.Name wrong value #341 modelContext.ExportBrowseName( dataTypeDefinition.Name, DataTypes.BaseDataType);
     dataTypeDefinitionFactory.SymbolicName = dataTypeDefinition.SymbolicName;
     if (dataTypeDefinition.Field == null || dataTypeDefinition.Field.Length == 0)
     {
         return;
     }
     foreach (XML.DataTypeField _item in dataTypeDefinition.Field)
     {
         IDataTypeFieldFactory _nP = dataTypeDefinitionFactory.NewField();
         _nP.Name         = _item.Name;
         _nP.SymbolicName = _item.SymbolicName;
         _item.DisplayName.ExportLocalizedTextArray(_nP.AddDisplayName);
         _nP.DataType        = nodeContext.ExportBrowseName(NodeId.Parse(_item.DataType), DataTypes.BaseDataType);
         _nP.ValueRank       = _item.ValueRank.GetValueRank(traceEvent);
         _nP.ArrayDimensions = _item.ArrayDimensions;
         _nP.MaxStringLength = _item.MaxStringLength;
         _item.Description.ExportLocalizedTextArray(_nP.AddDescription);
         _nP.Value      = _item.Value;
         _nP.IsOptional = _item.IsOptional;
     }
 }
Exemple #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UANodeContext" /> class.
 /// </summary>
 /// <param name="addressSpaceContext">The address space context.</param>
 /// <param name="modelContext">The model context.</param>
 /// <param name="nodeId">An object of <see cref="NodeId"/> that stores an identifier for a node in a server's address space.</param>
 internal UANodeContext(IAddressSpaceBuildContext addressSpaceContext, IUAModelContext modelContext, NodeId nodeId)
 {
     this.m_AddressSpaceContext = addressSpaceContext;
     this.NodeIdContext         = nodeId;
     this.UAModelContext        = modelContext;
 }