Spatial C++ Library
Generic Multi-Dimensional Containers and Spatial Operations
point_multiset.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 
23 #ifndef SPATIAL_POINT_MULTISET_HPP
24 #define SPATIAL_POINT_MULTISET_HPP
25 
26 #include <memory> // std::allocator
27 #include "function.hpp"
28 #include "bits/spatial_relaxed_kdtree.hpp"
29 
30 namespace spatial
31 {
32 
33  template<dimension_type Rank, typename Key,
34  typename Compare = bracket_less<Key>,
35  typename BalancingPolicy = loose_balancing,
36  typename Alloc = std::allocator<Key> >
38  : details::Relaxed_kdtree<details::Static_rank<Rank>, const Key, const Key,
39  Compare, BalancingPolicy, Alloc>
40  {
41  private:
42  typedef
44  Compare, BalancingPolicy, Alloc> base_type;
46 
47  public:
49 
50  explicit point_multiset(const Compare& compare)
51  : base_type(details::Static_rank<Rank>(), compare)
52  { }
53 
54  point_multiset(const Compare& compare, const BalancingPolicy& balancing)
55  : base_type(details::Static_rank<Rank>(), compare, balancing)
56  { }
57 
58  point_multiset(const Compare& compare, const BalancingPolicy& balancing,
59  const Alloc& alloc)
60  : base_type(details::Static_rank<Rank>(), compare, balancing, alloc)
61  { }
62 
64  : base_type(other)
65  { }
66 
68  operator=(const point_multiset& other)
69  { return static_cast<Self&>(base_type::operator=(other)); }
70  };
71 
82  template<typename Key, typename Compare, typename BalancingPolicy,
83  typename Alloc>
84  struct point_multiset<0, Key, Compare, BalancingPolicy, Alloc>
85  : details::Relaxed_kdtree<details::Dynamic_rank, const Key, const Key,
86  Compare, BalancingPolicy, Alloc>
87  {
88  private:
89  typedef details::Relaxed_kdtree<details::Dynamic_rank, const Key, const Key,
90  Compare, BalancingPolicy, Alloc> base_type;
92 
93  public:
95 
97  : base_type(details::Dynamic_rank(dim))
98  { except::check_rank(dim); }
99 
100  point_multiset(dimension_type dim, const Compare& compare)
101  : base_type(details::Dynamic_rank(dim), compare)
102  { except::check_rank(dim); }
103 
104  point_multiset(dimension_type dim, const Compare& compare,
105  const BalancingPolicy& policy)
106  : base_type(details::Dynamic_rank(dim), compare, policy)
107  { except::check_rank(dim); }
108 
109  point_multiset(dimension_type dim, const Compare& compare,
110  const BalancingPolicy& policy, const Alloc& alloc)
111  : base_type(details::Dynamic_rank(dim), compare, policy, alloc)
112  { except::check_rank(dim); }
113 
114  explicit point_multiset(const Compare& compare)
115  : base_type(details::Dynamic_rank(), compare)
116  { }
117 
118  point_multiset(const Compare& compare, const BalancingPolicy& policy)
119  : base_type(details::Dynamic_rank(), compare, policy)
120  { }
121 
122  point_multiset(const Compare& compare, const BalancingPolicy& policy,
123  const Alloc& alloc)
124  : base_type(details::Dynamic_rank(), compare, policy, alloc)
125  { }
126 
128  : base_type(other)
129  { }
130 
132  operator=(const point_multiset& other)
133  { return static_cast<Self&>(base_type::operator=(other)); }
134  };
135 
136 }
137 
138 #endif // SPATIAL_POINT_MULTISET_HPP
Relaxed_kdtree & operator=(const Relaxed_kdtree &other)
Assignment of other into the tree, with deep copy.
point_multiset(const point_multiset &other)
Detailed implementation of the kd-tree.
Specialization for spatial::point_multiset with runtime rank support.
The dimension value is stored by a member of the object, but can be modified at run time...
point_multiset(dimension_type dim, const Compare &compare, const BalancingPolicy &policy, const Alloc &alloc)
point_multiset(dimension_type dim, const Compare &compare)
point_multiset< 0, Key, Compare, BalancingPolicy, Alloc > Self
details::Relaxed_kdtree< details::Static_rank< Rank >, const Key, const Key, Compare, BalancingPolicy, Alloc > base_type
details::Relaxed_kdtree< details::Dynamic_rank, const Key, const Key, Compare, BalancingPolicy, Alloc > base_type
point_multiset(const Compare &compare, const BalancingPolicy &policy)
point_multiset(const Compare &compare, const BalancingPolicy &balancing)
void check_rank(dimension_type rank)
Checks that rank is not null.
point_multiset & operator=(const point_multiset &other)
std::size_t dimension_type
Defines the type for the dimension as being a size.
Definition: spatial.hpp:71
point_multiset(const Compare &compare)
point_multiset(const Compare &compare, const BalancingPolicy &balancing, const Alloc &alloc)
The main namespace used in the library.
Definition: algorithm.hpp:23
point_multiset & operator=(const point_multiset &other)
point_multiset(const Compare &compare, const BalancingPolicy &policy, const Alloc &alloc)
point_multiset(dimension_type dim, const Compare &compare, const BalancingPolicy &policy)
point_multiset< Rank, Key, Compare, BalancingPolicy, Alloc > Self