|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r81523 - in sandbox-branches/geometry/index_dev: boost/geometry/extensions/index/translator doc/html doc/html/geometry_index/r_tree doc/rtree
From: adam.wulkiewicz_at_[hidden]
Date: 2012-11-24 17:17:09
Author: awulkiew
Date: 2012-11-24 17:17:08 EST (Sat, 24 Nov 2012)
New Revision: 81523
URL: http://svn.boost.org/trac/boost/changeset/81523
Log:
Pointers and Iterators types removed from the default Translator.
Text files modified:
sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/translator/def.hpp | 204 ++++++++++++++++++++++++++-------------
sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/translator/helpers.hpp | 1
sandbox-branches/geometry/index_dev/doc/html/geometry_index/r_tree/creation_and_modification.html | 25 ++--
sandbox-branches/geometry/index_dev/doc/html/geometry_index/r_tree/exception_safety.html | 7
sandbox-branches/geometry/index_dev/doc/html/index.html | 2
sandbox-branches/geometry/index_dev/doc/rtree/creation.qbk | 12 +
sandbox-branches/geometry/index_dev/doc/rtree/exception_safety.qbk | 4
7 files changed, 160 insertions(+), 95 deletions(-)
Modified: sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/translator/def.hpp
==============================================================================
--- sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/translator/def.hpp (original)
+++ sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/translator/def.hpp 2012-11-24 17:17:08 EST (Sat, 24 Nov 2012)
@@ -15,100 +15,164 @@
namespace boost { namespace geometry { namespace index { namespace translator {
-namespace dispatch {
+//namespace dispatch {
+//
+//// Distinguish between def<Geometry>, def<Iterator> and def<SmartPtr>
+//
+//// Geometry
+//template <typename Value, bool IsIterator, bool IsSmartPtr>
+//struct def
+//{
+// typedef typename detail::extract_indexable<Value>::type const& result_type;
+//
+// result_type operator()(Value const& v) const
+// {
+// return detail::extract_indexable<Value>::get(v);
+// }
+//
+// bool equals(Value const& v1, Value const& v2) const
+// {
+// return detail::equals<Value>::apply(v1, v2);
+// }
+//};
+//
+//// Iterator
+//template <typename Value, bool IsSmartPtr>
+//struct def<Value, true, IsSmartPtr>
+//{
+// typedef typename detail::extract_indexable<typename Value::value_type>::type const& result_type;
+//
+// result_type operator()(Value const& v) const
+// {
+// return detail::extract_indexable<typename Value::value_type>::get(*v);
+// }
+//
+// bool equals(Value const& v1, Value const& v2) const
+// {
+// return v1 == v2;
+// }
+//};
+//
+//// SmartPtr
+//template <typename Value>
+//struct def<Value, false, true>
+//{
+// typedef typename detail::extract_indexable<typename Value::element_type>::type const& result_type;
+//
+// result_type operator()(Value const& v) const
+// {
+// return detail::extract_indexable<typename Value::element_type>::get(*v);
+// }
+//
+// bool equals(Value const& v1, Value const& v2) const
+// {
+// return v1 == v2;
+// }
+//};
+//
+//} // namespace dispatch
+//
+///*!
+//The default translator. It translates Value object to Indexable object. This is done in
+//operator() which takes const reference to Value and returns const reference to Indexable.
+//
+//\tparam Value The Value type which the translator translates to Indexable.
+//*/
+//template <typename Value>
+//struct def
+// : public dispatch::def
+// <
+// Value,
+// detail::is_iterator<Value>::value,
+// detail::is_smart_ptr<Value>::value
+// >
+//{
+//};
+//
+///*!
+//The default translator. It translates Value object to Indexable object. Since this is
+//a specialization for pointers to Values operator() takes const ptr to Value and returns
+//const reference to Indexable.
+//
+//\tparam Value The Value type which the translator translates to Indexable.
+//*/
+//template <typename Value>
+//struct def<Value*>
+//{
+// typedef typename detail::extract_indexable<Value>::type const& result_type;
+//
+// result_type operator()(const Value *v) const
+// {
+// return detail::extract_indexable<Value>::get(*v);
+// }
+//
+// bool equals(const Value* v1, const Value* v2) const
+// {
+// return v1 == v2;
+// }
+//};
-// Distinguish between def<Geometry>, def<Iterator> and def<SmartPtr>
+/*!
+The default translator. It translates Value object to Indexable object.
-// Geometry
-template <typename Value, bool IsIterator, bool IsSmartPtr>
+\tparam Value The Value type which may be translated directly to the Indexable.
+*/
+template <typename Value>
struct def
{
- typedef typename detail::extract_indexable<Value>::type const& result_type;
-
- result_type operator()(Value const& v) const
- {
- return detail::extract_indexable<Value>::get(v);
- }
-
- bool equals(Value const& v1, Value const& v2) const
- {
- return detail::equals<Value>::apply(v1, v2);
- }
-};
-
-// Iterator
-template <typename Value, bool IsSmartPtr>
-struct def<Value, true, IsSmartPtr>
-{
- typedef typename detail::extract_indexable<typename Value::value_type>::type const& result_type;
-
- result_type operator()(Value const& v) const
- {
- return detail::extract_indexable<typename Value::value_type>::get(*v);
- }
+ BOOST_MPL_ASSERT_MSG(
+ (!detail::indexable_not_found_error<
+ typename traits::indexable_type<Value>::type
+ >::value),
+ NOT_VALID_INDEXABLE_TYPE,
+ (Value)
+ );
- bool equals(Value const& v1, Value const& v2) const
- {
- return v1 == v2;
- }
-};
+ typedef Value const& result_type;
-// SmartPtr
-template <typename Value>
-struct def<Value, false, true>
-{
- typedef typename detail::extract_indexable<typename Value::element_type>::type const& result_type;
-
- result_type operator()(Value const& v) const
+ result_type operator()(Value const& value) const
{
- return detail::extract_indexable<typename Value::element_type>::get(*v);
+ return value;
}
bool equals(Value const& v1, Value const& v2) const
{
- return v1 == v2;
+ return geometry::equals(v1, v2);
}
};
-} // namespace dispatch
-
/*!
-The default translator. It translates Value object to Indexable object. This is done in
-operator() which takes const reference to Value and returns const reference to Indexable.
+The default translator. This specialization translates from std::pair<Indexable, Second>.
-\tparam Value The Value type which the translator translates to Indexable.
+\tparam Indexable The Indexable type.
+\tparam Second The second type.
*/
-template <typename Value>
-struct def
- : public dispatch::def
- <
- Value,
- detail::is_iterator<Value>::value,
- detail::is_smart_ptr<Value>::value
- >
+template <typename Indexable, typename Second>
+struct def< std::pair<Indexable, Second> >
{
-};
-
-/*!
-The default translator. It translates Value object to Indexable object. Since this is
-a specialization for pointers to Values operator() takes const ptr to Value and returns
-const reference to Indexable.
+ BOOST_MPL_ASSERT_MSG(
+ (!detail::indexable_not_found_error<
+ typename traits::indexable_type<Indexable>::type
+ >::value),
+ NOT_VALID_INDEXABLE_TYPE,
+ (Indexable)
+ );
-\tparam Value The Value type which the translator translates to Indexable.
-*/
-template <typename Value>
-struct def<Value*>
-{
- typedef typename detail::extract_indexable<Value>::type const& result_type;
+ typedef Indexable const& result_type;
- result_type operator()(const Value *v) const
+ result_type operator()(std::pair<Indexable, Second> const& value) const
{
- return detail::extract_indexable<Value>::get(*v);
+ return value.first;
}
- bool equals(const Value* v1, const Value* v2) const
+ bool equals(std::pair<Indexable, Second> const& v1, std::pair<Indexable, Second> const& v2) const
{
- return v1 == v2;
+ return geometry::equals(v1.first, v2.first)
+ &&
+ dispatch::equals<
+ Second,
+ typename geometry::traits::tag<Second>::type
+ >::apply(v1.second, v2.second);
}
};
Modified: sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/translator/helpers.hpp
==============================================================================
--- sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/translator/helpers.hpp (original)
+++ sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/translator/helpers.hpp 2012-11-24 17:17:08 EST (Sat, 24 Nov 2012)
@@ -15,6 +15,7 @@
#include <boost/static_assert.hpp>
+#include <boost/mpl/assert.hpp>
#include <boost/mpl/has_xxx.hpp>
#include <boost/mpl/and.hpp>
Modified: sandbox-branches/geometry/index_dev/doc/html/geometry_index/r_tree/creation_and_modification.html
==============================================================================
--- sandbox-branches/geometry/index_dev/doc/html/geometry_index/r_tree/creation_and_modification.html (original)
+++ sandbox-branches/geometry/index_dev/doc/html/geometry_index/r_tree/creation_and_modification.html 2012-11-24 17:17:08 EST (Sat, 24 Nov 2012)
@@ -83,11 +83,10 @@
<code class="computeroutput">Indexable</code>s. Each type adapted to <code class="computeroutput">Point</code>
or <code class="computeroutput">Box</code>
concept is an <code class="computeroutput">Indexable</code>. Default <code class="computeroutput">Translator</code>
- <code class="computeroutput"><span class="identifier">index</span><span class="special">::</span><span class="identifier">translator</span><span class="special">::</span><span class="identifier">def</span><span class="special"><</span><span class="identifier">Value</span><span class="special">></span></code>
- is able to handle <code class="computeroutput">Point</code>,
- <code class="computeroutput">Box</code>,
- <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special"><...></span></code>,
- pointer, iterator or smart pointer.
+ <code class="computeroutput"><span class="identifier">index</span><span class="special">::</span><span class="identifier">translator</span><span class="special">::</span><span class="identifier">def</span><span class="special"><</span>Value<span class="special">></span></code> is able to handle <code class="computeroutput">Point</code>,
+ <code class="computeroutput">Box</code>
+ or <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special"><...></span></code>
+ <code class="computeroutput">Value</code>s.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
@@ -95,17 +94,17 @@
<span class="special">|</span> Box</code>
</li>
<li class="listitem">
- <code class="computeroutput"><span class="identifier">BasicValue</span> <span class="special">=</span>
- <span class="identifier">Indexable</span> <span class="special">|</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special"><</span>Indexable<span class="special">,</span> <span class="identifier">T</span><span class="special">></span> <span class="special">|</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> Indexable<span class="special">></span></code>
- </li>
-<li class="listitem">
- <code class="computeroutput">Value <span class="special">=</span> <span class="identifier">BasicValue</span>
- <span class="special">|</span> <span class="identifier">BasicValue</span><span class="special">*</span> <span class="special">|</span> <span class="identifier">Iterator</span><span class="special"><</span><span class="identifier">BasicValue</span><span class="special">></span>
- <span class="special">|</span> <span class="identifier">SmartPtr</span><span class="special"><</span><span class="identifier">BasicValue</span><span class="special">></span></code>
+ <code class="computeroutput">Value <span class="special">=</span> <span class="identifier">Indexable</span>
+ <span class="special">|</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special"><</span>Indexable<span class="special">,</span>
+ <span class="identifier">T</span><span class="special">></span></code>
</li>
</ul></div>
<p>
+ If comparison of two <code class="computeroutput">Value</code>s is required, the default translator
+ compares both components of the <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special"><...></span></code>. If the second one is a <code class="computeroutput"><span class="identifier">Geometry</span></code>, <code class="computeroutput"><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">equals</span><span class="special">()</span></code> function is used. For other types it
+ uses <code class="computeroutput"><span class="keyword">operator</span><span class="special">==()</span></code>.
+ </p>
+<p>
Examples of <code class="computeroutput">Value</code> types:
</p>
<pre class="programlisting"><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">model</span><span class="special">::</span><span class="identifier">point</span><span class="special"><...></span>
Modified: sandbox-branches/geometry/index_dev/doc/html/geometry_index/r_tree/exception_safety.html
==============================================================================
--- sandbox-branches/geometry/index_dev/doc/html/geometry_index/r_tree/exception_safety.html (original)
+++ sandbox-branches/geometry/index_dev/doc/html/geometry_index/r_tree/exception_safety.html 2012-11-24 17:17:08 EST (Sat, 24 Nov 2012)
@@ -351,13 +351,12 @@
</tbody>
<tbody class="footnotes"><tr><td colspan="2">
<div class="footnote"><p><sup>[<a id="ftn.geometry_index.r_tree.exception_safety.f0" href="#geometry_index.r_tree.exception_safety.f0" class="para">a</a>] </sup>
- <span class="emphasis"><em>nothrow</em></span> - if allocators are equal, <span class="bold"><strong>strong</strong></span> - if allocators aren't equal
+ <span class="emphasis"><em>nothrow</em></span> - if allocators are equal, <span class="bold"><strong>strong</strong></span> - otherwise
</p></div>
<div class="footnote"><p><sup>[<a id="ftn.geometry_index.r_tree.exception_safety.f1" href="#geometry_index.r_tree.exception_safety.f1" class="para">b</a>] </sup>
<span class="emphasis"><em>nothrow</em></span> - if <code class="computeroutput"><span class="identifier">CoordinateType</span></code>
- has nonthrowing copy ctor, <span class="bold"><strong>strong</strong></span>
- - if <code class="computeroutput"><span class="identifier">CoordinateType</span></code>
- has throwing copy ctor
+ has nonthrowing copy constructor, <span class="bold"><strong>strong</strong></span>
+ - otherwise
</p></div>
</td></tr></tbody>
</table></div>
Modified: sandbox-branches/geometry/index_dev/doc/html/index.html
==============================================================================
--- sandbox-branches/geometry/index_dev/doc/html/index.html (original)
+++ sandbox-branches/geometry/index_dev/doc/html/index.html 2012-11-24 17:17:08 EST (Sat, 24 Nov 2012)
@@ -56,7 +56,7 @@
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
-<td align="left"><p><small>Last revised: November 24, 2012 at 19:48:27 GMT</small></p></td>
+<td align="left"><p><small>Last revised: November 24, 2012 at 22:04:48 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>
Modified: sandbox-branches/geometry/index_dev/doc/rtree/creation.qbk
==============================================================================
--- sandbox-branches/geometry/index_dev/doc/rtree/creation.qbk (original)
+++ sandbox-branches/geometry/index_dev/doc/rtree/creation.qbk 2012-11-24 17:17:08 EST (Sat, 24 Nov 2012)
@@ -31,13 +31,15 @@
is passed as parameter. It knows how to interpret those `__value__`s
and extract an object understandable by the __rtree__. Those objects are called
`__indexable__`s. Each type adapted to `__point__` or `__box__` concept is an `__indexable__`.
-Default `__translator__` `index::translator::def<Value>`
-is able to handle `__point__`, `__box__`, `std::pair<...>`, pointer, iterator
-or smart pointer.
+Default `__translator__` `index::translator::def<__value__>`
+is able to handle `__point__`, `__box__` or `std::pair<...>` `__value__`s.
* `__indexable__ = __point__ | __box__`
-* `BasicValue = Indexable | std::pair<__indexable__, T> | std::pair<T, __indexable__>`
-* `__value__ = BasicValue | BasicValue* | Iterator<BasicValue> | SmartPtr<BasicValue>`
+* `__value__ = Indexable | std::pair<__indexable__, T>`
+
+If comparison of two `__value__`s is required, the default translator compares
+both components of the `std::pair<...>`. If the second one is a `Geometry`,
+`geometry::equals()` function is used. For other types it uses `operator==()`.
Examples of `__value__` types:
Modified: sandbox-branches/geometry/index_dev/doc/rtree/exception_safety.qbk
==============================================================================
--- sandbox-branches/geometry/index_dev/doc/rtree/exception_safety.qbk (original)
+++ sandbox-branches/geometry/index_dev/doc/rtree/exception_safety.qbk 2012-11-24 17:17:08 EST (Sat, 24 Nov 2012)
@@ -28,7 +28,7 @@
[[][]]
[[`rtree(rtree &&)`] [ /nothrow/ ]]
[[`operator=(rtree &&)`] [ /nothrow/ or *strong*
-[footnote /nothrow/ - if allocators are equal, *strong* - if allocators aren't equal]]]
+[footnote /nothrow/ - if allocators are equal, *strong* - otherwise]]]
[[`swap(rtree &)`] [ /nothrow/ ]]
[[][]]
[[`insert(__value__)`] [ basic ]]
@@ -43,7 +43,7 @@
[[`empty()`] [ /nothrow/ ]]
[[`clear()`] [ /nothrow/ ]]
[[`box()`] [ /nothrow/ or *strong*
-[footnote /nothrow/ - if `CoordinateType` has nonthrowing copy ctor, *strong* - if `CoordinateType` has throwing copy ctor]]]
+[footnote /nothrow/ - if `CoordinateType` has nonthrowing copy constructor, *strong* - otherwise]]]
[[`get_allocator()`] [ /nothrow/ ]]
[[`parameters()`] [ /nothrow/ ]]
[[`translator()`] [ /nothrow/ ]]
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk