export_plugin.hh
Go to the documentation of this file.
00001 // Copyright Vladimir Prus 2004.
00002 // Distributed under the Boost Software License, Version 1.0.
00003 // (See accompanying file LICENSE_1_0.txt
00004 // or copy at http://www.boost.org/LICENSE_1_0.txt)
00005 
00006 #ifndef BOOST_EXPORT_PLUGIN_VP_2004_08_25
00007 #define BOOST_EXPORT_PLUGIN_VP_2004_08_25
00008 
00009 #include <boost/any.hpp>
00010 #include <string>
00011 #include <map>
00012 
00013 #include <utilmm/plugin/concrete_factory.hh>
00014 
00015 #define BOOST_EXPORT_PLUGIN(BaseType, ActualType, name) \
00016     extern "C" std::map<std::string, boost::any>& boost_exported_plugins_list();  \
00017     namespace {                                                               \
00018         struct boost_plugin_exporter1 {                                       \
00019             boost_plugin_exporter1() {                                        \
00020               static utilmm::plugin::concrete_factory<BaseType, ActualType> cf;  \
00021               utilmm::plugin::abstract_factory<BaseType>* w = &cf;              \
00022                 boost_exported_plugins_list().insert(std::make_pair(name, w)); \
00023             }                                                                 \
00024         } boost_plugin_exporter_instance1;                                    \
00025     }
00026 
00027 #define BOOST_EXPORT_PLUGIN_LIST() \
00028 extern "C" std::map<std::string, boost::any>& boost_exported_plugins_list() \
00029 {                                                                           \
00030     static std::map<std::string, boost::any> r;                             \
00031     return r;                                                               \
00032 }
00033 
00034 
00035     
00036 
00037 
00038 
00039 
00040 #endif


utilmm
Author(s): Sylvain Joyeux/sylvain.joyeux@m4x.org
autogenerated on Mon Oct 6 2014 03:17:01