generate_ids.py
Go to the documentation of this file.
1 if __name__ == "__main__":
2  inputfile = open("NodeIds.csv")
3  outputfile = open("../opcua/ua/object_ids.py", "w")
4  outputfile.write("#AUTOGENERATED!!!\n")
5  outputfile.write("\n")
6  outputfile.write("from enum import IntEnum\n")
7  outputfile.write("\n")
8  # Making ObjectIds inherit IntEnum has a huge performance impact!!!!!
9  # so we use a normal class and a reverse one for the few places we need it
10  outputfile.write("class ObjectIds(object):\n")
11  outputfile.write(" Null = 0\n")
12  for line in inputfile:
13  name, nb, datatype = line.split(",")
14  outputfile.write(" {0} = {1}\n".format(name, nb))
15  inputfile.close()
16  inputfile = open("NodeIds.csv")
17  outputfile.write("\n\nObjectIdNames = {}\n")
18  outputfile.write("ObjectIdNames[0] = 'Null'\n".format(nb, name))
19  for line in inputfile:
20  name, nb, datatype = line.split(",")
21  outputfile.write("ObjectIdNames[{0}] = '{1}'\n".format(nb, name))
22 
23  inputfile = open("AttributeIds.csv")
24  outputfile = open("../opcua/ua/attribute_ids.py", "w")
25  outputfile.write("#AUTOGENERATED!!!\n")
26  outputfile.write("\n")
27  outputfile.write("from enum import IntEnum\n")
28  outputfile.write("\n")
29  outputfile.write("class AttributeIds(IntEnum):\n")
30  for line in inputfile:
31  name, nb = line.split(",")
32  outputfile.write(" {0} = {1}\n".format(name.strip(), nb.strip()))
33 


ros_opcua_impl_python_opcua
Author(s): Denis Štogl , Daniel Draper
autogenerated on Tue Jan 19 2021 03:12:43