Spatial C++ Library
Generic Multi-Dimensional Containers and Spatial Operations
traits.hpp
1 // -*- C++ -*-
2 //
3 // Copyright Sylvain Bougerel 2009 - 2013.
4 // Distributed under the Boost Software License, Version 1.0.
5 // (See accompanying file COPYING or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
7 
14 #ifndef SPATIAL_TRAITS_HPP
15 #define SPATIAL_TRAITS_HPP
16 
17 namespace spatial
18 {
19  /*
20  * The linking mode traits of the trees in spatial.
21  *
22  * The linking mode represents how nodes are related to the link. The link
23  * binds together in the same object the node information, the key and the
24  * value type. The linking mode allows to retrieve each of these objects from
25  * the node, and allows to retrieve the node from the link itself.
26  *
27  * \tparam Mode A model of \linkmode.
28  */
29  template<typename Mode>
30  struct mode_traits
31  {
33  typedef typename Mode::invariant_category invariant_category;
34  };
35 
41  template<typename Tp>
43  {
48  typedef typename Tp::key_type key_type;
49 
57  typedef typename Tp::value_type value_type;
58 
63  typedef typename Tp::pointer pointer;
64 
66  typedef typename Tp::const_pointer const_pointer;
67 
72  typedef typename Tp::reference reference;
73 
75  typedef typename Tp::const_reference const_reference;
76 
82  typedef typename Tp::mode_type mode_type;
83 
85  typedef typename Tp::size_type size_type;
86 
88  typedef typename Tp::difference_type difference_type;
89 
91  typedef typename Tp::allocator_type allocator_type;
92 
98  typedef typename Tp::key_compare key_compare;
99 
104  typedef typename Tp::value_compare value_compare;
105 
111  typedef typename Tp::rank_type rank_type;
112 
117  typedef typename Tp::iterator iterator;
118 
123  typedef typename Tp::const_iterator const_iterator;
124  };
125 
133  template <typename Tp>
135  {
143  typedef typename Tp::distance_type distance_type;
144  };
145 
146 } //namespace spatial
147 
148 #endif // SPATIAL_TRAITS_HPP
Tp::size_type size_type
The size type is used to list the number of element in the tree.
Definition: traits.hpp:85
Tp::const_reference const_reference
Represent a reference to a key_type. key_type is always constant.
Definition: traits.hpp:75
Tp::distance_type distance_type
The type used by the metric to represent distances.
Definition: traits.hpp:143
Tp::value_compare value_compare
Comparison functor used to compare two instances of value_type.
Definition: traits.hpp:104
Tp::reference reference
Represent a reference to a key_type.
Definition: traits.hpp:72
Tp::key_compare key_compare
Comparison functor used to compare two instances of key_type.
Definition: traits.hpp:98
Tp::pointer pointer
Represent a pointer to a value_type.
Definition: traits.hpp:63
Tp::value_type value_type
When mapped_type and key_type are different, value_type holds a pair formed by key_type (first) and m...
Definition: traits.hpp:57
Tp::difference_type difference_type
The difference type is used when 2 iterators from the tree are substracted.
Definition: traits.hpp:88
Tp::iterator iterator
The type used to iterate a container.
Definition: traits.hpp:117
Tp::key_type key_type
The type representing the key managed by the container.
Definition: traits.hpp:48
Tp::allocator_type allocator_type
The allocator used in the container.
Definition: traits.hpp:91
The traits type for all metrics in the spatial namespace.
Definition: traits.hpp:134
Tp::const_iterator const_iterator
The type used to iterate a constant container.
Definition: traits.hpp:123
The traits type for all containers in the spatial namespace.
Definition: traits.hpp:42
Tp::mode_type mode_type
The Link Mode type that is associated with the container.
Definition: traits.hpp:82
Tp::rank_type rank_type
The type used to represent the rank of the container.
Definition: traits.hpp:111
The main namespace used in the library.
Definition: algorithm.hpp:23
Mode::invariant_category invariant_category
The invarient category for the linking mode.
Definition: traits.hpp:33
Tp::const_pointer const_pointer
Represent a pointer to a key_type. key_type is always constant.
Definition: traits.hpp:66