43  void swap(
unsigned int i,
unsigned int j) 
override;
 
   47  void insert(
T *
we,
float v);
 
   49  void update(
T *
we,
float nv);
 
   51  int remove(
T *
we) 
override;
 
   58  inline int parent(
int i)
 const {
return (
i-1)/2;}
 
   60  inline int left(
int i)
 const {
return 2*
i+1;}
 
   62  inline int right(
int i)
 const {
return 2*
i+2;}
 
 
  108  if (
we==
nullptr)               { 
return; }
 
  109  if (
we->heapPosition != -1) { 
return; }
 
 
  123  if (
we==
nullptr) { 
return; }
 
  125  if (
we->heapPosition == -1)
 
 
  143  if (
we == 
nullptr) { 
return -1; }
 
  145  const int i = 
we->heapPosition;
 
  146  if (
i == -1) { 
return -1; }
 
  149  if (
i >= 
n) { 
return -1; }
 
 
  178  const int i = 
we->heapPosition;
 
  179  if (
i == -1) { 
return; }
 
  182  if (
i >= 
n) { 
return; }
 
  184  const float ov = 
static_cast<float>(
we->value);
 
 
  203  if (
i==0) { 
return 0; }
 
  204  const int pi = parent(
i);
 
  216int CSOObjectHeap<T>::downHeap(
int i)
 
  221  if (
i >= 
n) { 
return -1; }
 
  243  for (
i = 0; 
i < 
n; ++
i)
 
  248  n = 
newheap->CSOObjectVector<T>::num();
 
  249  for ( 
i = 0; 
i < 
n; ++
i)
 
  251    insert(
newheap->CSOObjectVector<T>::at(
i));
 
 
Heap structure with property i>2*i+1 and i>2*i+2 Parent i has children 2*i+1 and 2*i+2 Smallest value...
 
T * root() const
Get root (first) element of heap, typecast from CSOLiveWireNode to T.
 
void insert(T *we)
Insert heap element, resort heap.
 
int remove(T *we) override
Remove heap element, resort heap.
 
void swap(unsigned int i, unsigned int j) override
Swap two heap elements and resort heap.
 
~CSOObjectHeap() override
Standard destructor.
 
void update(T *we, float nv)
Update given heap element with new value, resort heap.
 
Dynamic templated vector For speed and better memory handling, the vector is an array within an array...
 
unsigned int num() const
Returns number of elements in the vector.
 
virtual void swap(unsigned int p1, unsigned int p2)
Swaps two elements in vector.
 
T * firstBoundsCheck() const
Returns first element, return NULL when out of range.
 
T * at(unsigned int pos) const
Returns element at given position.
 
virtual void deleteLast()
Deletes last element of vector.
 
virtual unsigned int appendUnsafe(T *elem)
Appends element to back of vector, don't check on element being non-NULL Don't use this function dire...
 
virtual void clear()
Clears all internal pointers This does not delete the elements in the vector!!
 
T * last() const
Returns last element.
 
Target mlrange_cast(Source arg)
Generic version of checked ML casts.