pyloxi: use ofclass subtemplate for OXMs
diff --git a/py_gen/templates/oxm.py b/py_gen/templates/oxm.py
index ecb52ac..3d888a7 100644
--- a/py_gen/templates/oxm.py
+++ b/py_gen/templates/oxm.py
@@ -53,49 +53,7 @@
pass
:: for ofclass in ofclasses:
-:: from loxi_ir import *
-:: normal_members = [m for m in ofclass.members if type(m) == OFDataMember]
-:: type_members = [m for m in ofclass.members if type(m) == OFTypeMember]
-class ${ofclass.pyname}(OXM):
-:: for m in type_members:
- ${m.name} = ${m.value}
-:: #endfor
-
- def __init__(self, ${', '.join(["%s=None" % m.name for m in normal_members])}):
-:: for m in normal_members:
- if ${m.name} != None:
- self.${m.name} = ${m.name}
- else:
- self.${m.name} = ${py_gen.oftype.gen_init_expr(m.oftype, version=version)}
-:: #endfor
-
- def pack(self):
- packed = []
-:: include("_pack.py", ofclass=ofclass, version=version)
- return ''.join(packed)
-
- @staticmethod
- def unpack(buf):
- obj = ${ofclass.pyname}()
-:: include("_unpack.py", ofclass=ofclass, version=version)
- return obj
-
- def __eq__(self, other):
- if type(self) != type(other): return False
-:: for m in normal_members:
- if self.${m.name} != other.${m.name}: return False
-:: #endfor
- return True
-
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
- def pretty_print(self, q):
-:: include('_pretty_print.py', ofclass=ofclass)
+:: include('_ofclass.py', ofclass=ofclass, superclass="OXM")
:: #endfor