20 #ifndef MIRTK_ImageWriterFactory_H 21 #define MIRTK_ImageWriterFactory_H 23 #include "mirtk/ObjectFactory.h" 24 #include "mirtk/ImageWriter.h" 26 #include "mirtk/Array.h" 27 #include "mirtk/UnorderedMap.h" 72 typedef UnorderedMap<string, ImageWriterCreator> Associations;
75 Associations _Associations;
96 #define mirtkRegisterImageWriterMacro(type) \ 97 mirtk::ImageWriterFactory::Instance() \ 98 .Register(type::Extensions(), mirtk::New<mirtk::ImageWriter, type>) 102 #ifdef MIRTK_AUTO_REGISTER 103 #define mirtkAutoRegisterImageWriterMacro(type) \ 105 static auto _##type##Registered = \ 106 mirtk::ImageWriterFactory::Instance() \ 107 .Register(type::Extensions(), mirtk::New<mirtk::ImageWriter, type>); \ 109 #else // MIRTK_AUTO_REGISTER 110 #define mirtkAutoRegisterImageWriterMacro(type) 111 #endif // MIRTK_AUTO_REGISTER 117 #endif // MIRTK_ImageWriterFactory_H static ImageWriterFactory & Instance()
bool Register(const Array< string > &exts, ImageWriterCreator creator)
ImageWriter * New(const char *fname) const
ImageWriter *(* ImageWriterCreator)()
Type of object creator.