
On 22/12/10 20:01, Christian Henning wrote:
On Wed, Dec 22, 2010 at 2:36 PM, Mateusz Loskot
wrote: Hi,
I'm implementing new image format support for Boost.GIL based on the new IO implementation which has been reviewed [1] lately.
[1] http://lists.boost.org/boost-announce/2010/11/0273.php
What would be the guidelines regarding custom Device implementation? Currently, only TIFF format implements it. When it is required to implement custom Device for the IO? When recommended as a good practice?
Right now, io_new is providing support for FILE*, std::istream, and std::ostream. For TIFF I had to add another device type for TIFF* since that's the one used in libtiff. All devices are registered using c++ metafunctions, like is_output_device<...> and is_input_device<...>.
You would have to add another device if the your one is missing. For instance, boost::iostream is not there yet.
OK, so as a simple rule I can take that if a format implementation library defines it's own file/resource descriptor, then additional Device is most likely needed. For instance, if a library manages files like this: MyFormatFile* OpenMyFormatFile(...); then device for MyFormatFile should be provided, for convenience. Thanks! Regards, -- Mateusz Loskot, http://mateusz.loskot.net Charter Member of OSGeo, http://osgeo.org Member of ACCU, http://accu.org