Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

template<typename>
class Geo::TreeNode

A generic tree structure, where each node contains an item by value.

Nodes are not copied after construction, but the SetValue function requires that the item type (_Ty) is assignable.

Functions

NameDescription
~TreeNode()

Destructor.

AddChild(const _Ty &)

Add a child node with the given value 'val'.

DeleteChild(Geo::s32)

Delete the child with index 'idx', children of the node is assigned to this node at the end of the child array.

DeleteSubTree(Geo::s32)

Delete the child with index 'idx' and all nodes below this child.

GetChild(Geo::s32)

Get child with index 'idx', NULL if 'idx' is out of range.

GetChild(Geo::s32)

Get child with index 'idx', NULL if 'idx' is out of range.

GetDepth()

Get the depth of the node.

GetLeaves(Geo::GeoArray< const TreeNode< _Ty > * > &)

Fills in an array of all the leaf nodes underneath this node. Returns the total number of leaves in the resulting array.

GetLevelFromRoot(Geo::GeoArray< TreeNode< _Ty > * > &, Geo::s32)

Return an array of nodes at the given depth ordered from left to right in the tree.

GetLevelFromRoot(Geo::GeoArray< const TreeNode< _Ty > * > &, Geo::s32)

Return an array of nodes at the given depth ordered from left to right in the tree.

GetNumChildren()

Number of immediate children nodes.

GetNumInternalNodes()

Total number of internal nodes in the tree (i.e. not leaves)

GetNumLevels()

Get the number of levels in the tree.

GetNumNodes(Geo::s32)

Total number of nodes in a given level.

GetNumNodes()

Total number of nodes in the tree.

GetParent()

Get the parent node, NULL if this is the root.

GetParent()

Get the parent node, NULL if this is the root.

GetRoot()

Get the root of the tree.

GetRoot()

Get the root of the tree.

GetValue()

Get the value stored in the node.

GetValue()

Get the value stored in the node.

IsLeaf()

Returns whether this is a leaf node, i.e. has no children.

IsRoot()

Returns whether this is a root node, i.e. has no parent.

Load(Geo::IGeoInputStream &)

Load tree from disk.

RemoveChild(Geo::s32)

Remove and return the child with index 'idx' from the tree.

Save(Geo::IGeoStream &)

Save tree to disk.

SetValue(const _Ty &)

Set the value stored in the node.

TreeNode()

Constructor.


Anchor
a3c89e00b2463d16070706d5d922275f0
a3c89e00b2463d16070706d5d922275f0

Geo::TreeNode< _Ty >::~TreeNode

...

public: ~TreeNode()

...

Destructor.


Anchor
ab3b82d3070ef0ccaeec83532e0ae2eb3
ab3b82d3070ef0ccaeec83532e0ae2eb3

TreeNode<_Ty>* Geo::TreeNode< _Ty >::AddChild

...

public: TreeNode< _Ty > * AddChild
(
    const _Ty & val
)

...

Add a child node with the given value 'val'.


Anchor
ab2f3afa2cdaeb3543482abbd556b5cca
ab2f3afa2cdaeb3543482abbd556b5cca

bool Geo::TreeNode< _Ty >::DeleteChild

...

public: bool DeleteChild
(
    Geo::s32 idx
)

...

Delete the child with index 'idx', children of the node is assigned to this node at the end of the child array.


Anchor
a0d64104760b1615143a22bfb97d8c25f
a0d64104760b1615143a22bfb97d8c25f

bool Geo::TreeNode< _Ty >::DeleteSubTree

...

public: bool DeleteSubTree
(
    Geo::s32 idx
)

...

Delete the child with index 'idx' and all nodes below this child.


Anchor
aedaed1a8aa6088670dd9fa68e7dbce6a
aedaed1a8aa6088670dd9fa68e7dbce6a

const TreeNode<_Ty>* Geo::TreeNode< _Ty >::GetChild

...

public: const TreeNode< _Ty > * GetChild
(
    Geo::s32 idx
) const

...

Get child with index 'idx', NULL if 'idx' is out of range.


Anchor
abaa510898aeb730b4fb16ab4d76278cc
abaa510898aeb730b4fb16ab4d76278cc

TreeNode<_Ty>* Geo::TreeNode< _Ty >::GetChild

...

public: TreeNode< _Ty > * GetChild
(
    Geo::s32 idx
)

...

Get child with index 'idx', NULL if 'idx' is out of range.


Anchor
a163a6ccc68a6004a3bf1295491151591
a163a6ccc68a6004a3bf1295491151591

Geo::s32 Geo::TreeNode< _Ty >::GetDepth

...

public: Geo::s32 GetDepth() const

...

Get the depth of the node.


Anchor
afe78772cddbe78a9a0facdd53b3e3133
afe78772cddbe78a9a0facdd53b3e3133

Geo::s32 Geo::TreeNode< _Ty >::GetLeaves

...

public: Geo::s32 GetLeaves
(
    Geo::GeoArray< const TreeNode< _Ty > * > & leaves
) const

...

Fills in an array of all the leaf nodes underneath this node. Returns the total number of leaves in the resulting array.


Anchor
acdeef6e163a53af2ecad4d691c3a887d
acdeef6e163a53af2ecad4d691c3a887d

bool Geo::TreeNode< _Ty >::GetLevelFromRoot

...

protected: bool GetLevelFromRoot
(
    Geo::GeoArray< TreeNode< _Ty > * > & levelNodes,
    Geo::s32 level
)

...

Return an array of nodes at the given depth ordered from left to right in the tree.


Anchor
a96f85601b741ec49f47c56b80e86e52a
a96f85601b741ec49f47c56b80e86e52a

bool Geo::TreeNode< _Ty >::GetLevelFromRoot

...

public: bool GetLevelFromRoot
(
    Geo::GeoArray< const TreeNode< _Ty > * > & levelNodes,
    Geo::s32 level
) const

...

Return an array of nodes at the given depth ordered from left to right in the tree.


Anchor
a261d95cbe846a68a80960630d8dd232c
a261d95cbe846a68a80960630d8dd232c

Geo::s32 Geo::TreeNode< _Ty >::GetNumChildren

...

public: Geo::s32 GetNumChildren() const

...

Number of immediate children nodes.


Anchor
a4a2f5e025693ee419b0a60b57d6f6611
a4a2f5e025693ee419b0a60b57d6f6611

Geo::s32 Geo::TreeNode< _Ty >::GetNumInternalNodes

...

public: Geo::s32 GetNumInternalNodes() const

...

Total number of internal nodes in the tree (i.e. not leaves)


Anchor
a4e38fcc0a12a5640d2d5c51e8abc8849
a4e38fcc0a12a5640d2d5c51e8abc8849

Geo::s32 Geo::TreeNode< _Ty >::GetNumLevels

...

public: Geo::s32 GetNumLevels() const

...

Get the number of levels in the tree.


Anchor
a7bed15a408b7ccc2c6a279f36b4d9a26
a7bed15a408b7ccc2c6a279f36b4d9a26

Geo::s32 Geo::TreeNode< _Ty >::GetNumNodes

...

public: Geo::s32 GetNumNodes
(
    Geo::s32 level
) const

...

Total number of nodes in a given level.


Anchor
a31c4f69c33da255e2af30a25d5818650
a31c4f69c33da255e2af30a25d5818650

Geo::s32 Geo::TreeNode< _Ty >::GetNumNodes

...

public: Geo::s32 GetNumNodes() const

...

Total number of nodes in the tree.


Anchor
aa9f8e76f7ef56a6f667e08095d8fef27
aa9f8e76f7ef56a6f667e08095d8fef27

const TreeNode<_Ty>* Geo::TreeNode< _Ty >::GetParent

...

public: const TreeNode< _Ty > * GetParent() const

...

Get the parent node, NULL if this is the root.


Anchor
a66e77911a15b82ea217cacbfef3a152b
a66e77911a15b82ea217cacbfef3a152b

TreeNode<_Ty>* Geo::TreeNode< _Ty >::GetParent

...

public: TreeNode< _Ty > * GetParent()

...

Get the parent node, NULL if this is the root.


Anchor
ae48b19427cfd40c065eb8f80547700f1
ae48b19427cfd40c065eb8f80547700f1

const TreeNode<_Ty>* Geo::TreeNode< _Ty >::GetRoot

...

public: const TreeNode< _Ty > * GetRoot() const

...

Get the root of the tree.


Anchor
aafa34a1d350b89c8394c1adf1204c65d
aafa34a1d350b89c8394c1adf1204c65d

TreeNode<_Ty>* Geo::TreeNode< _Ty >::GetRoot

...

public: TreeNode< _Ty > * GetRoot()

...

Get the root of the tree.


Anchor
a35add69e5090ea1b54ce1ea0f5c2e7f9
a35add69e5090ea1b54ce1ea0f5c2e7f9

const _Ty& Geo::TreeNode< _Ty >::GetValue

...

public: const _Ty & GetValue() const

...

Get the value stored in the node.


Anchor
aa5b64ef81d313d6cd9ca2fd45f59601d
aa5b64ef81d313d6cd9ca2fd45f59601d

_Ty& Geo::TreeNode< _Ty >::GetValue

...

public: _Ty & GetValue()

...

Get the value stored in the node.


Anchor
a315f1c99bd6a5e10d9724b7a9c70c442
a315f1c99bd6a5e10d9724b7a9c70c442

bool Geo::TreeNode< _Ty >::IsLeaf

...

public: bool IsLeaf() const

...

Returns whether this is a leaf node, i.e. has no children.


Anchor
a1849441e014d7d358ea2bc3fa25861c0
a1849441e014d7d358ea2bc3fa25861c0

bool Geo::TreeNode< _Ty >::IsRoot

...

public: bool IsRoot() const

...

Returns whether this is a root node, i.e. has no parent.


Anchor
aebf6fa97eaefc8b68235e2f63da7fec6
aebf6fa97eaefc8b68235e2f63da7fec6

bool Geo::TreeNode< _Ty >::Load

...

public: bool Load
(
    Geo::IGeoInputStream & reader
)

...

Load tree from disk.


Anchor
a36b17eb85fd9364bfe6fbd4e4a530059
a36b17eb85fd9364bfe6fbd4e4a530059

TreeNode<_Ty>* Geo::TreeNode< _Ty >::RemoveChild

...

public: TreeNode< _Ty > * RemoveChild
(
    Geo::s32 idx
)

...

Remove and return the child with index 'idx' from the tree.


Anchor
a508ab1b5243154deeffd657b27ff7d86
a508ab1b5243154deeffd657b27ff7d86

bool Geo::TreeNode< _Ty >::Save

...

public: bool Save
(
    Geo::IGeoStream & writer
) const

...

Save tree to disk.


Anchor
adf6f71729e5332e622e7fe08caaaad7a
adf6f71729e5332e622e7fe08caaaad7a

void Geo::TreeNode< _Ty >::SetValue

...

public: void SetValue
(
    const _Ty & val
)

...

Set the value stored in the node.


Anchor
a68984fd969ef1e73ffb2388e30f08c48
a68984fd969ef1e73ffb2388e30f08c48

Geo::TreeNode< _Ty >::TreeNode

...

public: TreeNode()

...

Constructor.