Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members  

mpcl::util::collection::TTreeNode< TItem, TAllocator > Class Template Reference

Tree node class. More...

#include <general_tree.hh>

List of all members.

Public Types

typedef memory::TAllocSmartPointer<
TTreeNode, TAllocator > 
alloc_smart_pointer
 Smart pointer to this class.

typedef const TItem & const_reference
 Const reference type.

typedef TItem * pointer
 Pointer type.

typedef TItem & reference
 Reference type.

typedef TItem value_type
 Value type.

typedef std::size_t size_type
 Size type.


Public Methods

 TTreeNode (const TItem &rktITEM)
void insert (alloc_smart_pointer &rqtTARGET_NODE) throw (TConstraintException)
size_type height (void) const
const TTreeNode * parent (void) const
size_type size (void) const

Static Public Methods

alloc_smart_pointer _copy (const alloc_smart_pointer &rkqtNODE, TTreeNode *&rptNODE_HEAP)
alloc_smart_pointer _copy (alloc_smart_pointer &rqtTARGET_NODE, const alloc_smart_pointer &rkqtNODE, TTreeNode *&rptNODE_HEAP) throw (TConstraintException)
alloc_smart_pointer _copySiblings (const alloc_smart_pointer &rkqtNODE, const TTreeNode *pktPARENT_NODE, TTreeNode *&rptNODE_HEAP)
TTreeNode * _create (const TItem &rktITEM, TTreeNode *ptNODE_HEAP)
void _link (alloc_smart_pointer &qtLEFT_NODE, alloc_smart_pointer &qtRIGHT_NODE)
void _link (alloc_smart_pointer &qtLEFT_NODE, alloc_smart_pointer &qtMIDDLE_NODE, alloc_smart_pointer &qtRIGHT_NODE)
void _unlink (TTreeNode *ptTARGET_NODE) throw (TConstraintException)

Public Attributes

TItem tItem
 Node item.

TTreeNode * ptLeftNode
 Pointer to the left node (if any).

TTreeNode * ptParentNode
 Pointer to the parent node (if any).

alloc_smart_pointer qtFirstChildNode
 Pointer to the first child node.

alloc_smart_pointer qtRightNode
 Pointer to the right sibling node.


Detailed Description

template<typename TItem, template< typename TItemA > class TAllocator = std::allocator>
class mpcl::util::collection::TTreeNode< TItem, TAllocator >

Tree node class.

Definition at line 56 of file general_tree.hh.


Constructor & Destructor Documentation

template<typename TItem, template< typename TItemA > class TAllocator = std::allocator>
mpcl::util::collection::TTreeNode< TItem, TAllocator >::TTreeNode const TItem &    rktITEM [inline]
 

Builds a new instance with item rktITEM.

Parameters:
rktITEM  Source item to contain.

Definition at line 217 of file general_tree.hh.

References mpcl::util::collection::TTreeNode< TItem, TAllocator >::qtFirstChildNode, and mpcl::util::collection::TTreeNode< TItem, TAllocator >::qtRightNode.


Member Function Documentation

template<typename TItem, template< typename TItemA > class TAllocator>
TTreeNode< TItem, TAllocator >::alloc_smart_pointer mpcl::util::collection::TTreeNode< TItem, TAllocator >::_copy alloc_smart_pointer   rqtTARGET_NODE,
const alloc_smart_pointer   rkqtNODE,
TTreeNode< TItem, TAllocator > *&    rptNODE_HEAP
throw (TConstraintException) [inline, static]
 

Copies source node rkqtNODE onto this instance.

Parameters:
rkqtNODE  Source node.
Returns:
Node copy.
Exceptions:
TConstraintException  if target rkqtNODE is NULL.
Precondition:
( rqtTARGET_NODE != NULL )

Definition at line 1272 of file general_tree.hh.

References mpcl::util::collection::TTreeNode< TItem, TAllocator >::ptParentNode, and mpcl::util::collection::TTreeNode< TItem, TAllocator >::qtRightNode.

template<typename TItem, template< typename TItemA > class TAllocator>
TTreeNode< TItem, TAllocator >::alloc_smart_pointer mpcl::util::collection::TTreeNode< TItem, TAllocator >::_copy const alloc_smart_pointer   rkqtNODE,
TTreeNode< TItem, TAllocator > *&    rptNODE_HEAP
[inline, static]
 

Copies source node rkqtNODE onto this instance.

Parameters:
rkqtNODE  Source node.
Returns:
Node copy.

Definition at line 1250 of file general_tree.hh.

References mpcl::util::collection::TTreeNode< TItem, TAllocator >::_copySiblings(), mpcl::util::collection::TTreeNode< TItem, TAllocator >::alloc_smart_pointer, and mpcl::util::collection::TTreeNode< TItem, TAllocator >::tItem.

Referenced by mpcl::util::collection::TTreeNode< TItem, TAllocator >::_copySiblings().

template<typename TItem, template< typename TItemA > class TAllocator>
TTreeNode< TItem, TAllocator >::alloc_smart_pointer mpcl::util::collection::TTreeNode< TItem, TAllocator >::_copySiblings const alloc_smart_pointer   rkqtNODE,
const TTreeNode< TItem, TAllocator > *    pktPARENT_NODE,
TTreeNode< TItem, TAllocator > *&    rptNODE_HEAP
[inline, static]
 

Returns a copy of source sibling nodes in rkqtNODE (including it).

Parameters:
rktqNODE  Source node to copy from.
pktPARENT_NODE  Parent node to attach new nodes.
Returns:
Target node.

Definition at line 1308 of file general_tree.hh.

References mpcl::util::collection::TTreeNode< TItem, TAllocator >::_copy(), and mpcl::util::collection::TTreeNode< TItem, TAllocator >::alloc_smart_pointer.

Referenced by mpcl::util::collection::TTreeNode< TItem, TAllocator >::_copy().

template<typename TItem, template< typename TItemA > class TAllocator = std::allocator>
TTreeNode* mpcl::util::collection::TTreeNode< TItem, TAllocator >::_create const TItem &    rktITEM,
TTreeNode< TItem, TAllocator > *    ptNODE_HEAP
[inline, static]
 

Creates a new node.

Parameters:
ptTARGET_NODE  Empty buffer that will hold the new node.
rktITEM  Source Item.
Returns:
Node copy.
Postcondition:
( ptTARGET_NODE->tItem == rktITEM )

Definition at line 153 of file general_tree.hh.

template<typename TItem, template< typename TItemA > class TAllocator = std::allocator>
void mpcl::util::collection::TTreeNode< TItem, TAllocator >::_link alloc_smart_pointer   qtLEFT_NODE,
alloc_smart_pointer   qtMIDDLE_NODE,
alloc_smart_pointer   qtRIGHT_NODE
[inline, static]
 

Links node qtMIDDLE_NODE between qtLEFT_NODE and qtRIGHT_NODE updating parent node from qtLEFT_NODE.

Parameters:
qtLEFT_NODE  Node at left.
qtCENTER_NODE  Node at center.
qtRIGHT_NODE  Node at right.
Postcondition:
( ptMIDDLE_NODE->parent() == ptLEFT_NODE->parent() )
( qtLEFT_NODE->qtRightNode == qtMIDDLE_NODE )
( qtRIGHT_NODE->ptLeftNode == qtMIDDLE_NODE )

Definition at line 185 of file general_tree.hh.

template<typename TItem, template< typename TItemA > class TAllocator = std::allocator>
void mpcl::util::collection::TTreeNode< TItem, TAllocator >::_link alloc_smart_pointer   qtLEFT_NODE,
alloc_smart_pointer   qtRIGHT_NODE
[inline, static]
 

Links node qtRIGHT_NODE to node qtLEFT_NODE.

Parameters:
qtLEFT_NODE  Left node.
qtRIGHT_NODE  Node to connect at right qtLEFT_NODE.
Postcondition:
( qtLEFT_NODE->parent() == qtRIGHT_NODE->parent() )
( qtLEFT_NODE->qtRightNode == qtRIGHT_NODE )
( qtRIGHT_NODE->ptLeftNode == qtLEFT_NODE )

Definition at line 167 of file general_tree.hh.

template<typename TItem, template< typename TItemA > class TAllocator>
void mpcl::util::collection::TTreeNode< TItem, TAllocator >::_unlink TTreeNode< TItem, TAllocator > *    ptTARGET_NODE throw (TConstraintException) [inline, static]
 

Unlinks the node ptTARGET_NODE (and its child nodes) from its parent node.

Parameters:
ptTARGET_NODE  Node to unlink.
Postcondition:
( !ptTARGET_NODE->parent() )
( ptTARGET_NODE->qtRightNode == old (ptTARGET_NODE->ptLeftNode->qtRightNode) )

Definition at line 1350 of file general_tree.hh.

template<typename TItem, template< typename TItemA > class TAllocator>
TTreeNode< TItem, TAllocator >::size_type mpcl::util::collection::TTreeNode< TItem, TAllocator >::height void    const [inline]
 

Returns the height of the tree.

Returns:
The height of the tree.

Definition at line 1564 of file general_tree.hh.

References mpcl::util::collection::TTreeNode< TItem, TAllocator >::alloc_smart_pointer, mpcl::util::collection::TTreeNode< TItem, TAllocator >::qtFirstChildNode, and mpcl::util::collection::TTreeNode< TItem, TAllocator >::size_type.

template<typename TItem, template< typename TItemA > class TAllocator>
void mpcl::util::collection::TTreeNode< TItem, TAllocator >::insert alloc_smart_pointer   rqtTARGET_NODE throw (TConstraintException) [inline]
 

Inserts node qtTARGET_NODE (but not its right sibling nodes) as the last child of this node.

Parameters:
qtTARGET_NODE  Target node to insert.
Exceptions:
TConstraintException  If qtTARGET_NODE is NULL.

Definition at line 1436 of file general_tree.hh.

template<typename TItem, template< typename TItemA > class TAllocator = std::allocator>
const TTreeNode* mpcl::util::collection::TTreeNode< TItem, TAllocator >::parent void    const [inline]
 

Returns a pointer to the parent node (if any).

Returns:
A pointer to the parent node (if any).

Definition at line 250 of file general_tree.hh.

template<typename TItem, template< typename TItemA > class TAllocator>
TTreeNode< TItem, TAllocator >::size_type mpcl::util::collection::TTreeNode< TItem, TAllocator >::size void    const [inline]
 

Returns the number of nodes attached (including this).

Returns:
The number of nodes.

Definition at line 1584 of file general_tree.hh.

References mpcl::util::collection::TTreeNode< TItem, TAllocator >::alloc_smart_pointer, mpcl::util::collection::TTreeNode< TItem, TAllocator >::qtFirstChildNode, and mpcl::util::collection::TTreeNode< TItem, TAllocator >::size_type.


The documentation for this class was generated from the following file:
Generated on Mon Oct 13 02:35:27 2003 for MPCL by doxygen1.2.18