NCBI C++ ToolKit
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
CTreeModelNode< TData > Class Template Reference

Search Toolkit Book for CTreeModelNode

Base class for nodes in the tree. More...

#include <gui/widgets/phylo_tree/tree_model.hpp>

+ Inheritance diagram for CTreeModelNode< TData >:
+ Collaboration diagram for CTreeModelNode< TData >:

Public Types

typedef TData TValueType
 
typedef size_t TTreeIdx
 
typedef vector< TTreeIdxTNodeList
 
typedef TNodeList::iterator TNodeList_I
 
typedef TNodeList::const_iterator TNodeList_CI
 
typedef TNodeList::reverse_iterator TNodeList_RI
 
typedef TNodeList::const_reverse_iterator TNodeList_CRI
 

Public Member Functions

 CTreeModelNode ()
 Construct an empty node (null parent) More...
 
void SetParent (TTreeIdx parent_idx)
 Set index of nodes parent. More...
 
TTreeIdx GetParent () const
 Get node's parent. More...
 
void RemoveParent ()
 Set the parent index to Null() e.g. for root node. More...
 
bool HasParent () const
 Check if the node has a parent. More...
 
void AddChild (TTreeIdx child_idx)
 Add a child node. More...
 
void RemoveChild (TTreeIdx child_idx)
 Remove child node if it is a child of this node. More...
 
bool HasChild (TTreeIdx child_idx) const
 Check if another node is a child of this node. More...
 
bool IsLeaf () const
 Report whether this is a leaf node. More...
 
TNodeListGetChildren ()
 Return the indices of this node's child nodes. More...
 
const TNodeListGetChildren () const
 
TNodeList_CI SubNodeBegin () const
 Return const iterator to first subnode index. More...
 
TNodeList_I SubNodeBegin ()
 Return iterator to first subnode index. More...
 
TNodeList_CI SubNodeEnd () const
 Return const iterator to end of subnode list. More...
 
TNodeList_I SubNodeEnd ()
 Return iterator to end of subnode list. More...
 
TNodeList_CRI SubNodeRBegin () const
 Return const reverse iterator to (reverse) of begin of subnode array. More...
 
TNodeList_RI SubNodeRBegin ()
 Return reverse iterator to (reverse) begin of subnode array. More...
 
TNodeList_CRI SubNodeREnd () const
 Return const reverse iterator to (reverse) end of subnode array. More...
 
TNodeList_RI SubNodeREnd ()
 Return reverse iterator to (reverse) end of subnode array. More...
 
void ClearConnections ()
 Remove connections to parent and children of this node. More...
 
void SetValue (const TData &data)
 Set the value-object for the node. More...
 
TData & GetValue ()
 Return the value object for the node. More...
 
const TData & GetValue () const
 
TData & operator* ()
 Return the value object for the node using de-referenceing semantics. More...
 
const TData & operator* () const
 
TData * operator-> ()
 
const TData * operator-> () const
 

Static Public Member Functions

static TTreeIdx Null ()
 Static function that returns the null value. More...
 

Protected Attributes

TTreeIdx m_ParentNode
 Index of parent node to this node. ==Null() if this is the root node. More...
 
vector< TTreeIdxm_ChildNodes
 Indices of all the children of this node. More...
 
TData m_Data
 Data object. More...
 

Detailed Description

template<class TData>
class CTreeModelNode< TData >

Base class for nodes in the tree.

Takes a data template parameter to allow additional storage.

Definition at line 56 of file tree_model.hpp.

Member Typedef Documentation

◆ TNodeList

template<class TData >
typedef vector<TTreeIdx> CTreeModelNode< TData >::TNodeList

Definition at line 62 of file tree_model.hpp.

◆ TNodeList_CI

template<class TData >
typedef TNodeList::const_iterator CTreeModelNode< TData >::TNodeList_CI

Definition at line 64 of file tree_model.hpp.

◆ TNodeList_CRI

template<class TData >
typedef TNodeList::const_reverse_iterator CTreeModelNode< TData >::TNodeList_CRI

Definition at line 66 of file tree_model.hpp.

◆ TNodeList_I

template<class TData >
typedef TNodeList::iterator CTreeModelNode< TData >::TNodeList_I

Definition at line 63 of file tree_model.hpp.

◆ TNodeList_RI

template<class TData >
typedef TNodeList::reverse_iterator CTreeModelNode< TData >::TNodeList_RI

Definition at line 65 of file tree_model.hpp.

◆ TTreeIdx

template<class TData >
typedef size_t CTreeModelNode< TData >::TTreeIdx

Definition at line 60 of file tree_model.hpp.

◆ TValueType

template<class TData >
typedef TData CTreeModelNode< TData >::TValueType

Definition at line 59 of file tree_model.hpp.

Constructor & Destructor Documentation

◆ CTreeModelNode()

template<class TData >
CTreeModelNode< TData >::CTreeModelNode ( )
inline

Construct an empty node (null parent)

Definition at line 71 of file tree_model.hpp.

Member Function Documentation

◆ AddChild()

template<class TData >
void CTreeModelNode< TData >::AddChild ( TTreeIdx  child_idx)

Add a child node.

Parameters
child_idxindex of parent node in the array

Definition at line 640 of file tree_model.hpp.

References LOG_POST.

Referenced by IPhyloTreeFilter::x_OnStep().

◆ ClearConnections()

template<class TData >
void CTreeModelNode< TData >::ClearConnections ( )
inline

Remove connections to parent and children of this node.

Definition at line 154 of file tree_model.hpp.

Referenced by visitor_copy_subtree::operator()(), visitor_paste_subtree::operator()(), and CPhyloTreeDataSource::Remove().

◆ GetChildren() [1/2]

template<class TData >
TNodeList& CTreeModelNode< TData >::GetChildren ( void  )
inline

◆ GetChildren() [2/2]

template<class TData >
const TNodeList& CTreeModelNode< TData >::GetChildren ( void  ) const
inline

Definition at line 127 of file tree_model.hpp.

◆ GetParent()

template<class TData >
TTreeIdx CTreeModelNode< TData >::GetParent ( void  ) const
inline

◆ GetValue() [1/2]

template<class TData >
TData& CTreeModelNode< TData >::GetValue ( void  )
inline

Return the value object for the node.

Definition at line 159 of file tree_model.hpp.

Referenced by CTreeGraphicsModel::EnableCircularLabelTrimming(), CTreeQueryExec::EvalNext(), CPhyloTreeDataSource::ExecuteStringQuery(), IPhyloTreeRender::GetDefaultNodeSize(), IPhyloTreeRender::GetEdgeColor(), CPhyloCircularCladogram::GetNodeLabelDist(), IPhyloTreeRender::GetNodeLabelDist(), IPhyloTreeRender::GetNodeLayoutSize(), CPhyloTreeWidget::IterateSelection(), CPhyloTreeDataSource::NewNode(), CPhyloTreeWidget::OnExportSelection(), visitor_copy_subtree::operator()(), visitor_paste_subtree::operator()(), CVisitorAccumulateProperty::operator()(), CCalcCircularTree::operator()(), CCalcBoundary::operator()(), CCalcRadialTree::operator()(), CDrawRadialTreeVbo::operator()(), CCalcRectangularTree::operator()(), CCalcSlantedTree::operator()(), CDrawSlantedTreeVbo::operator()(), NodeIdxSort::operator()(), CPhyloTreeWidget::RedrawDataSource(), CPhyloTreeDataSource::Remove(), CPhyloTreeDataSource::ReRoot(), CPhyloTreeDataSource::ReRootEdge(), CPhyloTreeDataSource::ReRootMidpoint(), CPhyloTreeWidget::SendEditEvent(), CPhyloSelectionSetMgr::SetSelectionSetProperty(), IPhyloTreeRender::TTHH_NeedTooltip(), IPhyloTreeRender::x_AddCollapsedGeomNode(), IPhyloTreeRender::x_AddCollapsedTextureNode(), CPhyloTree::x_ConvertUpstream(), CPhyloTreeLabel::x_GenerateAutoLabel(), CPhyloTreeMaxDirectChildDist::x_OnStep(), CPhyloTreeMaxChildDist::x_OnStep(), CPhyloTreeDistFromRoot::x_OnStep(), CPhyloTreeMidpointDist::x_OnStep(), IPhyloTreeFilter::x_OnStep(), and IPhyloTreeRender::x_RenderNodeVbo().

◆ GetValue() [2/2]

template<class TData >
const TData& CTreeModelNode< TData >::GetValue ( void  ) const
inline

Definition at line 160 of file tree_model.hpp.

◆ HasChild()

template<class TData >
bool CTreeModelNode< TData >::HasChild ( TTreeIdx  child_idx) const

Check if another node is a child of this node.

Parameters
child_idxindex of node to be checked
Returns
true if child_idx is a child of this node

Definition at line 665 of file tree_model.hpp.

Referenced by IPhyloTreeFilter::x_OnStep().

◆ HasParent()

template<class TData >
bool CTreeModelNode< TData >::HasParent ( ) const
inline

◆ IsLeaf()

template<class TData >
bool CTreeModelNode< TData >::IsLeaf ( ) const
inline

◆ Null()

template<class TData >
CTreeModelNode< TData >::TTreeIdx CTreeModelNode< TData >::Null
static

Static function that returns the null value.

NULL_TREE_IDX can also be used as the null value.

Returns
the numeric index value used to represent NULL

Definition at line 636 of file tree_model.hpp.

References NULL_TREE_IDX.

Referenced by CTreeModelNode< CPhyloNodeData >::ClearConnections(), CTreeModelNode< CPhyloNodeData >::HasParent(), and CTreeModelNode< CPhyloNodeData >::RemoveParent().

◆ operator*() [1/2]

template<class TData >
TData& CTreeModelNode< TData >::operator* ( void  )
inline

Return the value object for the node using de-referenceing semantics.

Definition at line 163 of file tree_model.hpp.

◆ operator*() [2/2]

template<class TData >
const TData& CTreeModelNode< TData >::operator* ( void  ) const
inline

Definition at line 164 of file tree_model.hpp.

◆ operator->() [1/2]

template<class TData >
TData* CTreeModelNode< TData >::operator-> ( void  )
inline

Definition at line 166 of file tree_model.hpp.

◆ operator->() [2/2]

template<class TData >
const TData* CTreeModelNode< TData >::operator-> ( void  ) const
inline

Definition at line 167 of file tree_model.hpp.

◆ RemoveChild()

template<class TData >
void CTreeModelNode< TData >::RemoveChild ( TTreeIdx  child_idx)

Remove child node if it is a child of this node.

Parameters
child_idxindex of child node to be removed

Definition at line 653 of file tree_model.hpp.

Referenced by IPhyloTreeFilter::x_OnStep().

◆ RemoveParent()

template<class TData >
void CTreeModelNode< TData >::RemoveParent ( )
inline

Set the parent index to Null() e.g. for root node.

Definition at line 85 of file tree_model.hpp.

◆ SetParent()

template<class TData >
void CTreeModelNode< TData >::SetParent ( TTreeIdx  parent_idx)
inline

Set index of nodes parent.

Parameters
parent_idxindex of parent node in the array

Definition at line 77 of file tree_model.hpp.

Referenced by CPhyloTreeDataSource::NewNode(), CPhyloTreeDataSource::ReRoot(), and IPhyloTreeFilter::x_OnStep().

◆ SetValue()

template<class TData >
void CTreeModelNode< TData >::SetValue ( const TData &  data)
inline

Set the value-object for the node.

Definition at line 157 of file tree_model.hpp.

◆ SubNodeBegin() [1/2]

template<class TData >
TNodeList_I CTreeModelNode< TData >::SubNodeBegin ( void  )
inline

Return iterator to first subnode index.

Definition at line 133 of file tree_model.hpp.

◆ SubNodeBegin() [2/2]

template<class TData >
TNodeList_CI CTreeModelNode< TData >::SubNodeBegin ( void  ) const
inline

◆ SubNodeEnd() [1/2]

template<class TData >
TNodeList_I CTreeModelNode< TData >::SubNodeEnd ( )
inline

Return iterator to end of subnode list.

Definition at line 139 of file tree_model.hpp.

◆ SubNodeEnd() [2/2]

template<class TData >
TNodeList_CI CTreeModelNode< TData >::SubNodeEnd ( ) const
inline

◆ SubNodeRBegin() [1/2]

template<class TData >
TNodeList_RI CTreeModelNode< TData >::SubNodeRBegin ( )
inline

Return reverse iterator to (reverse) begin of subnode array.

Definition at line 145 of file tree_model.hpp.

◆ SubNodeRBegin() [2/2]

template<class TData >
TNodeList_CRI CTreeModelNode< TData >::SubNodeRBegin ( ) const
inline

Return const reverse iterator to (reverse) of begin of subnode array.

Definition at line 142 of file tree_model.hpp.

◆ SubNodeREnd() [1/2]

template<class TData >
TNodeList_RI CTreeModelNode< TData >::SubNodeREnd ( )
inline

Return reverse iterator to (reverse) end of subnode array.

Definition at line 151 of file tree_model.hpp.

◆ SubNodeREnd() [2/2]

template<class TData >
TNodeList_CRI CTreeModelNode< TData >::SubNodeREnd ( ) const
inline

Return const reverse iterator to (reverse) end of subnode array.

Definition at line 148 of file tree_model.hpp.

Member Data Documentation

◆ m_ChildNodes

template<class TData >
vector<TTreeIdx> CTreeModelNode< TData >::m_ChildNodes
protected

◆ m_Data

template<class TData >
TData CTreeModelNode< TData >::m_Data
protected

◆ m_ParentNode

template<class TData >
TTreeIdx CTreeModelNode< TData >::m_ParentNode
protected

The documentation for this class was generated from the following file:
Modified on Sun Feb 25 03:03:37 2024 by modify_doxy.py rev. 669887