Util--  1.1
concrete_factory.hh
Go to the documentation of this file.
1 // Copyright Vladimir Prus 2004.
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE_1_0.txt
4 // or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 #ifndef BOOST_CONCRETE_FACTORY_VP_2004_08_25
7 #define BOOST_CONCRETE_FACTORY_VP_2004_08_25
8 
11 
12 #include <iostream>
13 
14 namespace utilmm { namespace plugin {
15 
16  template<class BasePlugin, class Concrete, class Base, class Parameters>
18  };
19 
20  template<class BasePlugin, class Concrete, class Base>
21  struct concrete_factory_item<BasePlugin, Concrete, Base, boost::mpl::list<> >
22  : public Base
23  {
24  BasePlugin* create(dll_handle dll)
25  {
26  std::cout << "CF: 0 args\n";
28  }
29  };
30 
31  template<class BasePlugin, class Concrete, class Base, class A1>
32  struct concrete_factory_item<BasePlugin, Concrete, Base, boost::mpl::list<A1> >
33  : public Base
34  {
35  BasePlugin* create(dll_handle dll, A1 a1)
36  {
37  std::cout << "CF: 1 args\n";
39  }
40  };
41 
42  template<class BasePlugin, class Concrete, class Base, class A1, class A2>
43  struct concrete_factory_item<BasePlugin, Concrete, Base, boost::mpl::list<A1, A2> >
44  : public Base
45  {
46  BasePlugin* create(dll_handle dll, A1 a1, A2 a2)
47  {
48  std::cout << "CF: 2 args\n";
49  return new plugin_wrapper<Concrete, boost::mpl::list<A1, A2> >(dll, a1, a2);
50  }
51  };
52 
53  using namespace boost::mpl::placeholders;
54 
55  template<class BasePlugin, class Concrete>
57  public boost::mpl::inherit_linearly<
58  typename virtual_constructors<BasePlugin>::type,
59  concrete_factory_item<BasePlugin, Concrete, _, _>,
60  abstract_factory<BasePlugin> >::type
61  {
62  };
63 
64 
65 
66 
67 
68 
69 }}
70 
71 #endif
Definition: concrete_factory.hh:56
Definition: undirected_graph.hh:345
BasePlugin * create(dll_handle dll)
Definition: concrete_factory.hh:24
boost::shared_ptr< std::map< std::string, boost::any > &()> dll_handle
Definition: virtual_constructors.hh:19
Definition: dll.hh:34
BasePlugin * create(dll_handle dll, A1 a1)
Definition: concrete_factory.hh:35
BasePlugin * create(dll_handle dll, A1 a1, A2 a2)
Definition: concrete_factory.hh:46
Definition: auto_flag.hh:6
Definition: plugin_wrapper.hh:17
Definition: concrete_factory.hh:17

Generated on Mon Oct 22 2018 18:39:28 for Util-- by doxygen 1.8.13
SourceForge.net Project Page