|
The Pedigree Project 0.1
|
A key/value dictionary. More...
#include <Tree.h>
Inheritance diagram for Tree< K, E >:
Collaboration diagram for Tree< K, E >:Classes | |
| class | IteratorNode |
| struct | Node |
Public Types | |
| typedef ::TreeIterator< E, IteratorNode, &IteratorNode::previous, &IteratorNode::next, K > | Iterator |
| typedef Iterator::Const | ConstIterator |
Public Member Functions | |
| Tree () | |
| Tree (const Tree &x) | |
| ~Tree () | |
| Tree & | operator= (const Tree &x) |
| size_t | count () const |
| void | insert (const K &key, const E &value) |
| void | insert (const K &key, E &&value) |
| bool | tryInsert (const K &key, const E &value) |
| bool | tryInsert (const K &key, E &&value) |
| E | lookup (const K &key) const |
| E * | find (const K &key) |
| const E & | lookupRef (const K &key, const E &failed=E()) const |
| bool | lowerBound (const K &key, K &foundKey, E &foundValue) const |
| bool | floorBound (const K &key, K &foundKey, E &foundValue) const |
| bool | contains (const K &key) const |
| void | remove (const K &key) |
| bool | take (const K &key, E &element) |
| void | clear () |
| void | erase (Iterator iter) |
| Iterator | begin () |
| ConstIterator | begin () const |
| Iterator | end () |
| ConstIterator | end () const |
Private Member Functions | |
| void | copyFrom (const Tree &other) |
| void | rotateLeft (Node *n) |
| void | rotateRight (Node *n) |
| size_t | height (Node *n) |
| int | balanceFactor (Node *n) |
| void | rebalanceNode (Node *n) |
| void | traverseNode_Insert (Node *n) |
| void | traverseNode_Remove (Node *n) |
| Node * | createInsertionNode (const K &key, bool &inserted) |
Private Attributes | |
| Node * | root |
| size_t | nItems |
| IteratorNode * | m_Begin |
A key/value dictionary.
Dictionary class, aka Map. This is implemented as an AVL self-balancing binary search tree.
| typedef Iterator::Const Tree< K, E >::ConstIterator |
| typedef ::TreeIterator<E, IteratorNode, &IteratorNode::previous, &IteratorNode::next, K> Tree< K, E >::Iterator |
Get an iterator pointing to the beginning of the Vector
Definition at line 402 of file Tree.h.
Referenced by CacheManager::acquireCache(), PosixSubsystem::acquireNextFileDescriptor(), MemoryMappedFile::clone(), PosixSubsystem::copyDescriptors(), Ext2Filesystem::deviceRemoved(), DynamicLinker::DynamicLinker(), CacheManager::executeRequest(), PosixSubsystem::freeMultipleFds(), VFS::getFilesystemAt(), UserManager::getGroup(), UserManager::getUser(), Scheduler::hasActiveSyscallLocked(), SymbolTable::lookup(), PosixSubsystem::PosixSubsystem(), MemoryMapManager::prepareFileResize(), VFS::removeEphemeralFiles(), Scheduler::sampleLoadAverage(), MemoryMappedFile::setPermissions(), Ext2Filesystem::shutdown(), MemoryMappedFile::stageSlice(), Ext2Filesystem::sync(), VFS::syncAll(), PosixSubsystem::~PosixSubsystem(), and VFS::~VFS().
Here is the caller graph for this function:
|
inline |
|
inline |
Clear the Vector
Definition at line 383 of file Tree.h.
Referenced by MemoryMappedFile::clearMappings(), Ext2Filesystem::shutdown(), PosixSubsystem::~PosixSubsystem(), and VFS::~VFS().
Here is the caller graph for this function:
|
inline |
Reports whether a given key exists in the tree.
Definition at line 287 of file Tree.h.
Referenced by MappingList< Object >::reserveBack(), and MemoryMappedFile::split().
Here is the caller graph for this function:
|
inline |
Get the number of elements in the Tree
Definition at line 142 of file Tree.h.
Referenced by MemoryMappedFile::getMappingCount(), MemoryMapManager::prepareFileResize(), Scheduler::sampleLoadAverage(), CacheManager::shutdown(), MemoryMappedFile::stageSlice(), Ext2Filesystem::sync(), and VFS::syncAll().
Here is the caller graph for this function:Get an iterator pointing to the last element + 1
Definition at line 427 of file Tree.h.
Referenced by CacheManager::acquireCache(), PosixSubsystem::acquireNextFileDescriptor(), MemoryMappedFile::clone(), PosixSubsystem::copyDescriptors(), Ext2Filesystem::deviceRemoved(), DynamicLinker::DynamicLinker(), CacheManager::executeRequest(), PosixSubsystem::freeMultipleFds(), VFS::getFilesystemAt(), UserManager::getGroup(), UserManager::getUser(), Scheduler::hasActiveSyscallLocked(), SymbolTable::lookup(), PosixSubsystem::PosixSubsystem(), MemoryMapManager::prepareFileResize(), VFS::removeEphemeralFiles(), Scheduler::sampleLoadAverage(), MemoryMappedFile::setPermissions(), Ext2Filesystem::shutdown(), MemoryMappedFile::stageSlice(), Ext2Filesystem::sync(), VFS::syncAll(), PosixSubsystem::~PosixSubsystem(), and VFS::~VFS().
Here is the caller graph for this function:
|
inline |
|
inline |
|
inline |
|
inline |
Add an element to the Tree.
| [in] | key | the key |
| [in] | value | the element |
Definition at line 149 of file Tree.h.
Referenced by DeviceHashTree::add(), PosixSubsystem::addFileDescriptor(), Scheduler::addThread(), PosixSubsystem::PosixThread::addThreadData(), MemoryMapManager::clone(), PosixSubsystem::copyDescriptors(), PosixSubsystem::duplicateFileDescriptor(), SymbolTable::getOrInsertTree(), PosixSubsystem::installFileDescriptor(), PosixSubsystem::PosixSubsystem(), FatFilesystem::setClusterEntry(), and MemoryMappedFile::trackMapping().
Here is the caller graph for this function:
|
inline |
|
inline |
Attempts to find an element with the given key.
Definition at line 193 of file Tree.h.
Referenced by VFS::acquireMount(), DeviceHashTree::add(), PosixSubsystem::PosixThread::addThreadData(), MemoryMapManager::clone(), PosixSubsystem::closeFileDescriptor(), PosixSubsystem::duplicateFileDescriptor(), Ext2Filesystem::encodeFileHandle(), DeviceHashTree::getDevice(), DeviceHashTree::getDevice(), UserManager::getGroup(), MemoryMappedFile::getMapping(), VFS::getMountPath(), PosixSubsystem::PosixThread::getThreadData(), UserManager::getUser(), LwipSocketSyscalls::netconnCallback(), MemoryMapManager::prepareFileResize(), Ext2Filesystem::releaseInode(), VFS::removeDiskFilesystem(), Scheduler::removeThread(), VFS::retireOwnedFilesystem(), VFS::setRootFilesystem(), VFS::syncFilesystem(), Scheduler::threadInSchedule(), and VFS::unregisterFilesystem().
Here is the caller graph for this function:
|
inline |
Attempts to find an element with the given key.
Definition at line 223 of file Tree.h.
Referenced by PosixSubsystem::descriptorMatchesOpenDescription(), SymbolTable::getOrInsertTree(), and SymbolTable::lookup().
Here is the caller graph for this function:
|
inline |
Copies the least key greater than or equal to the query and its value. Copied results let callers resume after mutations without retaining an invalidated iterator. Returns false without changing outputs if absent.
Definition at line 239 of file Tree.h.
Referenced by CacheManager::findNextCache().
Here is the caller graph for this function:
|
inline |
Attempts to remove an element with the given key.
Definition at line 301 of file Tree.h.
Referenced by LwipSocketSyscalls::lastDescriptorClosed(), Scheduler::removeThread(), PosixSubsystem::PosixThread::removeThreadData(), MappingList< Object >::reserveBack(), and MemoryMappedFile::untrackMapping().
Here is the caller graph for this function:
|
inline |
Atomically move an element out of the tree and remove its key.
This is useful when releasing the element can run arbitrary teardown: ownership is transferred to the caller before the node is destroyed, so the caller controls where the final release occurs.
Definition at line 363 of file Tree.h.
Referenced by PosixSubsystem::addFileDescriptor(), PosixSubsystem::closeFileDescriptor(), PosixSubsystem::copyDescriptors(), PosixSubsystem::duplicateFileDescriptor(), PosixSubsystem::freeFd(), PosixSubsystem::freeMultipleFds(), VFS::removeDiskFilesystem(), VFS::retireOwnedFilesystem(), and VFS::unregisterFilesystem().
Here is the caller graph for this function:
|
inline |
A failed insertion leaves the tree unchanged; existing keys need no allocation.
Definition at line 169 of file Tree.h.
Referenced by MemoryMapManager::prepareFileResize(), MappingList< Object >::reserveBack(), and MemoryMappedFile::trap().
Here is the caller graph for this function:
|
inline |
|
mutableprivate |
|
private |