30 #ifndef RTABMAP_FLANN_ALL_INDICES_H_
31 #define RTABMAP_FLANN_ALL_INDICES_H_
45 #include "rtflann/algorithms/kdtree_cuda_3d_index.h"
55 template<
bool,
typename T =
void>
struct enable_if{};
67 template <
typename T,
typename U>
79 #define HAS_MEMBER(member) \
80 template<typename T> \
84 template<typename C> static Yes test( typename C::member* ); \
85 template<typename C> static No test( ... ); \
86 enum { value = sizeof (test<T>(0))==sizeof(Yes) }; \
96 typedef float ElementType;
97 typedef float ResultType;
99 template <
typename Iterator1,
typename Iterator2>
100 ResultType
operator()(Iterator1 a, Iterator2 b,
size_t size, ResultType = -1)
const
102 return ResultType(0);
105 template <
typename U,
typename V>
106 inline ResultType accum_dist(
const U& a,
const V& b,
int)
const
108 return ResultType(0);
115 template<
template <
typename>
class Index,
typename Distance,
typename ElemType>
116 struct valid_combination
119 (!needs_kdtree_distance<Index<DummyDistance> >
::value || is_kdtree_distance<Distance>::value) &&
120 (!needs_vector_space_distance<
Index<DummyDistance> >::
value || is_kdtree_distance<Distance>::value || is_vector_space_distance<Distance>::value);
128 template <
template<
typename>
class Index,
typename Distance,
typename T>
135 template <
template<
typename>
class Index,
typename Distance,
typename T>
142 template<
typename Distance>
147 typedef typename Distance::ElementType ElementType;
151 switch (index_type) {
154 nnIndex = create_index_<LinearIndex,Distance,ElementType>(dataset,
params,
distance);
157 nnIndex = create_index_<KDTreeSingleIndex,Distance,ElementType>(dataset, params, distance);
160 nnIndex = create_index_<KDTreeIndex,Distance,ElementType>(dataset, params, distance);
164 #ifdef FLANN_USE_CUDA
165 case FLANN_INDEX_KDTREE_CUDA:
166 nnIndex = create_index_<KDTreeCuda3dIndex,Distance,ElementType>(dataset, params, distance);
171 nnIndex = create_index_<KMeansIndex,Distance,ElementType>(dataset, params, distance);
174 nnIndex = create_index_<CompositeIndex,Distance,ElementType>(dataset, params, distance);
177 nnIndex = create_index_<AutotunedIndex,Distance,ElementType>(dataset, params, distance);
180 nnIndex = create_index_<HierarchicalClusteringIndex,Distance,ElementType>(dataset, params, distance);
183 nnIndex = create_index_<LshIndex,Distance,ElementType>(dataset, params, distance);
190 throw FLANNException(
"Unsupported index/distance combination");