indexable traits and accessors moved to index::detail namespace

[SVN r82538]
This commit is contained in:
Adam Wulkiewicz
2013-01-18 21:18:32 +00:00
parent b830ec1cdb
commit ca17094850
14 changed files with 63 additions and 63 deletions

View File

@@ -44,8 +44,8 @@ struct sum_for_indexable_dimension<Point, BoxIndexable, box_tag, comparable_dist
inline static result_type apply(Point const& pt, BoxIndexable const& i)
{
typedef typename index::traits::coordinate_type<Point>::type point_coord_t;
typedef typename index::traits::coordinate_type<BoxIndexable>::type indexable_coord_t;
typedef typename index::detail::traits::coordinate_type<Point>::type point_coord_t;
typedef typename index::detail::traits::coordinate_type<BoxIndexable>::type indexable_coord_t;
point_coord_t pt_c = geometry::get<DimensionIndex>(pt);
indexable_coord_t ind_c_min = geometry::get<geometry::min_corner, DimensionIndex>(i);
@@ -69,9 +69,9 @@ comparable_distance_centroid(Point const& pt, Indexable const& i)
return detail::sum_for_indexable<
Point,
Indexable,
typename index::traits::tag<Indexable>::type,
typename index::detail::traits::tag<Indexable>::type,
detail::comparable_distance_centroid_tag,
index::traits::dimension<Indexable>::value
index::detail::traits::dimension<Indexable>::value
>::apply(pt, i);
}

View File

@@ -32,8 +32,8 @@ struct sum_for_indexable_dimension<Point, BoxIndexable, box_tag, comparable_dist
inline static result_type apply(Point const& pt, BoxIndexable const& i)
{
typedef typename index::traits::coordinate_type<Point>::type point_coord_t;
typedef typename index::traits::coordinate_type<BoxIndexable>::type indexable_coord_t;
typedef typename index::detail::traits::coordinate_type<Point>::type point_coord_t;
typedef typename index::detail::traits::coordinate_type<BoxIndexable>::type indexable_coord_t;
point_coord_t pt_c = geometry::get<DimensionIndex>(pt);
indexable_coord_t ind_c_min = geometry::get<geometry::min_corner, DimensionIndex>(i);
@@ -59,9 +59,9 @@ comparable_distance_far(Point const& pt, Indexable const& i)
return detail::sum_for_indexable<
Point,
Indexable,
typename index::traits::tag<Indexable>::type,
typename index::detail::traits::tag<Indexable>::type,
detail::comparable_distance_far_tag,
index::traits::dimension<Indexable>::value
index::detail::traits::dimension<Indexable>::value
>::apply(pt, i);
}

View File

@@ -43,8 +43,8 @@ struct sum_for_indexable_dimension<Point, BoxIndexable, box_tag, comparable_dist
inline static result_type apply(Point const& pt, BoxIndexable const& i)
{
typedef typename index::traits::coordinate_type<Point>::type point_coord_t;
typedef typename index::traits::coordinate_type<BoxIndexable>::type indexable_coord_t;
typedef typename index::detail::traits::coordinate_type<Point>::type point_coord_t;
typedef typename index::detail::traits::coordinate_type<BoxIndexable>::type indexable_coord_t;
point_coord_t pt_c = geometry::get<DimensionIndex>(pt);
indexable_coord_t ind_c_min = geometry::get<geometry::min_corner, DimensionIndex>(i);
@@ -70,9 +70,9 @@ comparable_distance_near(Point const& pt, Indexable const& i)
return detail::sum_for_indexable<
Point,
Indexable,
typename index::traits::tag<Indexable>::type,
typename index::detail::traits::tag<Indexable>::type,
detail::comparable_distance_near_tag,
index::traits::dimension<Indexable>::value
index::detail::traits::dimension<Indexable>::value
>::apply(pt, i);
}

View File

@@ -17,7 +17,7 @@ template <typename Indexable>
struct default_content_result
{
typedef typename select_most_precise<
typename traits::coordinate_type<Indexable>::type,
typename detail::traits::coordinate_type<Indexable>::type,
long double
>::type type;
};
@@ -33,7 +33,7 @@ struct content_for_each_dimension
static inline typename default_content_result<Box>::type apply(Box const& b)
{
return content_for_each_dimension<Box, CurrentDimension - 1>::apply(b) *
( index::get<max_corner, CurrentDimension - 1>(b) - index::get<min_corner, CurrentDimension - 1>(b) );
( detail::get<max_corner, CurrentDimension - 1>(b) - detail::get<min_corner, CurrentDimension - 1>(b) );
}
};
@@ -42,7 +42,7 @@ struct content_for_each_dimension<Box, 1>
{
static inline typename default_area_result<Box>::type apply(Box const& b)
{
return index::get<max_corner, 0>(b) - index::get<min_corner, 0>(b);
return detail::get<max_corner, 0>(b) - detail::get<min_corner, 0>(b);
}
};
@@ -70,7 +70,7 @@ struct content<Indexable, box_tag>
{
static typename default_content_result<Indexable>::type apply(Indexable const& b)
{
return detail::content_for_each_dimension<Indexable, traits::dimension<Indexable>::value>::apply(b);
return detail::content_for_each_dimension<Indexable, detail::traits::dimension<Indexable>::value>::apply(b);
}
};
@@ -79,7 +79,7 @@ struct content<Indexable, box_tag>
template <typename Indexable>
typename default_content_result<Indexable>::type content(Indexable const& b)
{
return dispatch::content<Indexable, typename index::traits::tag<Indexable>::type>::apply(b);
return dispatch::content<Indexable, typename detail::traits::tag<Indexable>::type>::apply(b);
}
}}} // namespace boost::geometry::index

View File

@@ -19,14 +19,14 @@ template <typename Box, size_t Dimension>
struct is_valid_box
{
BOOST_MPL_ASSERT_MSG(
(0 < Dimension && Dimension <= index::traits::dimension<Box>::value),
(0 < Dimension && Dimension <= detail::traits::dimension<Box>::value),
INVALID_DIMENSION_PARAMETER,
(is_valid_box));
static inline bool apply(Box const& b)
{
return is_valid_box<Box, Dimension - 1>::apply(b) &&
( index::get<min_corner, Dimension - 1>(b) <= index::get<max_corner, Dimension - 1>(b) );
( detail::get<min_corner, Dimension - 1>(b) <= detail::get<max_corner, Dimension - 1>(b) );
}
};
@@ -35,7 +35,7 @@ struct is_valid_box<Box, 1>
{
static inline bool apply(Box const& b)
{
return index::get<min_corner, 0>(b) <= index::get<max_corner, 0>(b);
return detail::get<min_corner, 0>(b) <= detail::get<max_corner, 0>(b);
}
};
@@ -66,7 +66,7 @@ struct is_valid<Indexable, box_tag>
{
static inline bool apply(Indexable const& b)
{
return detail::is_valid_box<Indexable, index::traits::dimension<Indexable>::value>::apply(b);
return detail::is_valid_box<Indexable, detail::traits::dimension<Indexable>::value>::apply(b);
}
};
@@ -75,7 +75,7 @@ struct is_valid<Indexable, box_tag>
template <typename Indexable>
inline bool is_valid(Indexable const& b)
{
return dispatch::is_valid<Indexable, typename index::traits::tag<Indexable>::type>::apply(b);
return dispatch::is_valid<Indexable, typename detail::traits::tag<Indexable>::type>::apply(b);
}
}}} // namespace boost::geometry::index

View File

@@ -72,12 +72,12 @@ template <typename Box, size_t CurrentDimension>
struct margin_for_each_dimension
{
BOOST_STATIC_ASSERT(0 < CurrentDimension);
BOOST_STATIC_ASSERT(CurrentDimension <= traits::dimension<Box>::value);
BOOST_STATIC_ASSERT(CurrentDimension <= detail::traits::dimension<Box>::value);
static inline typename default_margin_result<Box>::type apply(Box const& b)
{
return margin_for_each_dimension<Box, CurrentDimension - 1>::apply(b) +
margin_for_each_edge<Box, CurrentDimension, traits::dimension<Box>::value>::apply(b);
margin_for_each_edge<Box, CurrentDimension, detail::traits::dimension<Box>::value>::apply(b);
}
};
@@ -86,7 +86,7 @@ struct margin_for_each_dimension<Box, 1>
{
static inline typename default_margin_result<Box>::type apply(Box const& b)
{
return margin_for_each_edge<Box, 1, traits::dimension<Box>::value>::apply(b);
return margin_for_each_edge<Box, 1, detail::traits::dimension<Box>::value>::apply(b);
}
};
@@ -95,7 +95,7 @@ struct margin_for_each_dimension<Box, 1>
template <typename Box>
typename default_margin_result<Box>::type margin(Box const& b)
{
return 2 * detail::margin_for_each_dimension<Box, traits::dimension<Box>::value>::apply(b);
return 2 * detail::margin_for_each_dimension<Box, detail::traits::dimension<Box>::value>::apply(b);
}
}}} // namespace boost::geometry::index

View File

@@ -8,10 +8,10 @@
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_INDEXABLE_HPP
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_INDEXABLE_HPP
#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_INDEXABLE_HPP
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_INDEXABLE_HPP
namespace boost { namespace geometry { namespace index {
namespace boost { namespace geometry { namespace index { namespace detail {
namespace dispatch {
@@ -172,6 +172,6 @@ struct default_box_type
> type;
};
}}} // namespace boost::geometry::index
}}}} // namespace boost::geometry::index::detail
#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_INDEXABLE_HPP
#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_INDEXABLE_HPP

View File

@@ -45,7 +45,7 @@ struct find_greatest_normalized_separation
{
typedef typename Elements::value_type element_type;
typedef typename rtree::element_indexable_type<element_type, Translator>::type indexable_type;
typedef typename index::traits::coordinate_type<indexable_type>::type coordinate_type;
typedef typename index::detail::traits::coordinate_type<indexable_type>::type coordinate_type;
static inline void apply(Elements const& elements,
Parameters const& parameters,
@@ -59,15 +59,15 @@ struct find_greatest_normalized_separation
BOOST_GEOMETRY_INDEX_ASSERT(2 <= elements_count, "unexpected number of elements");
// find the lowest low, highest high
coordinate_type lowest_low = index::get<min_corner, DimensionIndex>(rtree::element_indexable(elements[0], translator));
coordinate_type highest_high = index::get<max_corner, DimensionIndex>(rtree::element_indexable(elements[0], translator));
coordinate_type lowest_low = index::detail::get<min_corner, DimensionIndex>(rtree::element_indexable(elements[0], translator));
coordinate_type highest_high = index::detail::get<max_corner, DimensionIndex>(rtree::element_indexable(elements[0], translator));
// and the lowest high
coordinate_type lowest_high = highest_high;
size_t lowest_high_index = 0;
for ( size_t i = 1 ; i < elements_count ; ++i )
{
coordinate_type min_coord = index::get<min_corner, DimensionIndex>(rtree::element_indexable(elements[i], translator));
coordinate_type max_coord = index::get<max_corner, DimensionIndex>(rtree::element_indexable(elements[i], translator));
coordinate_type min_coord = index::detail::get<min_corner, DimensionIndex>(rtree::element_indexable(elements[i], translator));
coordinate_type max_coord = index::detail::get<max_corner, DimensionIndex>(rtree::element_indexable(elements[i], translator));
if ( max_coord < lowest_high )
{
@@ -84,10 +84,10 @@ struct find_greatest_normalized_separation
// find the highest low
size_t highest_low_index = lowest_high_index == 0 ? 1 : 0;
coordinate_type highest_low = index::get<min_corner, DimensionIndex>(rtree::element_indexable(elements[highest_low_index], translator));
coordinate_type highest_low = index::detail::get<min_corner, DimensionIndex>(rtree::element_indexable(elements[highest_low_index], translator));
for ( size_t i = highest_low_index ; i < elements_count ; ++i )
{
coordinate_type min_coord = index::get<min_corner, DimensionIndex>(rtree::element_indexable(elements[i], translator));
coordinate_type min_coord = index::detail::get<min_corner, DimensionIndex>(rtree::element_indexable(elements[i], translator));
if ( highest_low < min_coord &&
i != lowest_high_index )
{
@@ -124,7 +124,7 @@ struct pick_seeds_impl
typedef typename Elements::value_type element_type;
typedef typename rtree::element_indexable_type<element_type, Translator>::type indexable_type;
typedef typename index::traits::coordinate_type<indexable_type>::type coordinate_type;
typedef typename index::detail::traits::coordinate_type<indexable_type>::type coordinate_type;
static inline void apply(Elements const& elements,
Parameters const& parameters,
@@ -154,7 +154,7 @@ struct pick_seeds_impl<Elements, Parameters, Translator, 1>
{
typedef typename Elements::value_type element_type;
typedef typename rtree::element_indexable_type<element_type, Translator>::type indexable_type;
typedef typename index::traits::coordinate_type<indexable_type>::type coordinate_type;
typedef typename index::detail::traits::coordinate_type<indexable_type>::type coordinate_type;
static inline void apply(Elements const& elements,
Parameters const& parameters,
@@ -174,9 +174,9 @@ struct pick_seeds
{
typedef typename Elements::value_type element_type;
typedef typename rtree::element_indexable_type<element_type, Translator>::type indexable_type;
typedef typename index::traits::coordinate_type<indexable_type>::type coordinate_type;
typedef typename index::detail::traits::coordinate_type<indexable_type>::type coordinate_type;
static const size_t dimension = index::traits::dimension<indexable_type>::value;
static const size_t dimension = index::detail::traits::dimension<indexable_type>::value;
static inline void apply(Elements const& elements,
Parameters const& parameters,
@@ -214,7 +214,7 @@ struct redistribute_elements<Value, Options, Translator, Box, Allocators, linear
typedef typename rtree::elements_type<Node>::type elements_type;
typedef typename elements_type::value_type element_type;
typedef typename rtree::element_indexable_type<element_type, Translator>::type indexable_type;
typedef typename index::traits::coordinate_type<indexable_type>::type coordinate_type;
typedef typename index::detail::traits::coordinate_type<indexable_type>::type coordinate_type;
typedef typename index::default_content_result<Box>::type content_type;
elements_type & elements1 = rtree::elements(n);

View File

@@ -33,7 +33,7 @@ struct pick_seeds
{
typedef typename Elements::value_type element_type;
typedef typename rtree::element_indexable_type<element_type, Translator>::type indexable_type;
typedef typename index::traits::coordinate_type<indexable_type>::type coordinate_type;
typedef typename index::detail::traits::coordinate_type<indexable_type>::type coordinate_type;
typedef Box box_type;
typedef typename index::default_content_result<box_type>::type content_type;
@@ -100,7 +100,7 @@ struct redistribute_elements<Value, Options, Translator, Box, Allocators, quadra
typedef typename rtree::elements_type<Node>::type elements_type;
typedef typename elements_type::value_type element_type;
typedef typename rtree::element_indexable_type<element_type, Translator>::type indexable_type;
typedef typename index::traits::coordinate_type<indexable_type>::type coordinate_type;
typedef typename index::detail::traits::coordinate_type<indexable_type>::type coordinate_type;
elements_type & elements1 = rtree::elements(n);
elements_type & elements2 = rtree::elements(second_node);

View File

@@ -40,8 +40,8 @@ public:
bool operator()(Element const& e1, Element const& e2) const
{
return index::get<Corner, AxisIndex>(rtree::element_indexable(e1, m_tr))
< index::get<Corner, AxisIndex>(rtree::element_indexable(e2, m_tr));
return index::detail::get<Corner, AxisIndex>(rtree::element_indexable(e1, m_tr))
< index::detail::get<Corner, AxisIndex>(rtree::element_indexable(e2, m_tr));
}
private:
@@ -229,7 +229,7 @@ struct choose_split_axis_and_index
Parameters,
Box,
Dimension - 1,
typename index::traits::tag<element_indexable_type>::type
typename index::detail::traits::tag<element_indexable_type>::type
>::apply(elements, corner, index, sum_of_margins, overlap_val, content_val, parameters, translator); // MAY THROW, STRONG
if ( sum_of_margins < smallest_sum_of_margins )
@@ -269,7 +269,7 @@ struct choose_split_axis_and_index<Parameters, Box, 1>
Parameters,
Box,
0,
typename index::traits::tag<element_indexable_type>::type
typename index::detail::traits::tag<element_indexable_type>::type
>::apply(elements, choosen_corner, choosen_index, smallest_sum_of_margins, smallest_overlap, smallest_content, parameters, translator); // MAY THROW
}
};
@@ -325,7 +325,7 @@ struct redistribute_elements<Value, Options, Translator, Box, Allocators, rstar_
typedef typename Options::parameters_type parameters_type;
static const size_t dimension = index::traits::dimension<Box>::value;
static const size_t dimension = index::detail::traits::dimension<Box>::value;
typedef typename index::default_margin_result<Box>::type margin_type;
typedef typename index::default_content_result<Box>::type content_type;
@@ -355,7 +355,7 @@ struct redistribute_elements<Value, Options, Translator, Box, Allocators, rstar_
rstar::choose_split_axis_and_index<
typename Options::parameters_type,
Box,
index::traits::dimension<Box>::value
index::detail::traits::dimension<Box>::value
>::apply(elements1,
split_axis, split_corner, split_index,
smallest_sum_of_margins, smallest_overlap, smallest_content,
@@ -363,7 +363,7 @@ struct redistribute_elements<Value, Options, Translator, Box, Allocators, rstar_
// TODO: awulkiew - get rid of following static_casts?
BOOST_GEOMETRY_INDEX_ASSERT(split_axis < index::traits::dimension<Box>::value, "unexpected value");
BOOST_GEOMETRY_INDEX_ASSERT(split_axis < index::detail::traits::dimension<Box>::value, "unexpected value");
BOOST_GEOMETRY_INDEX_ASSERT(split_corner == static_cast<size_t>(min_corner) || split_corner == static_cast<size_t>(max_corner), "unexpected value");
BOOST_GEOMETRY_INDEX_ASSERT(parameters.get_min_elements() <= split_index && split_index <= parameters.get_max_elements() - parameters.get_min_elements() + 1, "unexpected value");

View File

@@ -116,7 +116,7 @@ public:
/*! \brief The Indexable type to which Value is translated. */
typedef typename translator::indexable_type<Translator>::type indexable_type;
/*! \brief The Box type used by the R-tree. */
typedef typename index::default_box_type<indexable_type>::type box_type;
typedef typename index::detail::default_box_type<indexable_type>::type box_type;
#if !defined(BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE)
private:

View File

@@ -28,7 +28,7 @@ struct def
{
BOOST_MPL_ASSERT_MSG(
(!detail::indexable_not_found_error<
typename traits::indexable_type<Value>::type
typename index::detail::traits::indexable_type<Value>::type
>::value),
NOT_VALID_INDEXABLE_TYPE,
(Value)
@@ -60,7 +60,7 @@ struct def< std::pair<Indexable, Second> >
{
BOOST_MPL_ASSERT_MSG(
(!detail::indexable_not_found_error<
typename traits::indexable_type<Indexable>::type
typename index::detail::traits::indexable_type<Indexable>::type
>::value),
NOT_VALID_INDEXABLE_TYPE,
(Indexable)
@@ -128,7 +128,7 @@ struct def< boost::tuple<Indexable, T1, T2, T3, T4, T5, T6, T7, T8, T9> >
BOOST_MPL_ASSERT_MSG(
(!detail::indexable_not_found_error<
typename traits::indexable_type<Indexable>::type
typename index::detail::traits::indexable_type<Indexable>::type
>::value),
NOT_VALID_INDEXABLE_TYPE,
(Indexable)

View File

@@ -21,7 +21,7 @@
#include <boost/geometry/algorithms/equals.hpp>
#include <boost/geometry/extensions/index/indexable.hpp>
#include <boost/geometry/extensions/index/detail/indexable.hpp>
namespace boost { namespace geometry { namespace index { namespace translator {
@@ -88,8 +88,8 @@ struct extract_indexable< std::pair<First, Second> >
{
typedef typename dispatch::choose_pair_element<
std::pair<First, Second>,
typename traits::indexable_type<First>::type,
typename traits::indexable_type<Second>::type
typename index::detail::traits::indexable_type<First>::type,
typename index::detail::traits::indexable_type<Second>::type
> cp;
typedef typename cp::type type;

View File

@@ -477,7 +477,7 @@ generate_value_outside()
typedef typename Rtree::value_type V;
typedef typename Rtree::indexable_type I;
return generate_value_outside_impl<V, bgi::traits::dimension<I>::value>::apply();
return generate_value_outside_impl<V, bgi::detail::traits::dimension<I>::value>::apply();
}
template<typename Value, typename Algo, typename Box>
@@ -489,7 +489,7 @@ void generate_rtree(bgi::rtree<Value, Algo> & tree, std::vector<Value> & input,
typedef typename T::indexable_type I;
generate_input<
bgi::traits::dimension<I>::value
bgi::detail::traits::dimension<I>::value
>::apply(input, qbox);
tree.insert(input.begin(), input.end());
@@ -670,7 +670,7 @@ template <typename Value, typename Algo, typename Box>
void test_overlaps(bgi::rtree<Value, Algo> const& tree, std::vector<Value> const& input, Box const& qbox)
{
test_overlap_impl<
typename bgi::traits::tag<
typename bgi::detail::traits::tag<
typename bgi::rtree<Value, Algo>::indexable_type
>::type
>::apply(tree, input, qbox);
@@ -1171,7 +1171,7 @@ void test_rtree_by_value(Parameters const& parameters)
//test_touches(tree, input, qbox);
test_within(tree, input, qbox);
typedef typename bgi::traits::point_type<B>::type P;
typedef typename bgi::detail::traits::point_type<B>::type P;
P pt;
bg::centroid(qbox, pt);