NCBI C++ ToolKit
Classes | Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
CTreeNode< TValue, TKeyGetterP > Struct Template Reference

Search Toolkit Book for CTreeNode

definition of a Culling tree More...

#include <corelib/ncbi_tree.hpp>

+ Inheritance diagram for CTreeNode< TValue, TKeyGetterP >:
+ Collaboration diagram for CTreeNode< TValue, TKeyGetterP >:

Classes

class  CSorter
 

Public Types

enum  EDeletePolicy { eDelete , eNoDelete }
 Whether to destroy the sub-nodes when bulk-cleaning the node. More...
 
enum  ENodeSearchType { eImmediateSubNodes = (1 << 0) , eTopLevelNodes = (1 << 1) , eAllUpperSubNodes = (1 << 2) , eImmediateAndTop = (eImmediateSubNodes | eTopLevelNodes) }
 Parameters for node search by key. More...
 
enum  ECountNodes { fOnlyLeafs = (1 << 0) , fCumulative = (1 << 1) }
 How to count nodes in the tree of which this node is a root. More...
 
typedef TValue TValueType
 
typedef TKeyGetterP TKeyGetter
 
typedef TKeyGetter::TKeyType TKeyType
 
typedef TKeyGetter::TKeyEqual TKeyEqual
 
typedef CTreeNode< TValue, TKeyGetterTTreeType
 
typedef list< TTreeType * > TNodeList
 
typedef list< const TTreeType * > TConstNodeList
 
typedef TNodeList::iterator TNodeList_I
 
typedef TNodeList::const_iterator TNodeList_CI
 
typedef TNodeList::reverse_iterator TNodeList_RI
 
typedef TNodeList::const_reverse_iterator TNodeList_CRI
 
typedef list< TKeyTypeTKeyList
 
typedef int TNodeSearchMode
 Bitwise mask of ENodeSearchType. More...
 
typedef int TCountNodes
 Bitwise mask of ECountNodes. More...
 

Public Member Functions

 CTreeNode (const TValue &value=TValue())
 Tree node construction. More...
 
 CTreeNode (const TKeyGetter &getter, const TValue &value=TValue())
 
virtual ~CTreeNode ()
 
 CTreeNode (const TTreeType &tree)
 
CTreeNodeoperator= (const TTreeType &tree)
 
const TKeyGetterGetKeyGetter (void) const
 Get key getter. More...
 
const TTreeTypeGetParent (void) const
 Get node's parent. More...
 
TTreeTypeGetParent (void)
 Get node's parent. More...
 
const TTreeTypeGetRoot (void) const
 Get the topmost node. More...
 
TTreeTypeGetRoot (void)
 Get the topmost node. More...
 
TNodeList_CI SubNodeBegin (void) const
 Return first const iterator on subnode list. More...
 
TNodeList_I SubNodeBegin (void)
 Return first iterator on subnode list. More...
 
TNodeList_CI SubNodeEnd (void) const
 Return last const iterator on subnode list. More...
 
TNodeList_I SubNodeEnd (void)
 Return last iterator on subnode list. More...
 
TNodeList_CRI SubNodeRBegin (void) const
 Return first const reverse iterator on subnode list. More...
 
TNodeList_RI SubNodeRBegin (void)
 Return first reverse iterator on subnode list. More...
 
TNodeList_CRI SubNodeREnd (void) const
 Return last const reverse iterator on subnode list. More...
 
TNodeList_RI SubNodeREnd (void)
 Return last reverse iterator on subnode list. More...
 
const TValue & GetValue (void) const
 Return node's value. More...
 
TValue & GetValue (void)
 Return node's value. More...
 
void SetValue (const TValue &value)
 Set value for the node. More...
 
const TValue & operator* (void) const
 
TValue & operator* (void)
 
const TValue * operator-> (void) const
 
TValue * operator-> (void)
 
const TKeyTypeGetKey (void) const
 
TKeyTypeGetKey (void)
 
const TKeyEqualGetKeyEqual () const
 Return key equal predicate. More...
 
bool KeyEqual (const TKeyType &key) const
 Check if the node's key is equal to the argument. More...
 
void RemoveNode (TTreeType *subnode)
 Remove subnode of the current node. More...
 
void RemoveNode (TNodeList_I it)
 Remove subnode of the current node. More...
 
void RemoveAllSubNodes (EDeletePolicy del=eDelete)
 Remove all immediate subnodes. More...
 
TTreeTypeDetachNode (TTreeType *subnode)
 Remove the subtree from the tree without destroying it. More...
 
TTreeTypeDetachNode (TNodeList_I it)
 Remove the subtree from the tree without destroying it. More...
 
void AddNode (TTreeType *subnode)
 Add new subnode. More...
 
TTreeTypeAddNode (const TValue &val=TValue())
 Add new subnode whose value is (a copy of) val. More...
 
void MoveSubnodes (TTreeType *src_tree_node)
 Remove all subnodes from the source node and attach them to the current tree (node). More...
 
void InsertNode (TNodeList_I it, TTreeType *subnode)
 Insert new subnode before the specified location in the subnode list. More...
 
bool IsLeaf () const
 Report whether this is a leaf node. More...
 
bool IsParent (const TTreeType &tree_node) const
 Check if node is a direct or indirect parent of this node. More...
 
void FindNodes (const TKeyList &node_path, TNodeList *res)
 Find tree nodes corresponding to the path from the top. More...
 
TTreeTypeFindOrCreateNode (const TKeyList &node_path)
 Find or create tree node corresponding to the path from the top. More...
 
void FindNodes (const TKeyList &node_path, TConstNodeList *res) const
 Find tree nodes corresponding to the path from the top. More...
 
const TTreeTypeFindSubNode (const TKeyType &key) const
 Non recursive linear scan of all subnodes, with key comparison. More...
 
TTreeTypeFindSubNode (const TKeyType &key)
 Non recursive linear scan of all subnodes, with key comparison. More...
 
const TTreeTypeFindNode (const TKeyType &key, TNodeSearchMode sflag=eImmediateAndTop) const
 Search for node. More...
 
unsigned int CountNodes (unsigned int depth=1, TCountNodes how=0) const
 Count nodes of the tree of which this node is a root. More...
 
template<class TNodeComparator >
void SortChildren (const TNodeComparator &compare)
 

Public Attributes

Int4 begin
 
Int4 end
 
struct CTreeNodeleft
 
struct CTreeNoderight
 
LinkedHSPhsplist
 

Protected Member Functions

void CopyFrom (const TTreeType &tree)
 
void SetParent (TTreeType *parent_node)
 
const TNodeListGetSubNodes () const
 

Protected Attributes

pair_base_member< TKeyGetter, TTreeType * > m_GetterAndParent
 Key getter and pointer to the parent node. More...
 
TNodeList m_Nodes
 List of dependent nodes. More...
 
TValue m_Value
 Node value. More...
 

Detailed Description

template<class TValue, class TKeyGetterP = CDefaultNodeKeyGetter<TValue>>
struct CTreeNode< TValue, TKeyGetterP >

definition of a Culling tree

Definition at line 99 of file ncbi_tree.hpp.

Member Data Documentation

◆ begin

template<class TValue , class TKeyGetterP = CDefaultNodeKeyGetter<TValue>>
Int4 CTreeNode< TValue, TKeyGetterP >::begin

Definition at line 202 of file hspfilter_culling.c.

Referenced by s_CTreeNodeNew(), and s_ForkChildren().

◆ end

template<class TValue , class TKeyGetterP = CDefaultNodeKeyGetter<TValue>>
Int4 CTreeNode< TValue, TKeyGetterP >::end

Definition at line 203 of file hspfilter_culling.c.

Referenced by s_CTreeNodeNew(), and s_ForkChildren().

◆ hsplist

template<class TValue , class TKeyGetterP = CDefaultNodeKeyGetter<TValue>>
LinkedHSP* CTreeNode< TValue, TKeyGetterP >::hsplist

Definition at line 206 of file hspfilter_culling.c.

Referenced by s_CTreeNodeFree(), s_CTreeNodeNew(), s_ForkChildren(), and s_SaveHSP().

◆ left

template<class TValue , class TKeyGetterP = CDefaultNodeKeyGetter<TValue>>
struct CTreeNode* CTreeNode< TValue, TKeyGetterP >::left

Definition at line 204 of file hspfilter_culling.c.

Referenced by s_CTreeNodeFree(), s_CTreeNodeNew(), s_ForkChildren(), and s_SaveHSP().

◆ right

template<class TValue , class TKeyGetterP = CDefaultNodeKeyGetter<TValue>>
struct CTreeNode* CTreeNode< TValue, TKeyGetterP >::right

Definition at line 205 of file hspfilter_culling.c.

Referenced by s_CTreeNodeFree(), s_CTreeNodeNew(), s_ForkChildren(), and s_SaveHSP().


The documentation for this struct was generated from the following files:
Modified on Tue Apr 23 07:38:28 2024 by modify_doxy.py rev. 669887