30 #define __FMS_Heap_H 1
46 typedef std::pair<value_type, uint16_type> heap_entry_type;
48 void push( heap_entry_type in )
50 M_heap.push_back( in );
51 push_heap( M_heap.begin(), M_heap.end(), farther );
54 void change( heap_entry_type in )
56 for ( heapvect_iter it=M_heap.begin(); it != M_heap.end(); ++it )
60 if (it->second == in.second)
62 if ( farther( *it, in ) )
65 make_heap( M_heap.begin(),
79 heap_entry_type out = *(M_heap.begin());
80 pop_heap( M_heap.begin(), M_heap.end(), farther );
86 bool checkExistingEntry(uint16_type index)
88 for (heapvect_iter it = M_heap.begin(); it != M_heap.end(); ++it )
89 if (it->second == index)
94 bool removeFromHeap(uint16_type index)
98 for (heapvect_iter it = M_heap.begin(); it != M_heap.end(); ++it )
99 if (it->second == index)
112 return M_heap.size();
117 typedef std::vector<heap_entry_type> heapvect_type;
118 typedef typename heapvect_type::iterator heapvect_iter;
119 typedef typename heapvect_type::const_iterator heapvect_constiter;
121 static bool farther( heap_entry_type a, heap_entry_type b )
124 value_type aa = a.first;
125 aa = aa < 0.0 ? -aa : aa;
126 value_type bb = b.first;
127 bb = bb < 0.0 ? -bb : bb;
131 std::vector<heap_entry_type> M_heap;