// Boost.Geometry Index // Rtree tests generator // Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #include #include #include #include #include int main() { std::vector generated_files; typedef boost::tuple CT; std::vector coordinate_types; coordinate_types.push_back(boost::make_tuple("double", "d", "")); coordinate_types.push_back(boost::make_tuple("float", "f", "")); coordinate_types.push_back(boost::make_tuple("int", "i", "")); coordinate_types.push_back(boost::make_tuple("ttmath_big", "tt", "HAVE_TTMATH")); std::vector dimensions; dimensions.push_back("2"); dimensions.push_back("3"); typedef boost::tuple P; std::vector

parameters; parameters.push_back(boost::make_tuple("bgi::linear<4, 2>()", "linear")); parameters.push_back(boost::make_tuple("bgi::quadratic<4, 2>()", "quadratic")); parameters.push_back(boost::make_tuple("bgi::rstar<4, 2>()", "rstar")); parameters.push_back(boost::make_tuple("bgi::runtime::linear(4, 2)", "linear_rt")); parameters.push_back(boost::make_tuple("bgi::runtime::quadratic(4, 2)", "quadratic_rt")); parameters.push_back(boost::make_tuple("bgi::runtime::rstar(4, 2)","rstar_rt")); std::vector indexables; indexables.push_back("p"); indexables.push_back("b"); BOOST_FOREACH(std::string const& d, dimensions) { BOOST_FOREACH(CT const& c, coordinate_types) { BOOST_FOREACH(P const& p, parameters) { BOOST_FOREACH(std::string const& i, indexables) { std::string point_type = std::string() + "bg::model::point<" + boost::get<0>(c) + ", " + d + ", bg::cs::cartesian>"; std::string filename = std::string() + "rtree_" + i + d + boost::get<1>(c) + '_' + boost::get<1>(p) + ".cpp"; std::ofstream f(filename.c_str(), std::ios::trunc); f << "// Boost.Geometry Index\n" << "// Unit Test\n" << "\n" << "// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.\n" << "\n" << "// Use, modification and distribution is subject to the Boost Software License,\n" << "// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at\n" << "// http://www.boost.org/LICENSE_1_0.txt)\n" << "\n"; f << "#include \n" << "\n" << "#include \n" << (i == "p" ? "" : "#include \n") << "\n"; f << "int test_main(int, char* [])\n" << "{\n" << (boost::get<2>(c).empty() ? "" : "#ifdef HAVE_TTMATH\n") << " typedef " << point_type << " Point;\n" << " " << (i == "p" ? "test_rtree_for_point" : "test_rtree_for_box" ) << "(" << boost::get<0>(p) << ");\n" << (boost::get<2>(c).empty() ? "" : "#endif\n") << " return 0;\n" << "}\n"; generated_files.push_back(filename); } } } } std::ofstream f("Jamfile.v2", std::ios::trunc); f << "# Boost.Geometry Index\n" << "#\n" << "# Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.\n" << "#\n" << "# Use, modification and distribution is subject to the Boost Software License,\n" << "# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at\n" << "# http://www.boost.org/LICENSE_1_0.txt)\n" << "\n" << "test-suite boost-geometry-index-rtree-generated\n" << " :\n"; BOOST_FOREACH(std::string const& s, generated_files) { f << " [ run " << s << " ]\n"; } f << " ;\n" << "\n"; return 0; }