Ejemplo n.º 1
0
            if len(id) == 0:
                continue
            n = ns.getNodeByIDString(id)
            if n is None:
                logger.debug(
                    "Cannot blacklist node, namespace does currently not contain a node with id "
                    + str(id))
            else:
                ns.remove_node(n)
        blacklist.close()
    ns.sanitize()

# Figure out from the references which is the parent for each node
ns.setNodeParent()

logger.info("Generating Code for Backend: {}".format(args.backend))

if args.backend == "open62541":
    # Create the C code with the open62541 backend of the compiler
    from backend_open62541 import generateOpen62541Code
    generateOpen62541Code(ns, args.outputFile, args.internal_headers,
                          args.typesArray)
elif args.backend == "graphviz":
    from backend_graphviz import generateGraphvizCode
    generateGraphvizCode(ns, filename=args.outputFile)
else:
    logger.error("Unsupported backend: {}".format(args.backend))
    exit(1)

logger.info("NodeSet generation code successfully printed")
Ejemplo n.º 2
0
# Parse Datatypes in order to find out what the XML keyed values actually
# represent.
# Ex. <rpm>123</rpm> is not encodable
#     only after parsing the datatypes, it is known that
#     rpm is encoded as a double
ns.buildEncodingRules()

# Allocate/Parse the data values. In order to do this, we must have run
# buidEncodingRules.
ns.allocateVariables()

ns.addInverseReferences()

ns.setNodeParent()

logger.info("Generating Code for Backend: {}".format(args.backend))

if args.backend == "open62541":
    # Create the C code with the open62541 backend of the compiler
    from backend_open62541 import generateOpen62541Code
    generateOpen62541Code(ns, args.outputFile, args.internal_headers, args.typesArray)
elif args.backend == "graphviz":
    from backend_graphviz import generateGraphvizCode
    generateGraphvizCode(ns, filename=args.outputFile)
else:
    logger.error("Unsupported backend: {}".format(args.backend))
    exit(1)


logger.info("NodeSet generation code successfully printed")