Mirror reflection library 0.5.13

mirror/factory.hpp

Go to the documentation of this file.
00001 
00010 #ifndef MIRROR_FACTORY_1011291729_HPP
00011 #define MIRROR_FACTORY_1011291729_HPP
00012 
00013 #include <mirror/auxiliary/factory.hpp>
00014 #include <mirror/utils/native_types.hpp>
00015 #include <mirror/meta_class.hpp>
00016 #include <mirror/meta_enum.hpp>
00017 
00018 MIRROR_NAMESPACE_BEGIN
00019 
00033 template <typename T>
00034 struct is_specialized_factory_src;
00035 
00036 template <
00037     typename Product,
00038     typename Traits,
00039     template <class, class> class Manufacturer
00040 > struct is_specialized_factory_src<Manufacturer<Product, Traits> >
00041 {
00042     typedef std::integral_constant<
00043         bool,
00044         is_util_native_type<Product>::value ||
00045         std::is_enum<Product>::value
00046     > type;
00047 };
00048 
00050 
00077 template <
00078     template <class, class> class Manufacturer,
00079     template <class, class> class Suppliers,
00080     template <class, class> class Enumerator,
00081     class SourceTraits,
00082     typename Product
00083 > class factory : public aux::base_factory<
00084     Manufacturer,
00085     Suppliers,
00086     Enumerator,
00087     SourceTraits,
00088     Product,
00089     typename constructors< meta_class<Product> >::type,
00090     typename mp::make_index_seq<
00091         typename mp::size<
00092             constructors< meta_class<Product> >
00093         >::type
00094     >::type,
00095     typename is_specialized_factory_src<
00096         Manufacturer<Product, SourceTraits>
00097     >::type
00098 >
00099 {
00100 private:
00101     typedef typename aux::base_factory<
00102         Manufacturer,
00103         Suppliers,
00104         Enumerator,
00105         SourceTraits,
00106         Product,
00107         typename constructors< meta_class<Product> >::type,
00108         typename mp::make_index_seq<
00109             typename mp::size<
00110                 constructors< meta_class<Product> >
00111             >::type
00112         >::type,
00113         typename is_specialized_factory_src<
00114             Manufacturer<Product, SourceTraits>
00115         >::type
00116     > base_class;
00117 public:
00118     template <typename Param>
00119     factory(Param param)
00120      : base_class(param, mp::empty_range())
00121     { }
00122 
00123     template <typename Param, class ConstructionInfo>
00124     factory(Param param, ConstructionInfo)
00125      : base_class(param, typename ConstructionInfo::context())
00126     { }
00127 
00128     template <typename Param, class ... Items>
00129     factory(Param param, mp::range<Items...> context)
00130      : base_class(param, context)
00131     { }
00132 };
00133 
00134 
00136 
00200 template <
00201     template <class, class> class Manufacturer,
00202     template <class, class> class Suppliers,
00203     template <class, class> class Enumerator,
00204     class SourceTraits
00205 > struct factory_maker
00206 {
00208 
00214     template <typename Product>
00215     struct factory
00216     {
00217         typedef mirror::factory<
00218             Manufacturer,
00219             Suppliers,
00220             Enumerator,
00221             SourceTraits,
00222             Product
00223         > type;
00224     };
00225 };
00226 
00227 MIRROR_NAMESPACE_END
00228 
00229 #endif //include guard
00230 

Copyright © 2006-2011 Matus Chochlik, University of Zilina, Zilina, Slovakia.
<matus.chochlik -at- fri.uniza.sk>
<chochlik -at -gmail.com>
Documentation generated on Fri Dec 16 2011 by Doxygen (version 1.7.3).
Important note: Although the 'boostified' version of Mirror uses the Boost C++ libraries Coding Guidelines and is implemented inside of the boost namespace, it IS NOT an officially reviewed and accepted Boost library. Mirror is being developed with the intention to be submitted for review for inclusion to the Boost C++ libraries.