All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
SurgSim::DataStructures::Tree Class Reference

Basic tree structure. More...

#include <SurgSim/DataStructures/Tree.h>

Inheritance diagram for SurgSim::DataStructures::Tree:
Inheritance graph
[legend]

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< TreeNodegetRoot () 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< TreeNodem_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 ( )

Constructor. After construction, the root is null.

Tree::~Tree ( )
virtual

Destructor.

Member Function Documentation

std::shared_ptr< TreeNode > SurgSim::DataStructures::Tree::getRoot ( ) const
Returns
The root of the tree.
bool Tree::isEqual ( const Tree tree) const
protectedvirtual

Recurses through the tree, starting at the root.

Override this method in derived classes to implement different comparisons.

Parameters
treeOther tree for comparison.
Returns
true if the trees are equal; otherwise, returns false.
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
treeOther tree for comparison.
Returns
true if the trees are not equal; otherwise, returns false.
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
treeOther tree for comparison.
Returns
true if the trees are equal; otherwise, returns false.
void SurgSim::DataStructures::Tree::setRoot ( std::shared_ptr< TreeNode root)

Sets the root of the tree.

Parameters
rootThe new root of the tree.

Member Data Documentation

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: