template<s32 MaxKeyLength, typename Value>
sead::StrTreeMap class

Sorted associative container with fixed-length string keys. This is essentially std::map<char[MaxKeyLength], Value>

Base classes

template<typename Key>
class TreeMapImpl<SafeString>

Public types

class Node
using MapImpl = TreeMapImpl<SafeString>
using Node = TreeMapNode<SafeString>

Public functions

void allocBuffer(s32 node_max, Heap* heap, s32 alignment = sizeof(void*))
void setBuffer(s32 node_max, void* buffer)
void freeBuffer()
auto isBufferReady() const -> bool
auto insert(const SafeString& key, const Value& value) -> Value*
void clear()
auto find(const SafeString& key) const -> Node*
template<typename Callable>
void forEach(const Callable& delegate) const
void insert(Node* node)
void erase(const SafeString& key)
auto startIterating() const -> Node*
auto nextNode(Node* node) const -> Node*

Protected static functions

static void forEach(Node* start, const Callable& callable)
static auto startIterating(Node* node) -> Node*
static auto rotateLeft(Node* node) -> Node*
static auto rotateRight(Node* node) -> Node*
static auto moveRedLeft(Node* node) -> Node*
static auto moveRedRight(Node* node) -> Node*
static auto findMin(Node* node) -> Node*
static auto eraseMin(Node* node) -> Node*
static auto fixUp(Node* node) -> Node*
static auto isRed(const Node* node) -> bool
static void flipColors(Node* node)

Protected functions

auto insert(Node* root, Node* node) -> Node*
auto erase(Node* root, const SafeString& key) -> Node*
auto find(Node* root, const SafeString& key) const -> Node*

Protected variables

Node* mRoot

Typedef documentation

template<s32 MaxKeyLength, typename Value>
using sead::StrTreeMap<MaxKeyLength, Value>::Node = TreeMapNode<SafeString>

Function documentation

template<s32 MaxKeyLength, typename Value>
void sead::StrTreeMap<MaxKeyLength, Value>::insert(Node* node)

template<s32 MaxKeyLength, typename Value>
void sead::StrTreeMap<MaxKeyLength, Value>::erase(const SafeString& key)

template<s32 MaxKeyLength, typename Value>
Node* sead::StrTreeMap<MaxKeyLength, Value>::startIterating() const

template<s32 MaxKeyLength, typename Value>
Node* sead::StrTreeMap<MaxKeyLength, Value>::nextNode(Node* node) const

template<s32 MaxKeyLength, typename Value>
static void sead::StrTreeMap<MaxKeyLength, Value>::forEach(Node* start, const Callable& callable) protected

template<s32 MaxKeyLength, typename Value>
static Node* sead::StrTreeMap<MaxKeyLength, Value>::startIterating(Node* node) protected

Returns the left most child of a given node, marking each node with its parent along the way.

template<s32 MaxKeyLength, typename Value>
static Node* sead::StrTreeMap<MaxKeyLength, Value>::rotateLeft(Node* node) protected

template<s32 MaxKeyLength, typename Value>
static Node* sead::StrTreeMap<MaxKeyLength, Value>::rotateRight(Node* node) protected

template<s32 MaxKeyLength, typename Value>
static Node* sead::StrTreeMap<MaxKeyLength, Value>::moveRedLeft(Node* node) protected

template<s32 MaxKeyLength, typename Value>
static Node* sead::StrTreeMap<MaxKeyLength, Value>::moveRedRight(Node* node) protected

template<s32 MaxKeyLength, typename Value>
static Node* sead::StrTreeMap<MaxKeyLength, Value>::findMin(Node* node) protected

template<s32 MaxKeyLength, typename Value>
static Node* sead::StrTreeMap<MaxKeyLength, Value>::eraseMin(Node* node) protected

template<s32 MaxKeyLength, typename Value>
static Node* sead::StrTreeMap<MaxKeyLength, Value>::fixUp(Node* node) protected

template<s32 MaxKeyLength, typename Value>
static bool sead::StrTreeMap<MaxKeyLength, Value>::isRed(const Node* node) protected

template<s32 MaxKeyLength, typename Value>
static void sead::StrTreeMap<MaxKeyLength, Value>::flipColors(Node* node) protected

template<s32 MaxKeyLength, typename Value>
Node* sead::StrTreeMap<MaxKeyLength, Value>::insert(Node* root, Node* node) protected

template<s32 MaxKeyLength, typename Value>
Node* sead::StrTreeMap<MaxKeyLength, Value>::erase(Node* root, const SafeString& key) protected

template<s32 MaxKeyLength, typename Value>
Node* sead::StrTreeMap<MaxKeyLength, Value>::find(Node* root, const SafeString& key) const protected

Variable documentation

template<s32 MaxKeyLength, typename Value>
Node* sead::StrTreeMap<MaxKeyLength, Value>::mRoot protected