Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

CTBbtree.icc

Go to the documentation of this file.
00001 
00006 /*----------------------------------------------------------------------------*/
00007 /* C Tool Box: Designed and implemented by:                                   */
00008 /*    Walter F.J. Mueller   Gesellschaft fuer Schwerionenforschung (GSI)      */
00009 /*                          Planckstrasse 1, D-64291 Darmstadt, Germany       */
00010 /*                  Email:  W.F.J.Mueller@gsi.de                              */
00011 /*                  WWW:    http://www-kp3.gsi.de/www/kp3/people/mueller.html */
00012 /*------------------------------------------+---------------------------------*/
00013 
00014 //------------------------------------------+-----------------------------------
00016 
00017 inline CTBbtree::CTBbtree()
00018   : mp_rnode(0),
00019     mp_first(0),
00020     mp_last(0),
00021     mi_size(0)
00022 {}
00023 
00024 //------------------------------------------+-----------------------------------
00026 
00027 inline CTBbtree::CTBbtree(const CTBbtree& rhs)
00028   : mp_rnode(0),
00029     mp_first(0),
00030     mp_last(0),
00031     mi_size(0)
00032 {
00033   operator=(rhs);
00034 }
00035 
00036 //------------------------------------------+-----------------------------------
00038 
00039 inline CTBbtreeNode* CTBbtree::RNode() const
00040 {
00041   return mp_rnode;
00042 }
00043 
00044 //------------------------------------------+-----------------------------------
00046 
00047 inline CTBbtreeNode* CTBbtree::First() const
00048 {
00049   return mp_first;
00050 }
00051 
00052 //------------------------------------------+-----------------------------------
00054 
00055 inline CTBbtreeNode* CTBbtree::Last() const
00056 {
00057   return mp_last;
00058 }
00059 
00060 //------------------------------------------+-----------------------------------
00062 
00063 inline CTBsize CTBbtree::Size() const
00064 {
00065   return mi_size;
00066 }
00067 
00068 //------------------------------------------+-----------------------------------
00070 
00071 inline CTBbtreeNode::CTBbtreeNode()
00072   : mp_head(0),
00073     mp_up(0),
00074     mp_left(0),
00075     mp_right(0),
00076     mi_status(0)
00077 {}
00078 
00079 //------------------------------------------+-----------------------------------
00081 
00082 inline CTBbtree* CTBbtreeNode::Head() const
00083 {
00084   return mp_head;
00085 }
00086 
00087 //------------------------------------------+-----------------------------------
00089 
00090 inline CTBbtreeNode* CTBbtreeNode::Left() const
00091 {
00092   return mp_left;
00093 }
00094 
00095 //------------------------------------------+-----------------------------------
00097 
00098 inline CTBbtreeNode* CTBbtreeNode::Right() const
00099 {
00100   return mp_right;
00101 }
00102 
00103 //------------------------------------------+-----------------------------------
00105 
00106 inline CTBbtreeNode* CTBbtreeNode::Up() const
00107 {
00108   return mp_up;
00109 }
00110 
00111 //------------------------------------------+-----------------------------------
00113 
00117 inline CTBint CTBbtreeNode::LWeight() const // left tree weight
00118 {
00119   return mi_status>>4;                      // extract 28 MSB's
00120 }
00121 
00122 //------------------------------------------+-----------------------------------
00124 
00125 inline bool CTBbtreeNode::IsRNode() const
00126 {
00127   return !mp_up;
00128 }
00129 
00130 //------------------------------------------+-----------------------------------
00132 
00133 inline bool CTBbtreeNode::IsLeftChild() const
00134 {
00135   return (mi_status & status_lchild) != 0;
00136 }
00137 
00138 //------------------------------------------+-----------------------------------
00140 
00141 inline bool CTBbtreeNode::IsRightChild() const
00142 {
00143   return (mi_status & status_rchild) != 0;
00144 }
00145 
00146 //------------------------------------------+-----------------------------------
00148 
00149 inline bool CTBbtreeNode::IsBalanced() const
00150 {
00151   return (mi_status & status_heavymask) == 0;
00152 }
00153 
00154 //------------------------------------------+-----------------------------------
00156 
00157 inline bool CTBbtreeNode::IsLeftHeavy() const
00158 {
00159   return (mi_status & status_lheavy) != 0;
00160 }
00161 
00162 //------------------------------------------+-----------------------------------
00164 
00165 inline bool CTBbtreeNode::IsRightHeavy() const
00166 {
00167   return (mi_status & status_rheavy) != 0;
00168 }
00169 
00170 //------------------------------------------+-----------------------------------
00171 inline void CTBbtreeNode::LWeight(          // set left tree weight
00172     CTBint i_weight)
00173 {
00174   mi_status = (i_weight<<4) | (mi_status & status_bitmask);
00175   return;
00176 }
00177 
00178 //------------------------------------------+-----------------------------------
00179 inline void CTBbtreeNode::IncLWeight()      // increment left tree weight
00180 {
00181   mi_status += status_deltaw;
00182   return;
00183 }
00184 
00185 //------------------------------------------+-----------------------------------
00186 inline void CTBbtreeNode::DecLWeight()      // decrement left tree weight
00187 {
00188   mi_status -= status_deltaw;
00189   return;
00190 }
00191 
00192 //------------------------------------------+-----------------------------------
00193 inline void CTBbtreeNode::SetRNode()        // set child status to rnode
00194 {
00195   mi_status &= (~status_childmask);         // clear child mode bits
00196   return;
00197 }
00198 
00199 //------------------------------------------+-----------------------------------
00200 inline void CTBbtreeNode::SetLeftChild()    // set child status to left
00201 {
00202   mi_status &= (~status_childmask);
00203   mi_status |= status_lchild;
00204   return;
00205 }
00206 
00207 //------------------------------------------+-----------------------------------
00208 inline void CTBbtreeNode::SetRightChild()   // set child status to right
00209 {
00210   mi_status &= (~status_childmask);
00211   mi_status |= status_rchild;
00212   return;
00213 }
00214 
00215 //------------------------------------------+-----------------------------------
00216 inline void CTBbtreeNode::SetBalanced()     // set bfactor to balanced
00217 {
00218   mi_status &= (~status_heavymask);         // clear balance bits
00219   return;
00220 }
00221 
00222 //------------------------------------------+-----------------------------------
00223 inline void CTBbtreeNode::SetLeftHeavy()    // set bfactor to left heavy
00224 {
00225   mi_status |= status_lheavy;
00226   return;
00227 }
00228 
00229 //------------------------------------------+-----------------------------------
00230 inline void CTBbtreeNode::SetRightHeavy()   // set bfactor to right heavy
00231 {
00232   mi_status |= status_rheavy;
00233   return;
00234 }
00235 

Generated at Fri Oct 24 18:11:27 2003 for CTBbase by doxygen1.2.9-20010812 written by Dimitri van Heesch, © 1997-2001