abstract_factory.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_ABSTRACT_FACTORY_VP_2004_08_25
00007 #define BOOST_ABSTRACT_FACTORY_VP_2004_08_25
00008 
00009 #include <boost/mpl/inherit_linearly.hpp>
00010 #include <boost/mpl/list.hpp>
00011 #include <boost/shared_ptr.hpp>
00012 
00013 #include <utilmm/plugin/virtual_constructors.hh>
00014 
00015 namespace utilmm { namespace plugin {
00016 
00017     struct empty_abstract_factory_item {
00018         void create(int*******);
00019     };
00020 
00025     template<class BasePlugin, class Parameters> 
00026     struct abstract_factory_item_N {    
00027     };
00028 
00029     template<class BasePlugin>
00030     struct abstract_factory_item_N<BasePlugin, boost::mpl::list<> > {
00031         virtual BasePlugin* create(dll_handle dll) = 0;
00032     };
00033 
00034     template<class BasePlugin, class A1>
00035     struct abstract_factory_item_N<BasePlugin, boost::mpl::list<A1> > {
00036         virtual BasePlugin* create(dll_handle dll, A1 a1) = 0;
00037     };
00038 
00039     template<class BasePlugin, class A1, class A2>
00040     struct abstract_factory_item_N<BasePlugin, boost::mpl::list<A1, A2> > {
00041         virtual BasePlugin* create(dll_handle dll, A1 a1, A2 a2) = 0;
00042     };
00043     
00044 
00045     template<class BasePlugin, class Base, class Parameters> 
00046     struct abstract_factory_item : 
00047         public Base, 
00048         public abstract_factory_item_N<BasePlugin, Parameters> 
00049     {
00050         using Base::create;
00051         using abstract_factory_item_N<BasePlugin, Parameters>::create;
00052     };
00053 
00054     using namespace boost::mpl::placeholders;
00055 
00056     template<class BasePlugin>
00057     struct abstract_factory :
00058         public boost::mpl::inherit_linearly<
00059         typename virtual_constructors<BasePlugin>::type,
00060         abstract_factory_item<BasePlugin, _, _>,
00061         empty_abstract_factory_item>::type
00062     {
00063     };    
00064 
00065 }}
00066 
00067 #endif


utilmm
Author(s): Sylvain Joyeux/sylvain.joyeux@m4x.org
autogenerated on Wed Sep 16 2015 07:05:43