![]() |
Belle II Software development
|
Memory pool for pre-allocating and reusing KDTNode objects. More...
#include <Utils.h>
Public Member Functions | |
| KDTNodePool (size_t capacity) | |
| Constructs a pool with the specified capacity. | |
| ~KDTNodePool () | |
| Destructor. | |
| KDTNodePool (const KDTNodePool &)=delete | |
| Copy constructor. | |
| KDTNodePool & | operator= (const KDTNodePool &)=delete |
| Assignment operator. | |
| KDTNode * | allocate () |
| Allocates and returns the next available KDTNode from the pool. | |
| void | reset () |
| Resets the pool index, making all nodes available for reuse. | |
Private Attributes | |
| std::vector< KDTNode * > | m_pool |
| Internal storage for preallocated KD-tree nodes. | |
| size_t | m_index |
| Current index for the next available node in the pool. | |
Memory pool for pre-allocating and reusing KDTNode objects.
Improves performance by avoiding dynamic memory allocation during KD-tree construction. Nodes are allocated once at initialization and reset between KD-tree builds.
|
explicit |
Constructs a pool with the specified capacity.
Preallocates memory for a given number of KD-tree nodes.
| capacity | Maximum number of KDTNodes to allocate. |
Definition at line 18 of file Utils.cc.
| ~KDTNodePool | ( | ) |
| KDTNode * allocate | ( | ) |
| void reset | ( | ) |
|
private |
|
private |