#include <tree.h>
Definition at line 221 of file tree.h.
Public Member Functions | |
fixed_depth_iterator () | |
fixed_depth_iterator (tree_node *) | |
fixed_depth_iterator (const iterator_base &) | |
fixed_depth_iterator (const sibling_iterator &) | |
fixed_depth_iterator (const fixed_depth_iterator &) | |
bool | operator== (const fixed_depth_iterator &) const |
bool | operator!= (const fixed_depth_iterator &) const |
fixed_depth_iterator & | operator++ () |
fixed_depth_iterator & | operator-- () |
fixed_depth_iterator | operator++ (int) |
fixed_depth_iterator | operator-- (int) |
fixed_depth_iterator & | operator+= (unsigned int) |
fixed_depth_iterator & | operator-= (unsigned int) |
Data Fields | |
tree_node * | first_parent_ |
Private Member Functions | |
void | set_first_parent_ () |
void | find_leftmost_parent_ () |
tree< T, tree_node_allocator >::fixed_depth_iterator::fixed_depth_iterator | ( | ) | [inline] |
Definition at line 2222 of file tree.h.
References tree< T, tree_node_allocator >::fixed_depth_iterator::set_first_parent_().
02223 : iterator_base() 02224 { 02225 set_first_parent_(); 02226 }
tree< T, tree_node_allocator >::fixed_depth_iterator::fixed_depth_iterator | ( | tree_node * | tn | ) | [inline] |
Definition at line 2229 of file tree.h.
References tree< T, tree_node_allocator >::fixed_depth_iterator::set_first_parent_().
02230 : iterator_base(tn) 02231 { 02232 set_first_parent_(); 02233 }
tree< T, tree_node_allocator >::fixed_depth_iterator::fixed_depth_iterator | ( | const iterator_base & | other | ) | [inline] |
Definition at line 2236 of file tree.h.
References tree< T, tree_node_allocator >::fixed_depth_iterator::set_first_parent_().
02237 : iterator_base(other.node) 02238 { 02239 set_first_parent_(); 02240 }
tree< T, tree_node_allocator >::fixed_depth_iterator::fixed_depth_iterator | ( | const sibling_iterator & | other | ) | [inline] |
Definition at line 2243 of file tree.h.
References tree< T, tree_node_allocator >::fixed_depth_iterator::find_leftmost_parent_().
02244 : iterator_base(other.node), first_parent_(other.parent_) 02245 { 02246 find_leftmost_parent_(); 02247 }
tree< T, tree_node_allocator >::fixed_depth_iterator::fixed_depth_iterator | ( | const fixed_depth_iterator & | other | ) | [inline] |
Definition at line 2250 of file tree.h.
02251 : iterator_base(other.node), first_parent_(other.first_parent_) 02252 { 02253 }
bool tree< T, tree_node_allocator >::fixed_depth_iterator::operator== | ( | const fixed_depth_iterator & | other | ) | const [inline] |
Definition at line 2256 of file tree.h.
References tree< T, tree_node_allocator >::fixed_depth_iterator::first_parent_, and tree< T, tree_node_allocator >::iterator_base::node.
02257 { 02258 if(other.node==this->node && other.first_parent_==first_parent_) return true; 02259 else return false; 02260 }
bool tree< T, tree_node_allocator >::fixed_depth_iterator::operator!= | ( | const fixed_depth_iterator & | other | ) | const [inline] |
Definition at line 2263 of file tree.h.
References tree< T, tree_node_allocator >::fixed_depth_iterator::first_parent_, and tree< T, tree_node_allocator >::iterator_base::node.
02264 { 02265 if(other.node!=this->node || other.first_parent_!=first_parent_) return true; 02266 else return false; 02267 }
tree< T, tree_node_allocator >::fixed_depth_iterator & tree< T, tree_node_allocator >::fixed_depth_iterator::operator++ | ( | ) | [inline] |
Definition at line 2295 of file tree.h.
References tree_node_< T >::first_child, tree_node_< T >::next_sibling, tree< T, tree_node_allocator >::iterator_base::node, and tree_node_< T >::parent.
02296 { 02297 assert(this->node!=0); 02298 02299 if(this->node->next_sibling) { 02300 this->node=this->node->next_sibling; 02301 } 02302 else { 02303 int relative_depth=0; 02304 upper: 02305 do { 02306 this->node=this->node->parent; 02307 if(this->node==0) return *this; 02308 --relative_depth; 02309 } while(this->node->next_sibling==0); 02310 lower: 02311 this->node=this->node->next_sibling; 02312 while(this->node->first_child==0) { 02313 if(this->node->next_sibling==0) 02314 goto upper; 02315 this->node=this->node->next_sibling; 02316 if(this->node==0) return *this; 02317 } 02318 while(relative_depth<0 && this->node->first_child!=0) { 02319 this->node=this->node->first_child; 02320 ++relative_depth; 02321 } 02322 if(relative_depth<0) { 02323 if(this->node->next_sibling==0) goto upper; 02324 else goto lower; 02325 } 02326 } 02327 return *this; 02328 02329 // if(this->node->next_sibling!=0) { 02330 // this->node=this->node->next_sibling; 02331 // assert(this->node!=0); 02332 // if(this->node->parent==0 && this->node->next_sibling==0) // feet element 02333 // this->node=0; 02334 // } 02335 // else { 02336 // tree_node *par=this->node->parent; 02337 // do { 02338 // par=par->next_sibling; 02339 // if(par==0) { // FIXME: need to keep track of this! 02340 // this->node=0; 02341 // return *this; 02342 // } 02343 // } while(par->first_child==0); 02344 // this->node=par->first_child; 02345 // } 02346 return *this; 02347 }
tree< T, tree_node_allocator >::fixed_depth_iterator & tree< T, tree_node_allocator >::fixed_depth_iterator::operator-- | ( | ) | [inline] |
Definition at line 2350 of file tree.h.
References tree_node_< T >::last_child, tree< T, tree_node_allocator >::iterator_base::node, tree_node_< T >::parent, and tree_node_< T >::prev_sibling.
02351 { 02352 assert(this->node!=0); 02353 if(this->node->prev_sibling!=0) { 02354 this->node=this->node->prev_sibling; 02355 assert(this->node!=0); 02356 if(this->node->parent==0 && this->node->prev_sibling==0) // head element 02357 this->node=0; 02358 } 02359 else { 02360 tree_node *par=this->node->parent; 02361 do { 02362 par=par->prev_sibling; 02363 if(par==0) { // FIXME: need to keep track of this! 02364 this->node=0; 02365 return *this; 02366 } 02367 } while(par->last_child==0); 02368 this->node=par->last_child; 02369 } 02370 return *this; 02371 }
tree< T, tree_node_allocator >::fixed_depth_iterator tree< T, tree_node_allocator >::fixed_depth_iterator::operator++ | ( | int | ) | [inline] |
Definition at line 2374 of file tree.h.
02375 { 02376 fixed_depth_iterator copy = *this; 02377 ++(*this); 02378 return copy; 02379 }
tree< T, tree_node_allocator >::fixed_depth_iterator tree< T, tree_node_allocator >::fixed_depth_iterator::operator-- | ( | int | ) | [inline] |
Definition at line 2382 of file tree.h.
02383 { 02384 fixed_depth_iterator copy = *this; 02385 --(*this); 02386 return copy; 02387 }
tree< T, tree_node_allocator >::fixed_depth_iterator & tree< T, tree_node_allocator >::fixed_depth_iterator::operator+= | ( | unsigned int | num | ) | [inline] |
tree< T, tree_node_allocator >::fixed_depth_iterator & tree< T, tree_node_allocator >::fixed_depth_iterator::operator-= | ( | unsigned int | num | ) | [inline] |
void tree< T, tree_node_allocator >::fixed_depth_iterator::set_first_parent_ | ( | ) | [inline, private] |
Definition at line 2270 of file tree.h.
References tree< T, tree_node_allocator >::fixed_depth_iterator::find_leftmost_parent_(), tree< T, tree_node_allocator >::fixed_depth_iterator::first_parent_, tree< T, tree_node_allocator >::iterator_base::node, and tree_node_< T >::parent.
Referenced by tree< T, tree_node_allocator >::fixed_depth_iterator::fixed_depth_iterator().
02271 { 02272 return; // FIXME: we do not use first_parent_ yet, and it actually needs some serious reworking if 02273 // it is ever to work at the 'head' level. 02274 first_parent_=0; 02275 if(this->node==0) return; 02276 if(this->node->parent!=0) 02277 first_parent_=this->node->parent; 02278 if(first_parent_) 02279 find_leftmost_parent_(); 02280 }
void tree< T, tree_node_allocator >::fixed_depth_iterator::find_leftmost_parent_ | ( | ) | [inline, private] |
Definition at line 2283 of file tree.h.
References tree_node_< T >::first_child, tree< T, tree_node_allocator >::fixed_depth_iterator::first_parent_, and tree_node_< T >::prev_sibling.
Referenced by tree< T, tree_node_allocator >::fixed_depth_iterator::fixed_depth_iterator(), and tree< T, tree_node_allocator >::fixed_depth_iterator::set_first_parent_().
02284 { 02285 return; // FIXME: see 'set_first_parent()' 02286 tree_node *tmppar=first_parent_; 02287 while(tmppar->prev_sibling) { 02288 tmppar=tmppar->prev_sibling; 02289 if(tmppar->first_child) 02290 first_parent_=tmppar; 02291 } 02292 }
tree_node* tree< T, tree_node_allocator >::fixed_depth_iterator::first_parent_ |
Definition at line 238 of file tree.h.
Referenced by tree< T, tree_node_allocator >::fixed_depth_iterator::find_leftmost_parent_(), tree< T, tree_node_allocator >::fixed_depth_iterator::operator!=(), tree< T, tree_node_allocator >::fixed_depth_iterator::operator==(), and tree< T, tree_node_allocator >::fixed_depth_iterator::set_first_parent_().