Refactor decode implementation in vlen codecs
As noticed in #81, there is a lot of code duplication in the implementation of the decode() methods in the vlen codecs. Would be good to refactor and remove code duplication.
I had a quick crack at this, and it mostly works (we just need a def _decode_item(self, data, size) method defined in sub classes). However, there's some Cython trickiness involved and this didn't work as expected for the Array version. I don't know enough about Cython to dig into it I'm afraid, and I really must stop procrastinating from what I'm actually supposed to be doing!
I had a quick crack at this, and it mostly works (we just need a
def _decode_item(self, data, size)method defined in sub classes). However, there's some Cython trickiness involved and this didn't work as expected for the Array version. I don't know enough about Cython to dig into it I'm afraid, and I really must stop procrastinating from what I'm actually supposed to be doing!
Yeah, don't you have a proposal deadline :smiley:
Would be cool if you could whack whatever you have in a PR, just to take a look.
Ack, I nuked it all. It's very simple though, just adding a VlenBase class, putting the decode method in there and then having an implementation of def _decode_item(self, data, size) in each subclass. Worked fine for the non-array subclasses.
:smile: no worries, thanks for the info.