ioplugins.hh

Go to the documentation of this file.
00001 #ifndef TYPELIB_IOPLUGINS_HH
00002 #define TYPELIB_IOPLUGINS_HH
00003 
00004 #include <boost/type_traits/is_base_and_derived.hpp>
00005 #include <boost/mpl/if.hpp>
00006 
00007 namespace Typelib
00008 {
00009     class ExportPlugin;
00010     class ImportPlugin;
00011     class Exporter;
00012     class Importer;
00013 
00014     template<typename Type>
00015     struct plugin_traits
00016     {
00017         typedef typename boost::mpl::if_
00018             < boost::is_base_and_derived<Exporter, Type>
00019             , ExportPlugin
00020             , ImportPlugin >::type   plugin_base;
00021 
00022         typedef typename boost::mpl::if_
00023             < boost::is_base_and_derived<Exporter, Type>
00024             , Exporter
00025             , Importer >::type   object_base;
00026     };
00027 
00028     template<typename Type>
00029     class GenericIOPlugin 
00030         : public plugin_traits<Type>::plugin_base
00031     {
00032     public:
00033         GenericIOPlugin(char const* name)
00034             : plugin_traits<Type>::plugin_base(name) {}
00035         typename plugin_traits<Type>::object_base* create()
00036         { return new Type; }
00037     };
00038 
00039     class PluginManager;
00040     void registerIOPlugins(PluginManager& manager);
00041 }
00042 
00043 #endif
00044 

Generated on Thu Jan 22 16:37:19 2009 for typeLib by doxygen 1.5.6
SourceForge.net Project Page