![]() |
F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
|
#include <Fw/DataStructures/RedBlackTreeSetOrMapImpl.hpp>
Classes | |
| class | ConstIterator |
| Const iterator. More... | |
| class | Node |
| Node. More... | |
Public Types | |
| using | Color = typename Node::Color |
| The color type. More... | |
| using | Direction = typename Node::Direction |
| The direction type. More... | |
| using | Entry = typename Node::Entry |
| The entry type. More... | |
| using | Index = typename Node::Index |
| The node index type. More... | |
| using | Nodes = ExternalArray< Node > |
| The type of the array for storing the tree nodes. More... | |
| using | FreeNodes = ExternalStack< Index > |
| The type of the stack of indices of free nodes. More... | |
Public Member Functions | |
| RedBlackTreeSetOrMapImpl ()=default | |
| Zero-argument constructor. More... | |
| RedBlackTreeSetOrMapImpl (Node *nodes, Index *freeNodes, FwSizeType capacity) | |
| RedBlackTreeSetOrMapImpl (ByteArray data, FwSizeType capacity) | |
| RedBlackTreeSetOrMapImpl (const RedBlackTreeSetOrMapImpl< KE, VN > &impl) | |
| Copy constructor. More... | |
| ~RedBlackTreeSetOrMapImpl ()=default | |
| Destructor. More... | |
| RedBlackTreeSetOrMapImpl< KE, VN > & | operator= (const RedBlackTreeSetOrMapImpl< KE, VN > &impl) |
| operator= More... | |
| ConstIterator | begin () const |
| Get the begin iterator. More... | |
| void | clear () |
| Clear the set or map. More... | |
| ConstIterator | end () const |
| Get the end iterator. More... | |
| Success | find (const KE &keyOrElement, VN &valueOrNil) const |
| FwSizeType | getCapacity () const |
| FwSizeType | getSize () const |
| Success | insert (const KE &keyOrElement, const VN &valueOrNil) |
| Success | remove (const KE &keyOrElement, VN &valueOrNil) |
| void | setStorage (Node *nodes, Index *freeNodes, FwSizeType capacity) |
| void | setStorage (ByteArray data, FwSizeType capacity) |
Static Public Member Functions | |
| static constexpr U8 | getByteArrayAlignment () |
| static constexpr FwSizeType | getByteArraySize (FwSizeType capacity) |
Friends | |
| template<typename KK , typename VV > | |
| class | RedBlackTreeSetOrMapImplTester |
This class template implements a red-black tree that can be used as a set or map. A red-black tree is a binary search tree (BST) such that each node is colored red or black. A red-black tree is valid if
The black height invariant of a red-black tree T is checked with respect to the leaf-augmented tree T'. T' is constructed from T by replacing every "missing" node in T (i.e., every place where there could be a child but is not) with a new black node. The black height invariant says that for every node N in T', every path from N to a leaf in T' goes through the same number of black nodes.
A valid red-black tree is balanced, in the sense that the find operation takes O(log n) steps.
Definition at line 39 of file RedBlackTreeSetOrMapImpl.hpp.
| using Fw::RedBlackTreeSetOrMapImpl< KE, VN >::Color = typename Node::Color |
The color type.
Definition at line 120 of file RedBlackTreeSetOrMapImpl.hpp.
| using Fw::RedBlackTreeSetOrMapImpl< KE, VN >::Direction = typename Node::Direction |
The direction type.
Definition at line 123 of file RedBlackTreeSetOrMapImpl.hpp.
| using Fw::RedBlackTreeSetOrMapImpl< KE, VN >::Entry = typename Node::Entry |
The entry type.
Definition at line 126 of file RedBlackTreeSetOrMapImpl.hpp.
| using Fw::RedBlackTreeSetOrMapImpl< KE, VN >::FreeNodes = ExternalStack<Index> |
The type of the stack of indices of free nodes.
Definition at line 135 of file RedBlackTreeSetOrMapImpl.hpp.
| using Fw::RedBlackTreeSetOrMapImpl< KE, VN >::Index = typename Node::Index |
The node index type.
Definition at line 129 of file RedBlackTreeSetOrMapImpl.hpp.
| using Fw::RedBlackTreeSetOrMapImpl< KE, VN >::Nodes = ExternalArray<Node> |
The type of the array for storing the tree nodes.
Definition at line 132 of file RedBlackTreeSetOrMapImpl.hpp.
|
default |
Zero-argument constructor.
|
inline |
Constructor providing typed backing storage. nodes must point to at least capacity elements of type Node. freeNodes must point to at least capacity elements of type FwSizeType.
| nodes | The nodes |
| freeNodes | The free nodes |
| capacity | The capacity |
Definition at line 248 of file RedBlackTreeSetOrMapImpl.hpp.
|
inline |
Constructor providing untyped backing storage. data must be aligned according to getByteArrayAlignment(). data must contain at least getByteArraySize(capacity) bytes.
| data | The data |
| capacity | The capacity |
Definition at line 258 of file RedBlackTreeSetOrMapImpl.hpp.
|
inline |
Copy constructor.
Definition at line 265 of file RedBlackTreeSetOrMapImpl.hpp.
|
default |
Destructor.
|
inline |
Get the begin iterator.
Definition at line 286 of file RedBlackTreeSetOrMapImpl.hpp.
|
inline |
Clear the set or map.
Definition at line 289 of file RedBlackTreeSetOrMapImpl.hpp.
|
inline |
Get the end iterator.
Definition at line 303 of file RedBlackTreeSetOrMapImpl.hpp.
|
inline |
Find a value associated with a key in the map or an element in a set
| keyOrElement | The key or element |
| valueOrNil | The value or Nil |
Definition at line 311 of file RedBlackTreeSetOrMapImpl.hpp.
|
inlinestatic |
Get the alignment of the storage for a RedBlackTreeSetOrMapImpl
Definition at line 423 of file RedBlackTreeSetOrMapImpl.hpp.
|
inlinestatic |
Get the size of the storage for an ExternalArray of the specified capacity, as a byte array
| capacity | The capacity |
Definition at line 428 of file RedBlackTreeSetOrMapImpl.hpp.
|
inline |
Get the capacity of the set or map (max number of entries)
Definition at line 325 of file RedBlackTreeSetOrMapImpl.hpp.
|
inline |
Get the size (number of entries)
Definition at line 329 of file RedBlackTreeSetOrMapImpl.hpp.
|
inline |
Insert an element in the set or a (key, value) pair in the map
| keyOrElement | The key or element |
| valueOrNil | The value or Nil |
Definition at line 339 of file RedBlackTreeSetOrMapImpl.hpp.
|
inline |
operator=
Definition at line 276 of file RedBlackTreeSetOrMapImpl.hpp.
|
inline |
Remove an element from the set or a (key, value) pair from the map
| keyOrElement | The key or element |
| valueOrNil | The value or Nil |
Definition at line 364 of file RedBlackTreeSetOrMapImpl.hpp.
|
inline |
Set the backing storage (typed data) nodes must point to at least capacity elements of type Node. freeNodes must point to at least capacity elements of type FwSizeType.
| nodes | The nodes |
| freeNodes | The free nodes |
| capacity | The capacity |
Definition at line 383 of file RedBlackTreeSetOrMapImpl.hpp.
|
inline |
Set the backing storage (untyped data) data must be aligned according to getByteArrayAlignment(). data must contain at least getByteArraySize(capacity) bytes.
| data | The data |
| capacity | The capacity |
Definition at line 395 of file RedBlackTreeSetOrMapImpl.hpp.
|
friend |
Definition at line 45 of file RedBlackTreeSetOrMapImpl.hpp.