|
CookMem 1.4.0
A C++ memory context / allocator
|
#include <avltree.h>
Public Member Functions | |
| PtrAVLTree () | |
| ~PtrAVLTree () | |
| void | add (void *ptr, std::size_t size) |
| void * | remove (std::size_t &size, std::size_t limit=~static_cast< std::size_t >(0)) |
| void | remove (void *ptr) |
| bool | contains (void *ptr) |
| bool | canGrowInPlace (void *ptr, std::size_t newSize) |
| bool | isEmpty () |
| void | printGraph () |
This is an internally used AVL tree that uses the pointer passed in store the information.
|
inline |
Default constructor.
|
inline |
Well, we do not do destructor maintenance.
Add a pointer to the search tree.
Note that the size of the pointer must be at least (7 * sizeof(size_t)).
| ptr | the pointer to be added to the AVL tree. |
| size | the size of the pointer |
Check if a node in the tree can take a larger size without changing its position in the tree. If so, the caller can update the size in place instead of removing the node and adding it back.
| ptr | the pointer stored in the tree. |
| newSize | the new size, which must be larger than the current size. |
Check if the pointer is stored in the tree.
| ptr | the pointer to be searched. |
|
inline |
Check if the tree is empty.
|
inline |
Debugging function that prints the tree nodes to GraphViz format.
|
inline |
Remove a node based on the size information. The node obtained has the size that at least the size obtained.
| [in,out] | size | search key. If the node is found, the actual size of the pointer is returned. |
| limit | the node must be smaller than this value. Otherwise nothing is removed. |
Remove a node based on the pointer info.
| ptr | the pointer to be removed from the tree |