I'm developing a scientific image processing application which will support all the major image formats. Fits, Tiff, BMP, PNG and JPEG etc. For various reasons I would like to keep the functionality of each file format in its own class and have a generic interface to each from the main UI class.
For example, the UI class would be able to call a class method named:
and not have to care about the specifics of each file format. Instead the method:
IMAGE::openImage('type')
will 'forward' the request onto the correct image processing class.
What's the best way to achieve this? Should I use multiple inheritance, abstract class (Interfaces) or simple have a "bridge" class which will work out the image file format and then pass it onto the correct image processor class. Or, would best practice dictate that I should have one class to handle all file formats?
Hope that makes sense. If not please ask me to elaborate.