]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/index/test/rtree/rtree_test_generator.cpp
1 // Boost.Geometry Index
2 // Rtree tests generator
4 // Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland.
6 // This file was modified by Oracle on 2021.
7 // Modifications copyright (c) 2021, Oracle and/or its affiliates.
8 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
10 // Use, modification and distribution is subject to the Boost Software License,
11 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
12 // http://www.boost.org/LICENSE_1_0.txt)
17 #include <boost/assert.hpp>
18 #include <boost/tuple/tuple.hpp>
22 typedef boost::tuple
<std::string
, std::string
> CT
;
23 std::vector
<CT
> coordinate_types
;
24 coordinate_types
.push_back(boost::make_tuple("double", "d"));
25 //coordinate_types.push_back(boost::make_tuple("int", "i"));
26 //coordinate_types.push_back(boost::make_tuple("float", "f"));
28 std::vector
<std::string
> dimensions
;
29 dimensions
.push_back("2");
30 dimensions
.push_back("3");
32 typedef boost::tuple
<std::string
, std::string
> P
;
33 std::vector
<P
> parameters
;
34 parameters
.push_back(boost::make_tuple("bgi::linear<5, 2>()", "lin"));
35 parameters
.push_back(boost::make_tuple("bgi::dynamic_linear(5, 2)", "dlin"));
36 parameters
.push_back(boost::make_tuple("bgi::quadratic<5, 2>()", "qua"));
37 parameters
.push_back(boost::make_tuple("bgi::dynamic_quadratic(5, 2)", "dqua"));
38 parameters
.push_back(boost::make_tuple("bgi::rstar<5, 2>()", "rst"));
39 parameters
.push_back(boost::make_tuple("bgi::dynamic_rstar(5, 2)","drst"));
41 std::vector
<std::string
> indexables
;
42 indexables
.push_back("p");
43 indexables
.push_back("b");
44 indexables
.push_back("s");
46 typedef std::pair
<std::string
, std::string
> TS
;
47 std::vector
<TS
> testsets
;
48 testsets
.push_back(std::make_pair("testset::modifiers", "mod"));
49 testsets
.push_back(std::make_pair("testset::queries", "que"));
50 testsets
.push_back(std::make_pair("testset::additional", "add"));
52 for (P
const& p
: parameters
)
54 for (TS
const& ts
: testsets
)
56 for (std::string
const& i
: indexables
)
58 for (std::string
const& d
: dimensions
)
60 // If the I is Segment, generate only for 2d
61 if ( i
== "s" && d
!= "2" )
66 for (CT
const& c
: coordinate_types
)
68 std::string filename
= std::string() +
69 "rtree_" + boost::get
<1>(p
) + '_' + ts
.second
+ '_' + i
+ d
+ boost::get
<1>(c
) + ".cpp";
71 std::ofstream
f(filename
.c_str(), std::ios::trunc
);
74 "// Boost.Geometry Index\n" <<
77 "// Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland.\n" <<
79 "// Use, modification and distribution is subject to the Boost Software License,\n" <<
80 "// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at\n" <<
81 "// http://www.boost.org/LICENSE_1_0.txt)\n" <<
85 "#include <rtree/test_rtree.hpp>\n" <<
88 std::string indexable_type
;
89 std::string point_type
= std::string("bg::model::point<") + boost::get
<0>(c
) + ", " + d
+ ", bg::cs::cartesian>";
91 indexable_type
= point_type
;
93 indexable_type
= std::string("bg::model::box< ") + point_type
+ " >";
95 indexable_type
= std::string("bg::model::segment< ") + point_type
+ " >";
100 "int test_main(int, char* [])\n" <<
102 " typedef " << indexable_type
<< " Indexable;\n" <<
103 " " << ts
.first
<< "<Indexable>(" << boost::get
<0>(p
) << ", std::allocator<int>());\n" <<