Convert list accessors to templates and optimize

Reviewer: @wilmo119

Moves some of the table lookups and indirect function calls from runtime to codegen, which halves the cost of these functions. Also continues the process of moving legacy generated code to templates.
Since you are adding elements to a set, it's probably not meaningful to do any sorting at this stage.

If you just want uniqueness, you can still use a list with the following code:
```
list_oftypes = []

def foo(member):
    if isinstance(member, ir.OFDataMember) and \
    loxi_utils.oftype_is_list(member.oftype) and \
    member not in list_oftypes:
        return True
    return False

for uclass in loxi_globals.unified.classes:
    for ofclass in uclass.version_classes.values():
        list_oftypes += filter(foo, ofclass.members)
```

If you want to use set, you can compress the code with reduce():
```
list_oftypes = set()

def foo(s, m):
    if isinstance(m, ir.OFDataMember) and loxi_utils.oftype_is_list(m.oftype):
        s.add(m)

for uclass in loxi_globals.unified.classes:
    for ofclass in uclass.version_classes.values():
        list_oftypes = reduce(foo, ofclass.members, list_oftypes)
```