cheshirekow  v0.1.0
Key.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 Josh Bialkowski (jbialk@mit.edu)
3  *
4  * This file is part of mpblocks.
5  *
6  * mpblocks is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * mpblocks is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with mpblocks. If not, see <http://www.gnu.org/licenses/>.
18  */
27 #ifndef MPBLOCKS_DUBINS_KD_TREE_KEY_H_
28 #define MPBLOCKS_DUBINS_KD_TREE_KEY_H_
29 
30 
31 
32 namespace mpblocks {
33 namespace dubins {
34 namespace kd_tree {
35 
36 
38 template <class Format>
39 struct Key
40 {
41  typedef typename Traits<Format>::Node Node_t;
42  typedef Key<Format> Key_t;
43 
44  Format d2; //< distance
45  int id; //< solver id
46  Node_t* n; //< nearest node
47 
48  struct LessThan
49  {
50  bool operator()( const Key_t& a, const Key_t& b ) const
51  {
52  if( a.d2 < b.d2 )
53  return true;
54  if( a.d2 > b.d2 )
55  return false;
56  return (a.n < b.n );
57  }
58  };
59 };
60 
61 
62 } // namespace kd_tree
63 } // namespace dubins
64 } // namespace mpblocks
65 
66 
67 
68 #endif // SEARCHKEY_H_
empty struct used to template "variant" of three arc primitives
Definition: types.h:46
Traits< Format >::Node Node_t
Definition: Key.h:41
key for priority queue
Definition: Key.h:39
empty struct used to template "variant" of three arc primitives
Definition: types.h:43
Key< Format > Key_t
Definition: Key.h:42
bool operator()(const Key_t &a, const Key_t &b) const
Definition: Key.h:50