It's not a big deal :
- BlockDataReader is proposing a pure virtual read(Chunk&, BlockId) method, that is implemented by BlockTypeReader, BlockMetaReader, BlockLightReader, BlockDayLightReader.... whatever you want
- Chunk::UnBoundGetXXX receive a BlockDataReader& and call it's read method (not knowing what is read).
- Finally the value can be retrieved from the BlockDataReader object.
Additionally, I made a Composite of BlockDataReader, that allow to pass multiple reader to the same method call.
Edit 2 : Additionally, I add a templated value-storing intermediate class.
As you responded on GitHub, I assume You've already red it anyway.
Thanks
Edit : I often encourage my teams to work that way. Very short classes with very few and very short public methods. Each one having a small (and so easy to fulfill) responsibility. The may picture being drawn by assembling those small parts. Of course, we cannot do that here because :
1. the history is strong, there would be a lot to do
2. what we get in terms of maintainability, we may lose it (or some) in terms performances.
- BlockDataReader is proposing a pure virtual read(Chunk&, BlockId) method, that is implemented by BlockTypeReader, BlockMetaReader, BlockLightReader, BlockDayLightReader.... whatever you want
- Chunk::UnBoundGetXXX receive a BlockDataReader& and call it's read method (not knowing what is read).
- Finally the value can be retrieved from the BlockDataReader object.
Additionally, I made a Composite of BlockDataReader, that allow to pass multiple reader to the same method call.
Edit 2 : Additionally, I add a templated value-storing intermediate class.
As you responded on GitHub, I assume You've already red it anyway.
Thanks
Edit : I often encourage my teams to work that way. Very short classes with very few and very short public methods. Each one having a small (and so easy to fulfill) responsibility. The may picture being drawn by assembling those small parts. Of course, we cannot do that here because :
1. the history is strong, there would be a lot to do
2. what we get in terms of maintainability, we may lose it (or some) in terms performances.