Analysis Software
Documentation for sPHENIX simulation software
|
Binary heap. More...
#include <JETSCAPE/blob/main/external_packages/gtl/include/GTL/bin_heap.h>
Public Member Functions | |
bin_heap (const Pred &prd) | |
Creates empty binary heap. | |
bin_heap (const Pred &prd, const int est_size) | |
Creates empty binary heap. | |
bin_heap (const bin_heap< T, Pred > &bh) | |
Copy constructor. | |
bin_heap< T, Pred > & | operator= (const bin_heap< T, Pred > &bh) |
Assigns bh to this binary heap. | |
~bin_heap () | |
Destructor. | |
void | push (const T &ins) |
Inserts ins in heap. | |
void | pop () |
Removes the element on top of the heap. | |
const T & | top () const |
Returns a reference to the element at the top of the heap. | |
void | changeKey (const T &cha) |
Reconstructs heap condition after changing key value of cha externally. | |
bool | is_empty () const |
Checks if heap is empty. | |
void | clear () |
Private Member Functions | |
void | bubble_up (heap_node< T > *const n) |
void | bubble_down (heap_node< T > *const n) |
Private Attributes | |
const Pred & | prd |
int | size |
int | capacity |
vector< heap_node< T > * > | container |
map< T, heap_node< T > * > | heap_node_map |
Binary heap.
Definition at line 63 of file bin_heap.h.
View newest version in sPHENIX GitHub at line 63 of file bin_heap.h
Creates empty binary heap.
prd | binary predicate to compare two T s |
Definition at line 206 of file bin_heap.h.
View newest version in sPHENIX GitHub at line 206 of file bin_heap.h
References bin_heap< T, Pred >::capacity, and bin_heap< T, Pred >::container.
bin_heap< T, Pred >::bin_heap | ( | const Pred & | prd, |
const int | est_size | ||
) |
Creates empty binary heap.
prd | binary predicate to compare two Ts |
est_size | estimated maximal size of heap |
Definition at line 214 of file bin_heap.h.
View newest version in sPHENIX GitHub at line 214 of file bin_heap.h
References bin_heap< T, Pred >::capacity, and bin_heap< T, Pred >::container.
Copy constructor.
bh | binary heap to copy |
Definition at line 226 of file bin_heap.h.
View newest version in sPHENIX GitHub at line 226 of file bin_heap.h
References bin_heap< T, Pred >::capacity, bin_heap< T, Pred >::container, i, and bin_heap< T, Pred >::size.
Destructor.
Definition at line 257 of file bin_heap.h.
View newest version in sPHENIX GitHub at line 257 of file bin_heap.h
|
private |
Definition at line 369 of file bin_heap.h.
View newest version in sPHENIX GitHub at line 369 of file bin_heap.h
References container, configureMap::data, heap_node< T >::data, j, n, heap_node< T >::pos, Acts::Test::pos, and size.
|
private |
Definition at line 349 of file bin_heap.h.
View newest version in sPHENIX GitHub at line 349 of file bin_heap.h
References container, heap_node< T >::data, n, heap_node< T >::pos, and Acts::Test::pos.
Reconstructs heap condition after changing key value of cha
externally.
cha | element with changed key value |
changeKey
doesn't operate if cha
is a primitive data structure, because it represents its key value itself, or if one object is stored more than once in the data structure.Definition at line 311 of file bin_heap.h.
View newest version in sPHENIX GitHub at line 311 of file bin_heap.h
References container, heap_node< T >::data, n, and Acts::Test::pos.
Definition at line 337 of file bin_heap.h.
View newest version in sPHENIX GitHub at line 337 of file bin_heap.h
Checks if heap is empty.
true
iff empty Definition at line 329 of file bin_heap.h.
View newest version in sPHENIX GitHub at line 329 of file bin_heap.h
References size.
bin_heap< T, Pred > & bin_heap< T, Pred >::operator= | ( | const bin_heap< T, Pred > & | bh | ) |
Assigns bh
to this binary heap.
All elements in this heap will be deleted. The predicate of this heap must be physically the same as the one of bh
.
bh | binary heap |
Definition at line 238 of file bin_heap.h.
View newest version in sPHENIX GitHub at line 238 of file bin_heap.h
References assert, bin_heap< T, Pred >::capacity, container, bin_heap< T, Pred >::container, i, bin_heap< T, Pred >::prd, bin_heap< T, Pred >::size, and size.
Removes the element on top of the heap.
Definition at line 282 of file bin_heap.h.
View newest version in sPHENIX GitHub at line 282 of file bin_heap.h
References assert, container, configureMap::data, and size.
Inserts ins
in heap.
ins | data element to be inserted |
Definition at line 264 of file bin_heap.h.
View newest version in sPHENIX GitHub at line 264 of file bin_heap.h
References container, n, heap_node< T >::pos, and size.
Returns a reference to the element at the top of the heap.
Definition at line 304 of file bin_heap.h.
View newest version in sPHENIX GitHub at line 304 of file bin_heap.h
References container.
Referenced by pypdel(), pypdfu(), structm(), structmold(), structp(), and structpold().
Definition at line 168 of file bin_heap.h.
View newest version in sPHENIX GitHub at line 168 of file bin_heap.h
Referenced by bin_heap< T, Pred >::bin_heap(), and bin_heap< T, Pred >::operator=().
Definition at line 174 of file bin_heap.h.
View newest version in sPHENIX GitHub at line 174 of file bin_heap.h
Referenced by bin_heap< T, Pred >::bin_heap(), and bin_heap< T, Pred >::operator=().
Definition at line 180 of file bin_heap.h.
View newest version in sPHENIX GitHub at line 180 of file bin_heap.h
Definition at line 155 of file bin_heap.h.
View newest version in sPHENIX GitHub at line 155 of file bin_heap.h
Referenced by bin_heap< T, Pred >::operator=().
Definition at line 161 of file bin_heap.h.
View newest version in sPHENIX GitHub at line 161 of file bin_heap.h
Referenced by bin_heap< T, Pred >::bin_heap(), and bin_heap< T, Pred >::operator=().