/* -*- C++ -*- */ // $Id$ ///////////////////////////////////////////// // template class ACE_RB_Tree_Node // ///////////////////////////////////////////// // Key accessor. template ACE_INLINE KEY & ACE_RB_Tree_Node::key () { return k_; } // Item accessor. template ACE_INLINE T & ACE_RB_Tree_Node::item () { return t_; } // Set color of the node. template ACE_INLINE void ACE_RB_Tree_Node::color (ACE_RB_Tree_Node_Base::RB_Tree_Node_Color c) { color_ = c; } // Get color of the node. template ACE_INLINE ACE_RB_Tree_Node_Base::RB_Tree_Node_Color ACE_RB_Tree_Node::color () { return color_; } // Accessor for node's parent pointer. template ACE_INLINE ACE_RB_Tree_Node * ACE_RB_Tree_Node::parent () { return parent_; } // Mutator for node's parent pointer. template ACE_INLINE void ACE_RB_Tree_Node::parent (ACE_RB_Tree_Node * p) { parent_ = p; } // Accessor for node's left child pointer. template ACE_INLINE ACE_RB_Tree_Node * ACE_RB_Tree_Node::left () { return left_; } // Mutator for node's left child pointer. template ACE_INLINE void ACE_RB_Tree_Node::left (ACE_RB_Tree_Node * l) { left_ = l; } // Accessor for node's right child pointer. template ACE_INLINE ACE_RB_Tree_Node * ACE_RB_Tree_Node::right () { return right_; } // Mutator for node's right child pointer. template ACE_INLINE void ACE_RB_Tree_Node::right (ACE_RB_Tree_Node * r) { right_ = r; } //////////////////////////////////////// // template class ACE_RB_Tree // //////////////////////////////////////// // Destroys all nodes and sets the root pointer null. template ACE_INLINE void ACE_RB_Tree::clear () { delete root_; root_ = 0; } ///////////////////////////////////////////////// // template class ACE_RB_Tree_Iterator // ///////////////////////////////////////////////// // Accessor for key of node under iterator (if any). template ACE_INLINE KEY * ACE_RB_Tree_Iterator::key () { return node_ ? (&(node_->key ())) : 0; } // Accessor for item of node under iterator (if any). template ACE_INLINE T * ACE_RB_Tree_Iterator::item () { return node_ ? (&(node_->item ())) : 0; } // Move to the first item in the tree. template ACE_INLINE int ACE_RB_Tree_Iterator::first () { node_ = tree_.RB_tree_minimum (tree_.root_); return node_ ? 1 : 0; } // Move to the last item in the tree. template ACE_INLINE int ACE_RB_Tree_Iterator::last () { node_ = tree_.RB_tree_maximum (tree_.root_); return node_ ? 1 : 0; } // Moves to the next item in the tree, // returns 1 if there is a next item, 0 otherwise. template ACE_INLINE int ACE_RB_Tree_Iterator::next () { node_ = tree_.RB_tree_successor (node_); return node_ ? 1 : 0; } // Moves to the previous item in the tree, // returns 1 if there is a previous item, 0 otherwise. template ACE_INLINE int ACE_RB_Tree_Iterator::previous () { node_ = tree_.RB_tree_predecessor (node_); return node_ ? 1 : 0; } template ACE_INLINE int ACE_RB_Tree_Iterator::is_done () { return node_ ? 0 : 1; }