SurgSim::DataStructures::Tree Class Reference

Basic tree structure. More...

`#include <SurgSim/DataStructures/Tree.h>`

Inheritance diagram for SurgSim::DataStructures::Tree:

## Public Member Functions

| Tree ()
| Constructor. After construction, the root is null. More...
virtual | ~Tree ()
| Destructor. More...
void | setRoot (std::shared_ptr< TreeNode > root)
| Sets the root of the tree. More...
std::shared_ptr< TreeNode > | getRoot () const
bool | operator== (const Tree &tree) const
| If the trees are not of the same type, returns false; otherwise, compares with the implementation of isEqual(const Tree&). More...
bool | operator!= (const Tree &tree) const
| If the trees are not of the same type, returns false; otherwise, compares with the implementation of isEqual(const Tree&). More...

## Protected Member Functions

virtual bool | isEqual (const Tree &tree) const
| Recurses through the tree, starting at the root. More...

## Private Attributes

std::shared_ptr< TreeNode > | m_root
| Root of the tree. More...

## Detailed Description

Basic tree structure.

The tree is composed of TreeNodes, which are all accessible from the root.

See also
  TreeNode TreeData

## Constructor & Destructor Documentation

## Tree()

Tree::Tree | ( |  | ) |

Constructor. After construction, the root is null.

## ~Tree()

Tree::~Tree | ( |  | ) |

virtual

Destructor.

## Member Function Documentation

## getRoot()

std::shared_ptr< TreeNode > SurgSim::DataStructures::Tree::getRoot | ( |  | ) | const

Returns
  The root of the tree.

## isEqual()

bool Tree::isEqual | ( | const Tree & | tree | ) | const

protected virtual

Recurses through the tree, starting at the root.

Override this method in derived classes to implement different comparisons.

Parameters

  tree | Other tree for comparison.

Returns
  true if the trees are equal; otherwise, returns false.

## operator!=()

bool Tree::operator!= | ( | const Tree & | tree | ) | const

If the trees are not of the same type, returns false; otherwise, compares with the implementation of isEqual(const Tree&).

Parameters

  tree | Other tree for comparison.

Returns
  true if the trees are not equal; otherwise, returns false.

## operator==()

bool Tree::operator== | ( | const Tree & | tree | ) | const

If the trees are not of the same type, returns false; otherwise, compares with the implementation of isEqual(const Tree&).

Parameters

  tree | Other tree for comparison.

Returns
  true if the trees are equal; otherwise, returns false.

## setRoot()

void SurgSim::DataStructures::Tree::setRoot | ( | std::shared_ptr< TreeNode > | root | ) |

Sets the root of the tree.

Parameters

  root | The new root of the tree.

## Member Data Documentation

## m_root

std::shared_ptr<TreeNode> SurgSim::DataStructures::Tree::m_root

private

Root of the tree.

The documentation for this class was generated from the following files:

- SurgSim/DataStructures/Tree.h
- SurgSim/DataStructures/Tree.cpp