• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
4 
5 // This file was modified by Oracle on 2017, 2018, 2019.
6 // Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
7 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
8 
9 // Use, modification and distribution is subject to the Boost Software License,
10 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
11 // http://www.boost.org/LICENSE_1_0.txt)
12 
13 #ifndef BOOST_GEOMETRY_PROJECTIONS_IMPL_FACTORY_ENTRY_HPP
14 #define BOOST_GEOMETRY_PROJECTIONS_IMPL_FACTORY_ENTRY_HPP
15 
16 #include <string>
17 
18 #include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
19 
20 namespace boost { namespace geometry { namespace projections
21 {
22 
23 namespace detail
24 {
25 
26 // forward declaration needed by some projections
27 template <typename Params, typename CT, typename Parameters>
28 class factory;
29 
30 template <typename Params, typename CT, typename Parameters>
31 struct factory_entry
32 {
~factory_entryboost::geometry::projections::detail::factory_entry33     virtual ~factory_entry() {}
34     virtual dynamic_wrapper_b<CT, Parameters>* create_new(Params const& , Parameters const& ) const = 0;
35 };
36 
37 // Macros for entries definition
38 
39 #define BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_BEGIN(ENTRY) \
40 template <typename Params, typename T, typename Parameters> \
41 struct ENTRY : projections::detail::factory_entry<Params, T, Parameters> \
42 { \
43     projections::detail::dynamic_wrapper_b<T, Parameters>* create_new(Params const& params, \
44                                                                       Parameters const& parameters) const
45 
46 #define BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_END };
47 
48 #define BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(ENTRY, PROJ) \
49 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_BEGIN(ENTRY) \
50 { \
51     return new projections::detail::dynamic_wrapper_f<PROJ<T, Parameters>, T, Parameters>(params, parameters); \
52 } \
53 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_END
54 
55 #define BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(ENTRY, PROJ) \
56 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_BEGIN(ENTRY) \
57 { \
58     return new projections::detail::dynamic_wrapper_fi<PROJ<T, Parameters>, T, Parameters>(params, parameters); \
59 } \
60 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_END
61 
62 #define BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(ENTRY, PROJ_S, PROJ_E) \
63 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_BEGIN(ENTRY) \
64 { \
65     if (parameters.es != 0.0) \
66         return new projections::detail::dynamic_wrapper_fi<PROJ_E<T, Parameters>, T, Parameters>(params, parameters); \
67     else \
68         return new projections::detail::dynamic_wrapper_fi<PROJ_S<T, Parameters>, T, Parameters>(params, parameters); \
69 } \
70 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_END
71 
72 // Macros for factory initialization
73 #define BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(FUN_NAME) \
74 template <typename Params, typename T, typename Parameters> \
75 inline void FUN_NAME(projections::detail::factory<Params, T, Parameters>& factory)
76 
77 #define BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(PROJ_NAME, ENTRY) \
78     factory.add_to_factory(#PROJ_NAME, \
79                            srs::dpar::proj_##PROJ_NAME, \
80                            new ENTRY<Params, T, Parameters>);
81 
82 } // namespace detail
83 }}} // namespace boost::geometry::projections
84 
85 #endif // BOOST_GEOMETRY_PROJECTIONS_IMPL_FACTORY_ENTRY_HPP
86