소스 검색

remove dead code in namespace generation

Julius Pfrommer 9 년 전
부모
커밋
55e9013dc8
2개의 변경된 파일5개의 추가작업 그리고 14개의 파일을 삭제
  1. 2 10
      tools/pyUANamespace/ua_builtin_types.py
  2. 3 4
      tools/pyUANamespace/ua_node_types.py

+ 2 - 10
tools/pyUANamespace/ua_builtin_types.py

@@ -364,10 +364,8 @@ class opcua_value_t():
         else:
           for v in self.value:
             code.append(valueName + "[" + str(self.value.index(v)) + "] = " + v.printOpen62541CCode_SubType() + ";")
-        code.append("UA_Variant_setArrayCopy(" + self.parent.getCodePrintableID() + "_variant, &" + valueName + ", (UA_Int32) " + str(len(self.value)) + ", &UA_TYPES[UA_TYPES_" + self.value[0].stringRepresentation.upper() + "]);")
-        # Variant creation is now part of printSubtypeEarly, the node does not exist when the type is initialized!
-        #if (bootstrapping == True):
-        #  code.append(self.parent.getCodePrintableID() + "->value.variant.value = *" + self.parent.getCodePrintableID() + "_variant;")
+        code.append("UA_Variant_setArrayCopy(" + self.parent.getCodePrintableID() + "_variant, &" + valueName +
+                    ", (UA_Int32) " + str(len(self.value)) + ", &UA_TYPES[UA_TYPES_" + self.value[0].stringRepresentation.upper() + "]);")
     else:
       # User the following strategy for all directly mappable values a la 'UA_Type MyInt = (UA_Type) 23;'
       if self.value[0].__binTypeId__ == BUILTINTYPE_TYPEID_GUID:
@@ -389,16 +387,10 @@ class opcua_value_t():
           code.append("UA_Variant_setScalarCopy(" + self.parent.getCodePrintableID() + "_variant, " + valueName + ", &UA_TYPES[UA_TYPES_" + self.value[0].stringRepresentation.upper() + "]);")
           #FIXME: There is no membership definition for extensionObjects generated in this function.
           code.append("UA_" + self.value[0].stringRepresentation + "_deleteMembers(" + valueName + ");")
-          # Variant creation is now part of printSubtypeEarly, the node does not exist when the type is initialized!
-          #if (bootstrapping == True):
-          #  code.append(self.parent.getCodePrintableID() + "->value.variant.value = *" + self.parent.getCodePrintableID() + "_variant;")
         else:
           code.append("UA_" + self.value[0].stringRepresentation + " " + valueName + " = " + self.value[0].printOpen62541CCode_SubType() + ";")
           code.append("UA_Variant_setScalarCopy(" + self.parent.getCodePrintableID() + "_variant, &" + valueName + ", &UA_TYPES[UA_TYPES_" + self.value[0].stringRepresentation.upper() + "]);")
           code.append("UA_" + self.value[0].stringRepresentation + "_deleteMembers(&" + valueName + ");")
-          # Variant creation is now part of printSubtypeEarly, the node does not exist when the type is initialized!
-          #if (bootstrapping == True):
-          #  code.append(self.parent.getCodePrintableID() + "->value.variant.value = *" + self.parent.getCodePrintableID() + "_variant;")
     return code
 
 

+ 3 - 4
tools/pyUANamespace/ua_node_types.py

@@ -666,11 +666,10 @@ class opcua_node_t:
     # Note: getFirstParentNode will return [parentNode, referenceToChild]
     (parentNode, parentRef) = self.getFirstParentNode()
     if not (parentNode in unPrintedNodes) and (parentNode != None) and (parentRef.referenceType() != None):
-      code.append("// Referencing node found and declared as parent: " + str(parentNode .id()) + "/" + str(parentNode .__node_browseName__) + " using " + str(parentRef.referenceType().id()) + "/" + str(parentRef.referenceType().__node_browseName__))
-      #code = code + self.printOpen62541CCode_SubtypeEarly(bootstrapping = False)
+      code.append("// Referencing node found and declared as parent: " + str(parentNode .id()) + "/" +
+                  str(parentNode .__node_browseName__) + " using " + str(parentRef.referenceType().id()) +
+                  "/" + str(parentRef.referenceType().__node_browseName__))
       code = code + codegen.getCreateNodeNoBootstrap(self, parentNode, parentRef)
-      #code = code + self.printOpen62541CCode_Subtype(unPrintedReferences = unPrintedReferences, bootstrapping = False)
-      #code.append("       UA_NULL);") # createdNodeId, wraps up the UA_Server_add<XYType>Node() call
       # Parent to child reference is added by the server, do not reprint that reference
       if parentRef in unPrintedReferences:
         unPrintedReferences.remove(parentRef)