|
Bit vector
0.9
Fast and space efficient dynamic bit vector library.
|
Simple malloc based allocation for internal nodes and leaves. More...
#include <allocator.hpp>
Public Member Functions | |
| template<class node_type > | |
| node_type * | allocate_node () |
| Allocate new internal node. More... | |
| template<class node_type > | |
| void | deallocate_node (node_type *node) |
| Deallocate internal node. More... | |
| template<class leaf_type > | |
| leaf_type * | allocate_leaf (uint64_t size) |
Allocates a new leaf with space for storing size * 64 bits. More... | |
| template<class leaf_type > | |
| void | deallocate_leaf (leaf_type *leaf) |
| Deallocates leaf node. More... | |
| template<class leaf_type > | |
| leaf_type * | reallocate_leaf (leaf_type *leaf, uint64_t old_size, uint64_t new_size) |
| Reallocator for leaf nodes. More... | |
| uint64_t | live_allocations () const |
| Get the number of blocks currenty allocated by this allocator instance. More... | |
Protected Attributes | |
| uint64_t | allocations_ |
| Number of objects currently allocated. | |
Simple malloc based allocation for internal nodes and leaves.
Malloc and free are directly used to allocate/deallocate internal nodes.
For leaves, a block is (re)allocated for housing both the leaf "struct" and the associated data.
|
inline |
Allocates a new leaf with space for storing size * 64 bits.
Uses malloc to allocate sizeof(leaf_type) + 8 * size bytes, and initializes the first sizeof(leaf_type) bytes of the allocated block using the default constructor of leaf_type.
| leaf_type | Bit vector leaf type. Typically some kind of bv::leaf. |
| size | Number of 64-bit words to reserve for data storage. |
|
inline |
Allocate new internal node.
Simply uses malloc(sizeof(node_type)).
| node_type | Internal node type. Typically some kind of bv::node. |
|
inline |
Deallocates leaf node.
Simply calls free(leaf).
| leaf_type | Bit vector leaf type. Typically some kind of bv::leaf. |
|
inline |
Deallocate internal node.
Simply does free(node).
| node_type | Internal node type. Typically some kind of bv::node. |
| node | Internal node to deallocate. |
|
inline |
Get the number of blocks currenty allocated by this allocator instance.
|
inline |
Reallocator for leaf nodes.
Reallocates the block for a leaf and associated data.
| leaf_type | Bit vector leaf type. Typically some kind of bv::leaf. |
| leaf | Pointer to leaf_type to reallocate. |
| old_size | Size of leaf data block. (in 64 bit words.) |
| new_size | New size for leaf data block. (in 64 bit words.) |
1.8.17