37 #ifndef OMPL_DATASTRUCTURES_GRID_B_
38 #define OMPL_DATASTRUCTURES_GRID_B_
40 #include "ompl/datastructures/GridN.h"
41 #include "ompl/datastructures/BinaryHeap.h"
48 template <
typename _T,
49 class LessThanExternal = std::less<_T>,
50 class LessThanInternal = LessThanExternal >
69 struct CellX :
public Cell
153 (static_cast<CellX*>(cell)->heapElement));
156 (static_cast<CellX*>(cell)->heapElement));
162 std::vector< Cell* > cells;
164 for (
int i = cells.size() - 1 ; i >= 0 ; --i)
173 CellX* cell =
new CellX();
179 for (
typename CellArray::iterator cl = list->begin() ; cl != list->end() ; ++cl)
181 CellX* c =
static_cast<CellX*
>(*cl);
182 bool wasBorder = c->border;
190 external_.
update(reinterpret_cast<typename externalBHeap::Element*>(c->heapElement));
195 external_.
remove(reinterpret_cast<typename externalBHeap::Element*>(c->heapElement));
199 internal_.
update(reinterpret_cast<typename internalBHeap::Element*>(c->heapElement));
205 cell->border =
false;
210 return static_cast<Cell*
>(cell);
216 CellX* ccell =
static_cast<CellX*
>(cell);
228 virtual bool remove(
Cell* cell)
235 for (
typename CellArray::iterator cl = list->begin() ; cl != list->end() ; ++cl)
237 CellX* c =
static_cast<CellX*
>(*cl);
238 bool wasBorder = c->border;
248 external_.
update(reinterpret_cast<typename externalBHeap::Element*>(c->heapElement));
251 internal_.
remove(reinterpret_cast<typename internalBHeap::Element*>(c->heapElement));
256 internal_.
update(reinterpret_cast<typename internalBHeap::Element*>(c->heapElement));
265 CellX* cx =
static_cast<CellX*
>(cell);
267 external_.
remove(reinterpret_cast<typename externalBHeap::Element*>(cx->heapElement));
269 internal_.
remove(reinterpret_cast<typename internalBHeap::Element*>(cx->heapElement));
282 virtual void status(std::ostream &out = std::cout)
const
321 bool operator()(
const CellX*
const a,
const CellX*
const b)
const
323 return lt_(a->data, b->data);
327 LessThanInternal lt_;
333 bool operator()(
const CellX*
const a,
const CellX*
const b)
const
335 return lt_(a->data, b->data);
338 LessThanExternal lt_;
350 element->data->heapElement =
reinterpret_cast<void*
>(element);
356 element->data->heapElement =
reinterpret_cast<void*
>(element);