options.hpp 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. // Boost.Geometry Index
  2. //
  3. // R-tree options, algorithms, parameters
  4. //
  5. // Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland.
  6. //
  7. // This file was modified by Oracle on 2019.
  8. // Modifications copyright (c) 2019 Oracle and/or its affiliates.
  9. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  10. //
  11. // Use, modification and distribution is subject to the Boost Software License,
  12. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  13. // http://www.boost.org/LICENSE_1_0.txt)
  14. #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_OPTIONS_HPP
  15. #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_OPTIONS_HPP
  16. #include <boost/geometry/index/parameters.hpp>
  17. namespace boost { namespace geometry { namespace index {
  18. namespace detail { namespace rtree {
  19. // InsertTag
  20. struct insert_default_tag {};
  21. struct insert_reinsert_tag {};
  22. // ChooseNextNodeTag
  23. struct choose_by_content_diff_tag {};
  24. struct choose_by_overlap_diff_tag {};
  25. // SplitTag
  26. struct split_default_tag {};
  27. //struct split_kmeans_tag {};
  28. // RedistributeTag
  29. struct linear_tag {};
  30. struct quadratic_tag {};
  31. struct rstar_tag {};
  32. // NodeTag
  33. struct node_variant_dynamic_tag {};
  34. struct node_variant_static_tag {};
  35. //struct node_weak_dynamic_tag {};
  36. //struct node_weak_static_tag {};
  37. template <typename Parameters, typename InsertTag, typename ChooseNextNodeTag, typename SplitTag, typename RedistributeTag, typename NodeTag>
  38. struct options
  39. {
  40. typedef Parameters parameters_type;
  41. typedef InsertTag insert_tag;
  42. typedef ChooseNextNodeTag choose_next_node_tag;
  43. typedef SplitTag split_tag;
  44. typedef RedistributeTag redistribute_tag;
  45. typedef NodeTag node_tag;
  46. };
  47. template <typename Parameters>
  48. struct options_type
  49. {
  50. // TODO: awulkiew - use static assert
  51. };
  52. template <size_t MaxElements, size_t MinElements>
  53. struct options_type< index::linear<MaxElements, MinElements> >
  54. {
  55. typedef options<
  56. index::linear<MaxElements, MinElements>,
  57. insert_default_tag,
  58. choose_by_content_diff_tag,
  59. split_default_tag,
  60. linear_tag,
  61. node_variant_static_tag
  62. > type;
  63. };
  64. template <size_t MaxElements, size_t MinElements>
  65. struct options_type< index::quadratic<MaxElements, MinElements> >
  66. {
  67. typedef options<
  68. index::quadratic<MaxElements, MinElements>,
  69. insert_default_tag,
  70. choose_by_content_diff_tag,
  71. split_default_tag,
  72. quadratic_tag,
  73. node_variant_static_tag
  74. > type;
  75. };
  76. template <size_t MaxElements, size_t MinElements, size_t OverlapCostThreshold, size_t ReinsertedElements>
  77. struct options_type< index::rstar<MaxElements, MinElements, OverlapCostThreshold, ReinsertedElements> >
  78. {
  79. typedef options<
  80. index::rstar<MaxElements, MinElements, OverlapCostThreshold, ReinsertedElements>,
  81. insert_reinsert_tag,
  82. choose_by_overlap_diff_tag,
  83. split_default_tag,
  84. rstar_tag,
  85. node_variant_static_tag
  86. > type;
  87. };
  88. //template <size_t MaxElements, size_t MinElements>
  89. //struct options_type< kmeans<MaxElements, MinElements> >
  90. //{
  91. // typedef options<
  92. // kmeans<MaxElements, MinElements>,
  93. // insert_default_tag,
  94. // choose_by_content_diff_tag, // change it?
  95. // split_kmeans_tag,
  96. // int, // dummy tag - not used for now
  97. // node_variant_static_tag
  98. // > type;
  99. //};
  100. template <>
  101. struct options_type< index::dynamic_linear >
  102. {
  103. typedef options<
  104. index::dynamic_linear,
  105. insert_default_tag,
  106. choose_by_content_diff_tag,
  107. split_default_tag,
  108. linear_tag,
  109. node_variant_dynamic_tag
  110. > type;
  111. };
  112. template <>
  113. struct options_type< index::dynamic_quadratic >
  114. {
  115. typedef options<
  116. index::dynamic_quadratic,
  117. insert_default_tag,
  118. choose_by_content_diff_tag,
  119. split_default_tag,
  120. quadratic_tag,
  121. node_variant_dynamic_tag
  122. > type;
  123. };
  124. template <>
  125. struct options_type< index::dynamic_rstar >
  126. {
  127. typedef options<
  128. index::dynamic_rstar,
  129. insert_reinsert_tag,
  130. choose_by_overlap_diff_tag,
  131. split_default_tag,
  132. rstar_tag,
  133. node_variant_dynamic_tag
  134. > type;
  135. };
  136. template <typename Parameters, typename Strategy>
  137. struct options_type< index::parameters<Parameters, Strategy> >
  138. : options_type<Parameters>
  139. {
  140. typedef typename options_type<Parameters>::type opt;
  141. typedef options<
  142. index::parameters<Parameters, Strategy>,
  143. typename opt::insert_tag,
  144. typename opt::choose_next_node_tag,
  145. typename opt::split_tag,
  146. typename opt::redistribute_tag,
  147. typename opt::node_tag
  148. > type;
  149. };
  150. }} // namespace detail::rtree
  151. }}} // namespace boost::geometry::index
  152. #endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_OPTIONS_HPP