Example #1
0
 public CustomerQueue() : base()   //Для того, чтобы расширить конструктор CustomCollection
 {
     structure_Tail = null;
     Spaces         = new int[5] {
         200, 260, 320, 380, 440
     };
 }
Example #2
0
            protected void Add(object Data)
            {
                NodeClass Money = new NodeClass(Data, structure_Head);

                structure_Head = Money;
                structure_Count++;
            }
Example #3
0
 public FormNodeClass(NodeClass nodeClass = null)
 {
     InitializeComponent();
     Icon = Util.GetWinformICon();
     SelectedNodeClass = nodeClass ?? new NodeClass();
     ;
 }
        /// <summary>
        /// Creates a new node that is "default" for given class. For "directive" the default value is TerminalDirective, for "boolean" the default is BoolConstant with value "false", and for numeric the default is "NumericConstant" with value 0.
        /// If NodeCreationConstrains are given, then other result might be returned. E.g. if the constrains forbid constants, it will return input-reading-node instead of a constant one, etc.
        /// </summary>
        /// <param name="cl"></param>
        /// <returns></returns>
        public static Node createDefaultNode(NodeClass cl, NodeCreationConstrains constrains = null)
        {
            switch (cl)
            {
            case NodeClass.directive:
                return(new directiveTerminal());

            case NodeClass.numeric:
                if (constrains?.Contains(NodeCreationContrainsOption.cantBeConstant) == true)
                {
                    return(new InputNode(0));
                }
                return(new NumericConstant(0));

            case NodeClass.boolean:
                if (constrains?.Contains(NodeCreationContrainsOption.cantBeConstant) == true)
                {
                    return(new BoolEqualsOperator(new InputNode(0), new NumericConstant(0)));
                }
                return(new BoolConstant(false));

            default:
                throw new Exception();
            }
        }
Example #5
0
 public Customer ReturnHead(bool Referal)
 {
     if (Referal)
     {
         return((Customer)structure_Head.GetData());
     }
     if (structure_Head != null)
     {
         NodeClass Temp = structure_Head;
         if (structure_Head.node_NextNode != null)
         {
             structure_Head = structure_Head.node_NextNode;
         }
         else
         {
             structure_Head = null;
         }
         structure_Count--;
         return((Customer)Temp.GetData());
     }
     else
     {
         return(null);
     }
 }
Example #6
0
        /// <summary>
        /// Throws an exception if the flter cannot be used with the node class.
        /// </summary>
        private void ValidateFilter(NodeClass nodeClass, MonitoringFilter filter)
        {
            if (filter == null)
            {
                return;
            }

            switch (nodeClass)
            {
            case NodeClass.Variable:
            case NodeClass.VariableType: {
                if (!typeof(DataChangeFilter).IsInstanceOfType(filter))
                {
                    m_nodeClass = NodeClass.Variable;
                }

                break;
            }

            case NodeClass.Object:
            case NodeClass.View: {
                if (!typeof(EventFilter).IsInstanceOfType(filter))
                {
                    m_nodeClass = NodeClass.Object;
                }

                break;
            }

            default: {
                throw ServiceResultException.Create(StatusCodes.BadFilterNotAllowed,
                                                    "Filters may not be specified for nodes of class '{0}'.", nodeClass);
            }
            }
        }
Example #7
0
        internal static string ToSerializedValue(this NodeClass value)
        {
            switch (value)
            {
            case NodeClass.Object:
                return("Object");

            case NodeClass.Variable:
                return("Variable");

            case NodeClass.Method:
                return("Method");

            case NodeClass.ObjectType:
                return("ObjectType");

            case NodeClass.VariableType:
                return("VariableType");

            case NodeClass.ReferenceType:
                return("ReferenceType");

            case NodeClass.DataType:
                return("DataType");

            case NodeClass.View:
                return("View");
            }
            return(null);
        }
Example #8
0
 private void TryAccesNode(int _ID)
 {
     for (int i = 0; i < NodeManager._nodes; i++)                          //Check all nodes in NodeManager...
     {
         if (NodeManager.Nodes[i].ID == _ID)                               // If we found the ID we are looking for...
         {
             bool setNode = false;                                         //Create a bool that will allow us to set the node we want if the is is in the list of available.
             //print("ID: " + _ID);
             for (int p = 0; p < NodeManager.currentNode.Port.Length; p++) //Check all ids in the port.
             {
                 //print("PORT[i]: " + NodeManager.currentNode.Port[p]);
                 if (_ID == NodeManager.currentNode.Port[p]) //If we found the ID(input by player) in the list of available:
                 {
                     setNode = true;                         //set the bool to true.
                 }
             }
             if (setNode)
             {
                 tryingNode = NodeManager.Nodes[i]; tryingNode.mySprite.GetComponent <Image>().color = Color.yellow;
             }                                                                                                                   //if we are allowed to change the node, change it
             else
             {
                 DisplayError(0); print("EXIT1"); return;
             }                                                 // if the ID entered by the player hasn't been found, we are not allowed to set the trying node.
         }
     }
     if (tryingNode != null && tryingNode.Unlocked)
     {
         AccessComplete(tryingNode);
     }
     else
     {
         AccessDenied(_ID);
     }
 }
Example #9
0
        /// <summary>
        /// Returns to display icon for the target of a reference.
        /// </summary>
        public static string GetTargetIcon(Session session, NodeClass nodeClass, ExpandedNodeId typeDefinitionId)
        {
            // make sure the type definition is in the cache.
            INode typeDefinition = session.NodeCache.Find(typeDefinitionId);

            switch (nodeClass)
            {
            case NodeClass.Object:
            {
                if (session.TypeTree.IsTypeOf(typeDefinitionId, ObjectTypes.FolderType))
                {
                    return("Folder");
                }

                return("Object");
            }

            case NodeClass.Variable:
            {
                if (session.TypeTree.IsTypeOf(typeDefinitionId, VariableTypes.PropertyType))
                {
                    return("Property");
                }

                return("Variable");
            }
            }

            return(nodeClass.ToString());
        }
Example #10
0
 /// <summary>
 /// Validate attributes for nodeclass
 /// </summary>
 /// <param name="nodeClass"></param>
 /// <param name="attributeId"></param>
 /// <returns></returns>
 public void Validate(NodeClass nodeClass, uint attributeId)
 {
     if (attributeId > 32 || _map[NodeClassId(nodeClass), attributeId] == null)
     {
         throw new ServiceResultException(StatusCodes.BadNodeAttributesInvalid);
     }
 }
    //This is the ManhattanDistance formula that used in the most case of AStar Pathfinding
    private int GetManhattanDistance(NodeClass nodeClassA, NodeClass nodeClassB)
    {
        int ix = Mathf.Abs(nodeClassA.xGridPos - nodeClassB.xGridPos); //x1-x2
        int iy = Mathf.Abs(nodeClassA.yGridPos - nodeClassB.yGridPos); //y1-y2

        return(ix + iy);                                               //Return the sum
    }
Example #12
0
    private void AccessComplete(NodeClass newCurrent)
    {
        if (tryingNode.ID == NodeManager.currentNode.ID)
        {
            myInput.text = "current/info/" + NodeManager.currentNode.ID + " <This is the current node>";
            newLine(true);
        }
        else
        {
            if (oldLR != null)
            {
                oldLR.endColor = Color.cyan;
            }
            NodeManager.currentNode.mySprite.GetComponent <Image>().color = Color.cyan;
            Vector3 oldPos = NodeManager.currentNode.mySprite.gameObject.transform.position; //for Line Renderer
            Bitcoins += 30;
            NodeManager.currentNode = newCurrent;
            NodeManager.currentNode.mySprite.transform.GetComponentInChildren <Text>().text = NodeManager.currentNode.ID.ToString("[0000]");
            myInput.text = "current/info/" + NodeManager.currentNode.ID + " <Access completed>";
            newLine(true);
            NodeManager.currentNode.mySprite.GetComponent <Image>().color = Color.green;
            Vector3 newPos = NodeManager.currentNode.mySprite.gameObject.transform.position; //for Line Renderer

            player.teclar_anim();
            RuskyAudio.Play();

            LineRenderer newLR = Instantiate(LRenderPref).GetComponent <LineRenderer>();
            oldPos.z = 2.4f;
            newPos.z = 2.4f;
            newLR.SetPosition(0, oldPos);
            newLR.SetPosition(1, newPos);
            oldLR = newLR;
        }
    }
Example #13
0
 public EdgeDescription(string platformNodeId, string displayName, NodeClass nodeClass, NodeId referenceTypeId)
 {
     PlatformNodeId  = platformNodeId;
     DisplayName     = displayName;
     NodeClass       = nodeClass;
     ReferenceTypeId = referenceTypeId;
 }
Example #14
0
    public void AddTetra(GameObject node)
    {
        GameObject child = new GameObject();

        child.transform.parent = node.transform;
        child.AddComponent <MeshFilter> ();

        NodeClass cs   = node.GetComponent <NodeClass> ();
        Mesh      mesh = new Mesh();

        mesh.Clear();
        Vector3[] points = new Vector3[4];
        points [0] = cs.pointA;
        points [1] = cs.pointB;
        points [2] = cs.pointC;
        points [3] = cs.pointD;
        // make changes to the Mesh by creating arrays which contain the new values
        mesh.vertices  = points;
        mesh.triangles = new int[] {
            0, 1, 2,
            0, 2, 3,
            2, 1, 3,
            0, 3, 1
        };
        node.GetComponent <NodeClass>().draw    = true;
        child.GetComponent <MeshFilter> ().mesh = mesh;
        Fusion();
    }
Example #15
0
        /// <summary>
        /// Convert nodeclass to index
        /// </summary>
        /// <param name="nodeClass"></param>
        /// <returns></returns>
        private int NodeClassId(NodeClass nodeClass)
        {
            switch (nodeClass)
            {
            case NodeClass.Object:
                return(Object);

            case NodeClass.Variable:
                return(Variable);

            case NodeClass.Method:
                return(Method);

            case NodeClass.ObjectType:
                return(ObjectType);

            case NodeClass.VariableType:
                return(VariableType);

            case NodeClass.ReferenceType:
                return(ReferenceType);

            case NodeClass.DataType:
                return(DataType);

            case NodeClass.View:
                return(View);
            }
            throw new ServiceResultException(StatusCodes.BadNodeClassInvalid);
        }
        /// <inheritdoc/>
        public override int GetHashCode()
        {
            var hashCode = 2038336081;

            hashCode = hashCode *
                       -1521134295 + Handle.GetHashSafe();
            hashCode = hashCode *
                       -1521134295 + SymbolicName.GetHashSafe();
            hashCode = hashCode *
                       -1521134295 + NodeId.GetHashSafe();
            hashCode = hashCode *
                       -1521134295 + NodeClass.GetHashCode();
            hashCode = hashCode *
                       -1521134295 + BrowseName.GetHashSafe();
            hashCode = hashCode *
                       -1521134295 + DisplayName.GetHashSafe();
            hashCode = hashCode *
                       -1521134295 + Description.GetHashSafe();
            hashCode = hashCode *
                       -1521134295 + WriteMask.GetHashSafe();
            hashCode = hashCode *
                       -1521134295 + UserWriteMask.GetHashSafe();
            hashCode = hashCode *
                       -1521134295 + AccessRestrictions.GetHashSafe();
            hashCode = hashCode *
                       -1521134295 + RolePermissions.GetHashSafe();
            hashCode = hashCode *
                       -1521134295 + UserRolePermissions.GetHashSafe();
            return(hashCode);
        }
Example #17
0
 /// <summary>
 /// Constructor
 /// </summary>
 public NodeAttributeSet(ExpandedNodeId nodeId, NodeClass nodeClass,
                         QualifiedName browseName) :
     this(nodeId, new NamespaceTable())
 {
     NodeClass  = nodeClass;
     BrowseName = browseName;
 }
        protected static IEnumerable <Node> generateLeafNodes(NodeClass c, NodeTypeFrequencyProfile profile)
        {
            Node n = null;

            switch (c)
            {
            case NodeClass.directive:
                n = new directiveTerminal();
                yield return(n);

                break;

            case NodeClass.numeric:
                for (int i = 0; i < 2; i++)
                {
                    n = new NumericConstant(i);
                    yield return(n);
                }
                break;

            case NodeClass.boolean:
                yield return(new BoolConstant(false));

                yield return(new BoolConstant(true));

                break;

            default:
                break;
            }
        }
Example #19
0
        /// <summary>
        /// Sets the nodes in the control.
        /// </summary>
        public void Initialize(Session session, NodeIdCollection nodeIds, NodeClass nodeClassMask)
        {
            if (session == null)
            {
                throw new ArgumentNullException("session");
            }

            Clear();

            m_session       = session;
            m_nodeIds       = nodeIds;
            m_nodeClassMask = (nodeClassMask == 0)?(NodeClass)Byte.MaxValue:nodeClassMask;

            if (nodeIds == null)
            {
                return;
            }

            foreach (NodeId nodeId in nodeIds)
            {
                INode node = m_session.NodeCache.Find(nodeId);

                if (node != null && (m_nodeClassMask & node.NodeClass) != 0)
                {
                    AddItem(node, "Property", -1);
                }
            }

            AdjustColumns();
        }
 /// <summary>
 /// Sets the value for a child. Adds it if it does not already exist.
 /// </summary>
 /// <param name="browseName">The BrowseName.</param>
 /// <param name="nodeClass">The node class.</param>
 /// <param name="value">The value.</param>
 public void SetChildValue(
     QualifiedName browseName,
     NodeClass nodeClass,
     object value)
 {
     SetChildValue(m_snapshot, browseName, nodeClass, value);
 }
    void CreateGrid()
    {
        _nodesClass = new NodeClass[xNodes, yNodes];
        Vector3 bottomLeft  = transform.position - Vector3.right * gridSize.x / 2 - Vector3.forward * gridSize.y / 2;
        Vector3 upperLeft   = transform.position + Vector3.left * gridSize.x / 2 + Vector3.forward * gridSize.y / 2 * -1;
        Vector3 bottomRight = transform.position - Vector3.left * gridSize.x / 2 - Vector3.forward * gridSize.y / 2;
        Vector3 upperRight  = transform.position - Vector3.left * gridSize.x / 2 + Vector3.forward * gridSize.y / 2;


        for (int x = 0; x < xNodes; x++)
        {
            for (int y = 0; y < yNodes; y++)
            {
                //To create nodes from left upper/bottom to right
                // Vector3 worldPoint = bottomLeft/upperLeft + Vector3.right * (x * nodeDiameterSize + nodeRadiusSize) + Vector3.forward * (y * nodeDiameterSize + nodeRadiusSize);

                //If you want create nodes from bottomRight to left
                // Vector3 worldPoint = bottomRight - Vector3.right * (x * nodeDiameterSize + nodeRadiusSize) + Vector3.forward * (y * nodeDiameterSize + nodeRadiusSize);

                //Else if you want create nodes from upperRight to left
                // Vector3 worldPoint = upperRight - Vector3.right * (x * nodeDiameterSize + nodeRadiusSize) - Vector3.forward * (y * nodeDiameterSize + nodeRadiusSize);

                Vector3 worldPoint = bottomLeft + Vector3.right * (x * nodeDiameterSize + nodeRadiusSize) + Vector3.forward * (y * nodeDiameterSize + nodeRadiusSize);

                bool wall = !Physics.CheckSphere(worldPoint, nodeRadiusSize, wallMask);

                _nodesClass[x, y] = new NodeClass(wall, worldPoint, x, y);
            }
        }
    }
Example #22
0
    void FindPath(Vector3 startPos, Vector3 targetPos)
    {
        NodeClass startNode = grid.nodeFromWorldPoint(startPos);
        NodeClass targeNode = grid.nodeFromWorldPoint(targetPos);

        List <NodeClass> openSet = new List <NodeClass>();
    }
Example #23
0
 /// <summary>
 /// Sets the value for a child. Adds it if it does not already exist.
 /// </summary>
 /// <param name="browseName">The BrowseName.</param>
 /// <param name="nodeClass">The node class.</param>
 /// <param name="value">The value.</param>
 public void SetChildValue(
     QualifiedName browseName,
     NodeClass nodeClass,
     object value)
 {
     SetChildValue(m_snapshot, browseName, nodeClass, value);
 }
Example #24
0
        /// <summary>
        /// Sets the nodes in the control.
        /// </summary>
        public void Initialize(Session session, NodeIdCollection nodeIds, NodeClass nodeClassMask)
        {
            if (session == null) throw new ArgumentNullException("session");
            
            Clear();
            
            m_session       = session;
            m_nodeIds       = nodeIds;
            m_nodeClassMask = (nodeClassMask == 0)?(NodeClass)Byte.MaxValue:nodeClassMask;

            if (nodeIds == null)
            {
                return;                
            }

            foreach (NodeId nodeId in nodeIds)
            {
                INode node = m_session.NodeCache.Find(nodeId);

                if (node != null && (m_nodeClassMask & node.NodeClass) != 0)
                {
                    AddItem(node, "Property", -1);
                }
            }

            AdjustColumns();
        }
Example #25
0
    //public GameObject[] nodesPosition;

    void Awake()
    {
        //maxNodes = (int)(gridDimesion.z * gridDimesion.x);
        xwidth  = (int)gridDimesion.x / ((int)nodeSize.x + (int)nodeGap);
        yheight = (int)gridDimesion.z / ((int)nodeSize.z + (int)nodeGap);
        nodes   = new NodeClass[xwidth, yheight];
        Vector3 auxPosition = new Vector3(0, 0, 0);

        auxPosition.y = transform.position.y;
        for (int i = 0; i < xwidth; i++)
        {
            auxPosition.x = transform.position.x - (gridDimesion.x / 2) + ((nodeSize.x + nodeGap) * i);
            for (int j = 0; j < yheight; j++)
            {
                auxPosition.z        = transform.position.z - (gridDimesion.z / 2) + ((nodeSize.z + nodeGap) * j);
                nodes[i, j]          = new NodeClass();
                nodes[i, j].posMod   = auxPosition;
                nodes[i, j].gridPosX = i;
                nodes[i, j].gridPosY = j;
                //nodes[i,j].Obstructed = false;
                //nodes[i,j].Value = 1;
                nodes[i, j].sizeMod = nodeSize;
            }
        }
    }
        private void TreeNodeRender(TreeNode treeNode, XElement element)
        {
            foreach (XElement item in element.Elements( ))
            {
                if (item.Name == "NodeClass")
                {
                    TreeNode node = new TreeNode(item.Attribute("Name").Value);
                    node.ImageKey         = "usbcontroller";
                    node.SelectedImageKey = "usbcontroller";

                    NodeClass nodeClass = new NodeClass( );
                    nodeClass.LoadByXmlElement(item);
                    node.Tag = nodeClass;
                    treeNode.Nodes.Add(node);

                    TreeNodeRender(node, item);
                }
                else if (item.Name == "RegularNode")
                {
                    TreeNode node = new TreeNode(item.Attribute("Name").Value);
                    node.ImageKey         = "Operator_660";
                    node.SelectedImageKey = "Operator_660";


                    RegularNode regularNode = new RegularNode( );
                    regularNode.LoadByXmlElement(item);
                    node.Tag = regularNode;
                    treeNode.Nodes.Add(node);
                }
            }
        }
Example #27
0
        /// <summary>
        /// Convert node class
        /// </summary>
        /// <param name="nodeClass"></param>
        /// <returns></returns>
        public static UaNodeClass ToStackType(this NodeClass nodeClass)
        {
            switch (nodeClass)
            {
            case NodeClass.Object:
                return(UaNodeClass.Object);

            case NodeClass.ObjectType:
                return(UaNodeClass.ObjectType);

            case NodeClass.Variable:
                return(UaNodeClass.Variable);

            case NodeClass.VariableType:
                return(UaNodeClass.VariableType);

            case NodeClass.Method:
                return(UaNodeClass.Method);

            case NodeClass.DataType:
                return(UaNodeClass.DataType);

            case NodeClass.ReferenceType:
                return(UaNodeClass.ReferenceType);

            case NodeClass.View:
                return(UaNodeClass.View);

            default:
                return(UaNodeClass.Unspecified);
            }
        }
Example #28
0
    public List <NodeClass> ChartRoute(Vector3 orig, Vector3 dest)
    {
        float nodoDest = (existingNodes[0].posMod - dest).magnitude;
        float nodoOrig = (existingNodes[0].posMod - orig).magnitude;
        int   indexD   = 0;
        int   indexO   = 0;

        for (int i = 0; i < existingNodes.Count; i++)
        {
            if ((existingNodes[i].posMod - dest).magnitude < nodoDest)
            {
                nodoDest = (existingNodes[i].posMod - dest).magnitude;
                indexD   = i;
            }
            if ((existingNodes[i].posMod - orig).magnitude < nodoOrig)
            {
                nodoOrig = (existingNodes[i].posMod - orig).magnitude;
                indexO   = i;
            }
        }
        NodeClass origin    = existingNodes[indexO];
        NodeClass objective = existingNodes[indexD];

        openNodes.Add(origin);
        origin.isOpenMod = true;
        origin.Parent    = null;

        while (openNodes.Count > 0)
        {
            NodeClass nodo = SelectNodes();
            if (nodo == null)
            {
                Debug.Log("NODO VACIO");
            }
            if (nodo == objective)
            {
                CleanUp();
                return(ChartList(nodo));
            }
            closedNodes.Add(nodo);
            openNodes.Remove(nodo);
            for (int i = 0; i < nodo.adyacentNodesMod.Count; i++)
            {
                if (nodo.adyacentNodesMod.Count <= 0)
                {
                    Debug.Log("EMPTY NODO");
                }
                if (!nodo.adyacentNodesMod[i].isOpenMod)
                {
                    openNodes.Add(nodo.adyacentNodesMod[i]);
                    nodo.adyacentNodesMod[i].Parent    = nodo;
                    nodo.adyacentNodesMod[i].isOpenMod = true;
                }
            }
        }
        CleanUp();
        return(null);
    }
Example #29
0
 private static void WriteNodes()
 {
     Console.WriteLine("Nodes:");
     for (var i = 0; i < Nodes.Count; ++i)
     {
         NodeClass nodeModel = Nodes.ElementAt(i);
         Console.WriteLine($"{(i + 1).ToString()}. {nodeModel.Name}({nodeModel.ManagingPort})");
     }
 }
Example #30
0
 /// <summary>
 /// Initializes the instance with its defalt attribute values.
 /// </summary>
 protected InstanceNodeModel(NodeClass nodeClass, BaseNodeModel parent) :
     base(nodeClass)
 {
     Parent = parent;
     if (Parent != null)
     {
         ReferenceTypeId = ReferenceTypeIds.HasComponent;
     }
 }
 /// <summary>
 /// Initializes the instance with its default attribute values.
 /// </summary>
 protected BaseInstanceState(NodeState parent, NodeClass nodeClass, QualifiedName browseName) : base(nodeClass, browseName)
 {
     if (parent == null)
     {
         return;
     }
     Parent = (BaseInstanceState)parent;
     Parent.AddChild(this);
 }
Example #32
0
 public NodeClass(int x, int y, float h, float g, NodeClass parent, Vector3 worldPos)
 {
     this.xAxis        = x;
     this.yAxis        = y;
     this.hCost        = h;
     this.gCost        = g;
     this.parent       = parent;
     this.worldPostion = worldPos;
 }
Example #33
0
        /// <summary>
        /// Displays the dialog.
        /// </summary>
        public NodeIdCollection ShowDialog(
            Session          session, 
            BrowseViewType   browseView, 
            NodeIdCollection nodesIds,
            NodeClass        nodeClassMask)
        {
            if (session == null) throw new ArgumentNullException("session");

            m_session = session;

            BrowseCTRL.SetView(session, browseView, null);
            NodeListCTRL.Initialize(session, nodesIds, nodeClassMask);
            
            if (ShowDialog() != DialogResult.OK)
            {
                return null;
            }
                        
            return NodeListCTRL.GetNodeIds();
        }
        /// <summary>
        /// Throws an exception if the flter cannot be used with the node class.
        /// </summary>
        private void ValidateFilter(NodeClass nodeClass, MonitoringFilter filter)
        {
            if (filter == null)
            {
                return;
            }

            switch (nodeClass)
            {
                case NodeClass.Variable:
                case NodeClass.VariableType:
                {
                    if (!typeof(DataChangeFilter).IsInstanceOfType(filter))
                    {
                        m_nodeClass = NodeClass.Variable;
                    }

                    break;
                }

                case NodeClass.Object:
                case NodeClass.View:
                {
                    if (!typeof(EventFilter).IsInstanceOfType(filter))
                    {                        
                        m_nodeClass = NodeClass.Object;
                    }

                    break;
                }

                default:
                {
                    throw ServiceResultException.Create(StatusCodes.BadFilterNotAllowed, "Filters may not be specified for nodes of class '{0}'.", nodeClass);
                }
            }
        }
Example #35
0
 public void AddToQueue()
 {
     NodeClass Cust = new NodeClass(new Customer(), null);
     structure_Count++;
     if (structure_Head == null)
     {
       structure_Head = Cust;
       structure_Tail = Cust;
     }
     else
     {
       structure_Tail.node_NextNode = Cust;
       structure_Tail = Cust;
     }
 }
Example #36
0
 /// <summary>
 /// Initializes the type with its defalt attribute values.
 /// </summary>
 protected BaseTypeState(NodeClass nodeClass) : base(nodeClass)
 {
     m_isAbstract = false;
 }
        /// <summary>
        /// Sets the target attributes for the reference.
        /// </summary>
        public void SetTargetAttributes(
            BrowseResultMask resultMask,
            NodeClass        nodeClass,
            QualifiedName    browseName,
            LocalizedText    displayName,
            ExpandedNodeId   typeDefinition)
        {
            if ((resultMask & BrowseResultMask.NodeClass) != 0)
            {
                m_nodeClass = nodeClass;
            }
            else
            {
                m_nodeClass = 0;
            }

            if ((resultMask & BrowseResultMask.BrowseName) != 0)
            {
                m_browseName = browseName;
            }
            else
            {
                m_browseName = null;
            }

            if ((resultMask & BrowseResultMask.DisplayName) != 0)
            {
                m_displayName = displayName;
            }
            else
            {
                m_displayName = null;
            }

            if ((resultMask & BrowseResultMask.TypeDefinition) != 0)
            {
                m_typeDefinition = typeDefinition;
            }
            else
            {
                m_typeDefinition = null;
            }
        }
Example #38
0
        /// <summary>
        /// Creates a browse description for a node class test.
        /// </summary>
        private void AddNodeClassTest(
            Node node, 
            NodeClass nodeClassMask,            
            List<Node> nodes,
            BrowseDescriptionCollection nodesToBrowse, 
            List<ReferenceDescriptionCollection> references,
            bool clearLists)
        {
            if (clearLists)
            {
                nodes.Clear();
                nodesToBrowse.Clear();
                references.Clear();
            }

            nodes.Add(node);

            BrowseDescription nodeToBrowse = new BrowseDescription();

            nodeToBrowse.NodeId = node.NodeId;
            nodeToBrowse.ReferenceTypeId = ReferenceTypeIds.References;
            nodeToBrowse.IncludeSubtypes = true;
            nodeToBrowse.BrowseDirection = BrowseDirection.Both;
            nodeToBrowse.NodeClassMask = (uint)nodeClassMask;
            nodeToBrowse.ResultMask = (uint)(BrowseResultMask.DisplayName | BrowseResultMask.NodeClass | BrowseResultMask.ReferenceTypeId | BrowseResultMask.IsForward);

            nodesToBrowse.Add(nodeToBrowse);

            references.Add(new ReferenceDescriptionCollection());
        }
Example #39
0
        /// <summary>
        /// Updates the browse element with the properties return in the read results.
        /// </summary>
        /// <param name="typeTree">The type tree.</param>
        /// <param name="element">The element.</param>
        /// <param name="nodesToRead">The nodes to read.</param>
        /// <param name="values">The values.</param>        
        /// <param name="nodeClass">The node class - passed only if all of the information in the ReferenceDescription is available.</param>
        /// <param name="onlyEssentialProperties">If true the only properties essential for browing were fetched.</param>
        /// <param name="first">The first.</param>
        /// <returns></returns>
        private bool UpdateBrowseElement(
            ITypeTable typeTree,
            BrowseElement element,
            ReadValueIdCollection nodesToRead,
            DataValueCollection values,
            NodeClass nodeClass,
            bool onlyEssentialProperties,
            int first)
        {
            // check for a valid range within the collection.
            if (first < 0 || first >= nodesToRead.Count)
            {
                return false;
            }

            if (nodeClass == NodeClass.Unspecified)
            {
                // verify node class.
                NodeClass actualNodeClass = (NodeClass)values[first++].GetValue<int>((int)NodeClass.Unspecified);

                if (actualNodeClass != NodeClass.Variable && actualNodeClass != NodeClass.Object)
                {
                    return false;
                }

                element.NodeClass = actualNodeClass;

                // verify browse name.
                QualifiedName browseName = values[first++].GetValue<QualifiedName>(null);

                if (QualifiedName.IsNull(browseName))
                {
                    return false;
                }

                element.BrowseName = element.UaBrowseName = m_mapper.GetLocalBrowseName(browseName);

                // verify display name.
                LocalizedText displayName = values[first++].GetValue<LocalizedText>(null);

                if (LocalizedText.IsNullOrEmpty(displayName))
                {
                    return false;
                }

                element.BrowseName = displayName.Text;
            }

            if (!onlyEssentialProperties)
            {
                // check if long description exists.
                LocalizedText description = values[first++].GetValue<LocalizedText>(null);

                if (!LocalizedText.IsNullOrEmpty(description))
                {
                    element.UaDescription = description.Text;
                }
                else
                {
                    element.UaDescription = "";
                }
            }

            // update the masks.
            SetElementMasks(element);

            // nothing more to do.
            if (nodeClass == NodeClass.Object)
            {
                return true;
            }

            // verify data type.
            NodeId dataTypeId = values[first++].GetValue<NodeId>(null);

            if (dataTypeId == null && element.NodeClass == NodeClass.Variable)
            {
                return false;
            }

            int valueRank = values[first++].GetValue<int>(ValueRanks.Scalar);

            // update data type information.
            if (dataTypeId != null)
            {
                element.BuiltInType = DataTypes.GetBuiltInType(dataTypeId, typeTree);
                element.DataTypeId = m_mapper.GetLocalItemId(dataTypeId);
                element.ValueRank = valueRank;
                element.CanonicalDataType = (short)ComUtils.GetVarType(new TypeInfo(element.BuiltInType, element.ValueRank));
            }

            if (!onlyEssentialProperties)
            {
                // update scan rate.
                element.ScanRate = (float)values[first++].GetValue<double>(MinimumSamplingIntervals.Indeterminate);

                // update access rights.
                byte userAccessLevel = values[first++].GetValue<byte>(0);

                if ((userAccessLevel & AccessLevels.CurrentRead) != 0)
                {
                    element.AccessRights |= OpcRcw.Da.Constants.OPC_READABLE;
                }

                if ((userAccessLevel & AccessLevels.CurrentWrite) != 0)
                {
                    element.AccessRights |= OpcRcw.Da.Constants.OPC_WRITEABLE;
                }

                if ((userAccessLevel & AccessLevels.HistoryRead) != 0)
                {
                    element.IsHistoricalItem = true;
                }

                // cache the latest value.
                DataValue value = values[first++];

                if (element.NodeClass == NodeClass.Variable)
                {
                    element.LastValue = m_mapper.GetLocalDataValue(value);
                }

                // update HighEU and LowEU
                element.EuType = (int)OpcRcw.Da.OPCEUTYPE.OPC_NOENUM;
                element.HighEU = Double.MaxValue;
                element.LowEU = Double.MaxValue;

                if (element.ReferencesByName.ContainsKey(Opc.Ua.BrowseNames.EURange))
                {
                    Range euRange = values[first++].GetValue<Range>(null);

                    if (euRange != null)
                    {
                        element.EuType = (int)OpcRcw.Da.OPCEUTYPE.OPC_ANALOG;
                        element.HighEU = euRange.High;
                        element.LowEU = euRange.Low;
                    }
                }

                // update HighIR and LowIR
                element.HighIR = Double.MaxValue;
                element.LowIR = Double.MaxValue;

                if (element.ReferencesByName.ContainsKey(Opc.Ua.BrowseNames.InstrumentRange))
                {
                    Range instrumentRange = values[first++].GetValue<Range>(null);

                    if (instrumentRange != null)
                    {
                        element.HighIR = instrumentRange.High;
                        element.LowIR = instrumentRange.Low;
                    }
                }

                // update EngineeringUnits
                element.EngineeringUnits = null;

                if (element.ReferencesByName.ContainsKey(Opc.Ua.BrowseNames.EngineeringUnits))
                {
                    EUInformation engineeringUnits = values[first++].GetValue<EUInformation>(null);

                    if (engineeringUnits != null && engineeringUnits.DisplayName != null)
                    {
                        element.EngineeringUnits = engineeringUnits.DisplayName.Text;
                    }
                }

                // update EUInfo
                element.EuInfo = null;

                if (element.ReferencesByName.ContainsKey(Opc.Ua.BrowseNames.EnumStrings))
                {
                    LocalizedText[] enumStrings = values[first++].GetValue<LocalizedText[]>(null);

                    if (enumStrings != null)
                    {
                        string[] strings = new string[enumStrings.Length];

                        for (int ii = 0; ii < enumStrings.Length; ii++)
                        {
                            if (enumStrings[ii] != null)
                            {
                                strings[ii] = enumStrings[ii].Text;
                            }
                        }

                        element.EuType = (int)OpcRcw.Da.OPCEUTYPE.OPC_ENUMERATED;
                        element.EuInfo = strings;
                    }
                }

                // update CloseLabel
                element.CloseLabel = null;

                if (element.ReferencesByName.ContainsKey(Opc.Ua.BrowseNames.TrueState))
                {
                    LocalizedText trueState = values[first++].GetValue<LocalizedText>(null);

                    if (trueState != null)
                    {
                        element.CloseLabel = trueState.Text;
                    }
                }

                // update OpenLabel
                element.OpenLabel = null;

                if (element.ReferencesByName.ContainsKey(Opc.Ua.BrowseNames.FalseState))
                {
                    LocalizedText falseState = values[first++].GetValue<LocalizedText>(null);

                    if (falseState != null)
                    {
                        element.OpenLabel = falseState.Text;
                    }
                }

                // update TimeZone
                element.TimeZone = Int32.MaxValue;

                if (element.ReferencesByName.ContainsKey(Opc.Ua.BrowseNames.LocalTime))
                {
                    TimeZoneDataType timeZone = values[first++].GetValue<TimeZoneDataType>(null);

                    if (timeZone != null)
                    {
                        element.TimeZone = timeZone.Offset;
                    }
                }
            }

            return true;
        }
        public virtual void Decode(IDecoder decoder) {
            decoder.PushNamespace("http://opcfoundation.org/UA/2008/02/Types.xsd");
			SourceNodeId = decoder.ReadNodeId("SourceNodeId");
			ReferenceTypeId = decoder.ReadNodeId("ReferenceTypeId");
			IsForward = decoder.ReadBoolean("IsForward");
			TargetServerUri = decoder.ReadString("TargetServerUri");
			TargetNodeId = decoder.ReadExpandedNodeId("TargetNodeId");
			TargetNodeClass = decoder.ReadEnumeration<NodeClass>("TargetNodeClass");
            decoder.PopNamespace();
        }
Example #41
0
		/// <summary>
		/// Returns the ids for all attributes which are valid for the at least one of the node classes specified by the mask.
		/// </summary>
        public static ListOfUInt32 GetIdentifiers(NodeClass nodeClass)
        {
			FieldInfo[] fields = typeof(Attributes).GetFields(BindingFlags.Public | BindingFlags.Static);
            
            ListOfUInt32 ids = new ListOfUInt32();
            
			foreach (FieldInfo field in fields)
			{
                uint id = (uint)field.GetValue(typeof(Attributes));

                if (IsValid(nodeClass, id))
                {
                    ids.Add(id);
                }
			}

			return ids;
        }
Example #42
0
 public NodeClass(object Data, NodeClass Next)
 {
     node_Data = Data;
       node_NextNode = Next;
 }
Example #43
0
 protected void Add(object Data)
 {
     NodeClass Money = new NodeClass(Data, structure_Head);
     structure_Head = Money;
     structure_Count++;
 }
Example #44
0
 public void AddToQueue(NodeClass Node)
 {
     structure_Count++;
     if (IsEmpty())
     {
       structure_Head = Node;
       structure_Tail = Node;
     }
     else
     {
       structure_Tail.node_NextNode = Node;
       structure_Tail = Node;
     }
 }
Example #45
0
 protected CustomCollection()
 {
     structure_Head = null;
     structure_Count = 0;
 }
Example #46
0
 //Для того, чтобы расширить конструктор CustomCollection
 public CustomerQueue()
     : base()
 {
     structure_Tail = null;
     Spaces = new int[5] { 200, 260, 320, 380, 440 };
 }
 /// <summary>
 /// Initializes the instance with its defalt attribute values.
 /// </summary>
 protected BaseInstanceState(NodeClass nodeClass, NodeState parent) : base(nodeClass)
 {
     m_parent = parent;
 }
        /// <summary>
        /// Sets the value for a child. Adds it if it does not already exist.
        /// </summary>
        /// <param name="node">The node.</param>
        /// <param name="browseName">The BrowseName.</param>
        /// <param name="nodeClass">The node class.</param>
        /// <param name="value">The value.</param>
        private void SetChildValue(
            ChildNode node,
            QualifiedName browseName,
            NodeClass nodeClass,
            object value)
        {
            ChildNode child = null;

            if (node.Children != null)
            {
                for (int ii = 0; ii < node.Children.Count; ii++)
                {
                    child = node.Children[ii];

                    if (child.BrowseName == browseName)
                    {
                        break;
                    }

                    child = null;
                }
            }
            else
            {
                node.Children = new List<ChildNode>();
            }

            if (child == null)
            {
                child = new ChildNode();
                node.Children.Add(child);
            }

            child.BrowseName = browseName;
            child.NodeClass = nodeClass;
            child.Value = value;
        }
Example #49
0
        /// <summary>
        /// Prepares a read request for the browse element properties.
        /// </summary>
        /// <param name="nodeId">The node id.</param>
        /// <param name="childrenByName">The children indexed by name.</param>
        /// <param name="nodesToRead">The nodes to read.</param>
        /// <param name="nodeClass">The node class - passed only if all of the information in the ReferenceDescription is available.</param>
        /// <param name="onlyEssentialProperties">If true the only properties essential for browing will be fetched.</param>
        /// <returns></returns>
        private int PrepareBrowseElementReadRequest(
            NodeId nodeId,
            Dictionary<string, ReferenceDescription> childrenByName,
            ReadValueIdCollection nodesToRead,
            NodeClass nodeClass,
            bool onlyEssentialProperties)
        {
            int index = nodesToRead.Count;

            ReadValueId nodeToRead = new ReadValueId();

            if (nodeClass == NodeClass.Unspecified)
            {
                nodeToRead.NodeId = nodeId;
                nodeToRead.AttributeId = Attributes.NodeClass;
                nodesToRead.Add(nodeToRead);

                nodeToRead = new ReadValueId();
                nodeToRead.NodeId = nodeId;
                nodeToRead.AttributeId = Attributes.BrowseName;
                nodesToRead.Add(nodeToRead);

                nodeToRead = new ReadValueId();
                nodeToRead.NodeId = nodeId;
                nodeToRead.AttributeId = Attributes.DisplayName;
                nodesToRead.Add(nodeToRead);
            }

            if (!onlyEssentialProperties)
            {
                nodeToRead = new ReadValueId();
                nodeToRead.NodeId = nodeId;
                nodeToRead.AttributeId = Attributes.Description;
                nodesToRead.Add(nodeToRead);
            }

            // nothing more to fetch for objects.
            if (nodeClass == NodeClass.Object)
            {
                return index;
            }

            nodeToRead = new ReadValueId();
            nodeToRead.NodeId = nodeId;
            nodeToRead.AttributeId = Attributes.DataType;
            nodesToRead.Add(nodeToRead);

            nodeToRead = new ReadValueId();
            nodeToRead.NodeId = nodeId;
            nodeToRead.AttributeId = Attributes.ValueRank;
            nodesToRead.Add(nodeToRead);

            if (!onlyEssentialProperties)
            {
                nodeToRead = new ReadValueId();
                nodeToRead.NodeId = nodeId;
                nodeToRead.AttributeId = Attributes.MinimumSamplingInterval;
                nodesToRead.Add(nodeToRead);

                nodeToRead = new ReadValueId();
                nodeToRead.NodeId = nodeId;
                nodeToRead.AttributeId = Attributes.UserAccessLevel;
                nodesToRead.Add(nodeToRead);

                nodeToRead = new ReadValueId();
                nodeToRead.NodeId = nodeId;
                nodeToRead.AttributeId = Attributes.Value;
                nodesToRead.Add(nodeToRead);

                ReferenceDescription property = null;

                if (childrenByName.TryGetValue(Opc.Ua.BrowseNames.EURange, out property))
                {
                    nodeToRead = new ReadValueId();
                    nodeToRead.NodeId = (NodeId)property.NodeId;
                    nodeToRead.AttributeId = Attributes.Value;
                    nodeToRead.Handle = Opc.Ua.BrowseNames.EURange;
                    nodesToRead.Add(nodeToRead);
                }

                if (childrenByName.TryGetValue(Opc.Ua.BrowseNames.InstrumentRange, out property))
                {
                    nodeToRead = new ReadValueId();
                    nodeToRead.NodeId = (NodeId)property.NodeId;
                    nodeToRead.AttributeId = Attributes.Value;
                    nodeToRead.Handle = Opc.Ua.BrowseNames.InstrumentRange;
                    nodesToRead.Add(nodeToRead);
                }

                if (childrenByName.TryGetValue(Opc.Ua.BrowseNames.EngineeringUnits, out property))
                {
                    nodeToRead = new ReadValueId();
                    nodeToRead.NodeId = (NodeId)property.NodeId;
                    nodeToRead.AttributeId = Attributes.Value;
                    nodeToRead.Handle = Opc.Ua.BrowseNames.EngineeringUnits;
                    nodesToRead.Add(nodeToRead);
                }

                if (childrenByName.TryGetValue(Opc.Ua.BrowseNames.EnumStrings, out property))
                {
                    nodeToRead = new ReadValueId();
                    nodeToRead.NodeId = (NodeId)property.NodeId;
                    nodeToRead.AttributeId = Attributes.Value;
                    nodeToRead.Handle = Opc.Ua.BrowseNames.EnumStrings;
                    nodesToRead.Add(nodeToRead);
                }

                if (childrenByName.TryGetValue(Opc.Ua.BrowseNames.TrueState, out property))
                {
                    nodeToRead = new ReadValueId();
                    nodeToRead.NodeId = (NodeId)property.NodeId;
                    nodeToRead.AttributeId = Attributes.Value;
                    nodeToRead.Handle = Opc.Ua.BrowseNames.TrueState;
                    nodesToRead.Add(nodeToRead);
                }

                if (childrenByName.TryGetValue(Opc.Ua.BrowseNames.FalseState, out property))
                {
                    nodeToRead = new ReadValueId();
                    nodeToRead.NodeId = (NodeId)property.NodeId;
                    nodeToRead.AttributeId = Attributes.Value;
                    nodeToRead.Handle = Opc.Ua.BrowseNames.FalseState;
                    nodesToRead.Add(nodeToRead);
                }

                if (childrenByName.TryGetValue(Opc.Ua.BrowseNames.LocalTime, out property))
                {
                    nodeToRead = new ReadValueId();
                    nodeToRead.NodeId = (NodeId)property.NodeId;
                    nodeToRead.AttributeId = Attributes.Value;
                    nodeToRead.Handle = Opc.Ua.BrowseNames.LocalTime;
                    nodesToRead.Add(nodeToRead);
                }
            }

            return index;
        }
Example #50
0
        /// <summary>
        /// Updates the reference description with the node attributes.
        /// </summary>
        private bool UpdateReferenceDescription(
            OperationContext     context,
            NodeId               targetId,
            NodeClass            nodeClassMask,
            BrowseResultMask     resultMask,
            ReferenceDescription description)
        {
            if (targetId == null)    throw new ArgumentNullException("targetId");
            if (description == null) throw new ArgumentNullException("description");
                        
            // find node manager that owns the node.
            INodeManager nodeManager = null;                
            object handle = GetManagerHandle(targetId, out nodeManager);

            // dangling reference - nothing more to do.
            if (handle == null)
            {
                return false;
            }

            // fetch the node attributes.
            NodeMetadata metadata = nodeManager.GetNodeMetadata(context, handle, resultMask);

            if (metadata == null)
            {
                return false;
            }

            // check nodeclass filter.
            if (nodeClassMask != NodeClass.Unspecified && (metadata.NodeClass & nodeClassMask) == 0)
            {
                return false;
            }

            // update attributes.
            description.NodeId = metadata.NodeId;
            
            description.SetTargetAttributes(
                resultMask,
                metadata.NodeClass,
                metadata.BrowseName,
                metadata.DisplayName,
                metadata.TypeDefinition);

            description.Unfiltered = false;

            return true;
        }        
        /// <summary>
        /// Returns true if the node class matches the node class mask.
        /// </summary>
        public static bool CheckNodeClassMask(uint nodeClassMask, NodeClass nodeClass)
        {
            if (nodeClassMask != 0)
            {
                return ((uint)nodeClass & nodeClassMask) != 0;
            }

            return true;
        }
        /// <summary>
        /// Verifies that the source and the target meet the restrictions imposed by the reference type.
        /// </summary>
        private void ValidateReference(
            ILocalNode source,
            NodeId     referenceTypeId,
            bool       isInverse,
            NodeClass  targetNodeClass)
        {
            // find reference type.
            IReferenceType referenceType = GetLocalNode(referenceTypeId) as IReferenceType;

            if (referenceType == null)
            {
                throw ServiceResultException.Create(StatusCodes.BadReferenceTypeIdInvalid, "Reference type '{0}' does not exist.", referenceTypeId);
            }

            // swap the source and target for inverse references.
            NodeClass sourceNodeClass = source.NodeClass;

            if (isInverse)
            {
                sourceNodeClass = targetNodeClass;
                targetNodeClass = source.NodeClass;
            }

            // check HasComponent references.
            if (m_server.TypeTree.IsTypeOf(referenceTypeId, ReferenceTypeIds.HasComponent))
            {
                if ((sourceNodeClass & (NodeClass.Object | NodeClass.Variable | NodeClass.ObjectType | NodeClass.VariableType)) == 0)
                {
                    throw ServiceResultException.Create(StatusCodes.BadReferenceNotAllowed, "Source node cannot be used with HasComponent references.");
                }

                if ((targetNodeClass & (NodeClass.Object | NodeClass.Variable | NodeClass.Method)) == 0)
                {
                    throw ServiceResultException.Create(StatusCodes.BadReferenceNotAllowed, "Target node cannot be used with HasComponent references.");
                }
                
                if (targetNodeClass == NodeClass.Variable)
                {
                    if ((targetNodeClass & (NodeClass.Variable | NodeClass.VariableType)) == 0)
                    {
                        throw ServiceResultException.Create(StatusCodes.BadReferenceNotAllowed, "A Variable must be a component of an Variable or VariableType.");
                    }
                }

                if (targetNodeClass == NodeClass.Method)
                {
                    if ((sourceNodeClass & (NodeClass.Object | NodeClass.ObjectType)) == 0)
                    {
                        throw ServiceResultException.Create(StatusCodes.BadReferenceNotAllowed, "A Method must be a component of an Object or ObjectType.");
                    }
                }
            }
            
            // check HasProperty references.
            if (m_server.TypeTree.IsTypeOf(referenceTypeId, ReferenceTypes.HasProperty))
            {
                if (targetNodeClass != NodeClass.Variable)
                {
                    throw ServiceResultException.Create(StatusCodes.BadReferenceNotAllowed, "Targets of HasProperty references must be Variables.");
                }                
            }

            // check HasSubtype references.
            if (m_server.TypeTree.IsTypeOf(referenceTypeId, ReferenceTypeIds.HasSubtype))
            {
                if ((sourceNodeClass & (NodeClass.DataType | NodeClass.ReferenceType | NodeClass.ObjectType | NodeClass.VariableType)) == 0)
                {
                    throw ServiceResultException.Create(StatusCodes.BadReferenceNotAllowed, "Source node cannot be used with HasSubtype references.");
                }

                if (targetNodeClass != sourceNodeClass)
                {
                    throw ServiceResultException.Create(StatusCodes.BadReferenceNotAllowed, "The source and target cannot be connected by a HasSubtype reference.");
                }
            }                      

            // TBD - check rules for other reference types.
        }
        /// <summary>
        /// Checks if the attribute is valid for at least one of node classes specified in the mask.
        /// </summary>
        public static bool IsValid(NodeClass nodeClass, uint attributeId)
        {
            switch (attributeId)
            {
                case NodeId:
                case NodeClass:
                case BrowseName:
                case DisplayName:
                case Description:
                case WriteMask:
                case UserWriteMask:
                {
                    return true;
                }

                case Value:
                case DataType: 
                case ValueRank: 
                case ArrayDimensions: 
                {
                    return (nodeClass & (Opc.Ua.NodeClass.VariableType | Opc.Ua.NodeClass.Variable)) != 0;
                }                    

                case IsAbstract:
                {
                    return (nodeClass & (Opc.Ua.NodeClass.VariableType | Opc.Ua.NodeClass.ObjectType | Opc.Ua.NodeClass.ReferenceType | Opc.Ua.NodeClass.DataType)) != 0;
                }               

                case Symmetric:
                case InverseName:
                {
                    return (nodeClass & Opc.Ua.NodeClass.ReferenceType) != 0;
                }      

                case ContainsNoLoops:
                {
                    return (nodeClass & Opc.Ua.NodeClass.View) != 0;
                }                    

                case EventNotifier:
                {
                    return (nodeClass & (Opc.Ua.NodeClass.Object | Opc.Ua.NodeClass.View)) != 0;
                } 
                    
                case AccessLevel:
                case UserAccessLevel:
                case MinimumSamplingInterval:
                case Historizing:
                {
                    return (nodeClass & Opc.Ua.NodeClass.Variable) != 0;
                } 

                case Executable:
                case UserExecutable:
                {
                    return (nodeClass & Opc.Ua.NodeClass.Method) != 0;
                }
            }

            return false;
        }
Example #54
0
        /// <summary>
        /// Returns an image index for the specified attribute.
        /// </summary>
        public static int GetImageIndex(Session session, NodeClass nodeClass, ExpandedNodeId typeDefinitionId, bool selected)
        {
            if (nodeClass == NodeClass.Variable)
            {
                if (session.NodeCache.IsTypeOf(typeDefinitionId, Opc.Ua.VariableTypeIds.PropertyType))
                {
                    return ClientUtils.Property;
                }

                return ClientUtils.Variable;
            }

            if (nodeClass == NodeClass.Object)
            {
                if (session.NodeCache.IsTypeOf(typeDefinitionId, Opc.Ua.ObjectTypeIds.FolderType))
                {
                    if (selected)
                    {
                        return ClientUtils.OpenFolder;
                    }
                    else
                    {
                        return ClientUtils.ClosedFolder;
                    }
                }

                return ClientUtils.Object;
            }

            if (nodeClass == NodeClass.Method)
            {
                return ClientUtils.Method;
            }

            if (nodeClass == NodeClass.View)
            {
                return ClientUtils.View;
            }

            return ClientUtils.ObjectType;
        }
Example #55
0
        /// <summary>
        /// Returns to display icon for the target of a reference.
        /// </summary>
        public static string GetTargetIcon(Session session, NodeClass nodeClass, ExpandedNodeId typeDefinitionId)
        { 
            // make sure the type definition is in the cache.
            INode typeDefinition = session.NodeCache.Find(typeDefinitionId);

            switch (nodeClass)
            {
                case NodeClass.Object:
                {                    
                    if (session.TypeTree.IsTypeOf(typeDefinitionId, ObjectTypes.FolderType))
                    {
                        return "Folder";
                    }

                    return "Object";
                }
                    
                case NodeClass.Variable:
                {                    
                    if (session.TypeTree.IsTypeOf(typeDefinitionId, VariableTypes.PropertyType))
                    {
                        return "Property";
                    }

                    return "Variable";
                }                   
            }

            return nodeClass.ToString();
        }
Example #56
0
 public CustomerQueue()
     : base()
 {
     structure_Tail = null;
     FreeSpaceX = 140;
 }
		/// <summary>
		/// Returns the ids for all attributes which are valid for the at least one of the node classes specified by the mask.
		/// </summary>
        public static UInt32Collection GetIdentifiers(NodeClass nodeClass)
        {
			FieldInfo[] fields = typeof(Attributes).GetFields(BindingFlags.Public | BindingFlags.Static);
            
            UInt32Collection ids = new UInt32Collection(fields.Length);
            
			foreach (FieldInfo field in fields)
			{
                uint id = (uint)field.GetValue(typeof(Attributes));

                if (IsValid(nodeClass, id))
                {
                    ids.Add(id);
                }
			}

			return ids;
        }
Example #58
0
 public void AddToQueue()
 {
     FreeSpaceX += 60;
     NodeClass Cust = new NodeClass(new Customer(), null);
     structure_Count++;
     if (IsEmpty())
     {
       structure_Head = Cust;
       structure_Tail = Cust;
     }
     else
     {
       structure_Tail.node_NextNode = Cust;
       structure_Tail = Cust;
     }
 }