def generateReferenceCode(reference): if reference.isForward: return "retVal |= UA_Server_addReference(server, %s, %s, %s, true);" % \ (generateNodeIdCode(reference.source), generateNodeIdCode(reference.referenceType), generateExpandedNodeIdCode(reference.target)) else: return "retVal |= UA_Server_addReference(server, %s, %s, %s, false);" % \ (generateNodeIdCode(reference.source), generateNodeIdCode(reference.referenceType), generateExpandedNodeIdCode(reference.target))
def generateReferenceCode(reference): code = [] forwardFlag = "true" if reference.isForward else "false" code.append("retVal |= UA_Server_addReference(server, %s, %s, %s, %s);" % (generateNodeIdCode(reference.source), generateNodeIdCode(reference.referenceType), generateExpandedNodeIdCode(reference.target), forwardFlag)) code.append("if (retVal != UA_STATUSCODE_GOOD) return retVal;") return "\n".join(code)