瀏覽代碼

Fixed bogus node class check in addOneWayReference (pertains to #836). Fixed unsufficient weight of type- and subType defititions when deriving node orders.

ichrispa 8 年之前
父節點
當前提交
f6e79fb994
共有 2 個文件被更改,包括 6 次插入8 次删除
  1. 0 3
      src/server/ua_services_nodemanagement.c
  2. 6 5
      tools/pyUANamespace/ua_namespace.py

+ 0 - 3
src/server/ua_services_nodemanagement.c

@@ -940,9 +940,6 @@ deleteOneWayReference(UA_Server *server, UA_Session *session, UA_Node *node,
 static UA_StatusCode
 addOneWayReference(UA_Server *server, UA_Session *session,
                    UA_Node *node, const UA_AddReferencesItem *item) {
-    if(item->targetNodeClass != UA_NODECLASS_UNSPECIFIED &&
-       item->targetNodeClass != node->nodeClass)
-        return UA_STATUSCODE_BADNODECLASSINVALID;
     size_t i = node->referencesSize;
     size_t refssize = (i+1) | 3; // so the realloc is not necessary every time
     UA_ReferenceNode *new_refs = UA_realloc(node->references, sizeof(UA_ReferenceNode) * refssize);

+ 6 - 5
tools/pyUANamespace/ua_namespace.py

@@ -572,6 +572,7 @@ class opcua_namespace():
       nmatrix[nind][0] = node
 
     # Determine the dependencies of all nodes
+    logger.debug("Determining node interdependencies.")
     for node in self.nodes:
       nind = self.nodes.index(node)
       #print "Examining node " + str(nind) + " " + str(node)
@@ -580,13 +581,13 @@ class opcua_namespace():
           tind = self.nodes.index(ref.target())
           # Typedefinition of this node has precedence over this node
           if ref.referenceType() in typeRefs and ref.isForward():
-            nmatrix[nind][tind+1] += 1
+            nmatrix[nind][tind+1] += 200 # Very big weight for typedefs
           # isSubTypeOf/typeDefinition of this node has precedence over this node
           elif ref.referenceType() in subTypeRefs and not ref.isForward():
-            nmatrix[nind][tind+1] += 1
+            nmatrix[nind][tind+1] += 100 # Big weight for subtypes
           # Else the target depends on us
           elif ref.isForward():
-            nmatrix[tind][nind+1] += 1
+            nmatrix[tind][nind+1] += 1 # regular weight for dependencies
 
     logger.debug("Using Djikstra topological sorting to determine printing order.")
     reorder = []
@@ -598,9 +599,9 @@ class opcua_namespace():
         if isinstance(ref.target(), opcua_node_t):
           tind = self.nodes.index(ref.target())
           if ref.referenceType() in typeRefs and ref.isForward():
-            nmatrix[nind][tind+1] -= 1
+            nmatrix[nind][tind+1] -= 200
           elif ref.referenceType() in subTypeRefs and not ref.isForward():
-            nmatrix[nind][tind+1] -= 1
+            nmatrix[nind][tind+1] -= 100
           elif ref.isForward():
             nmatrix[tind][nind+1] -= 1
       nmatrix[nind][0] = None