NCBI C++ ToolKit
ctreecont.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: ctreecont.cpp 66365 2015-02-25 15:50:50Z domrach $
2 * ===========================================================================
3 *
4 * PUBLIC DOMAIN NOTICE
5 * National Center for Biotechnology Information
6 *
7 * This software/database is a "United States Government Work" under the
8 * terms of the United States Copyright Act. It was written as part of
9 * the author's official duties as a United States Government employee and
10 * thus cannot be copyrighted. This software/database is freely available
11 * to the public for use. The National Library of Medicine and the U.S.
12 * Government have not placed any restriction on its use or reproduction.
13 *
14 * Although all reasonable efforts have been taken to ensure the accuracy
15 * and reliability of the software and data, the NLM and the U.S.
16 * Government do not and cannot warrant the performance or results that
17 * may be obtained by using this software or data. The NLM and the U.S.
18 * Government disclaim all warranties, express or implied, including
19 * warranties of performance, merchantability or fitness for any particular
20 * purpose.
21 *
22 * Please cite the author in any work or product based on this material.
23 *
24 * ===========================================================================
25 *
26 * File Name: CTreeCont.cpp
27 *
28 * Author: Vladimir Soussov, Yuri Sadykov, Michael Domrachev
29 *
30 * File Description: General purpose tree container implementation
31 *
32 */
33 
34 #include <ncbi_pch.hpp>
35 #include "ctreecont.hpp"
36 
37 
39 BEGIN_objects_SCOPE
40 
41 
43 {
44  if(m_node == subtree_root)
45  return true;
46  for(CTreeContNodeBase* pN= m_node->m_parent; pN != 0; pN= pN->m_parent) {
47  if(pN == subtree_root)
48  return true;
49  }
50  return false;
51 }
52 
54 {
55  if(node == 0) return false;
56  do {
57  if(node->m_parent == m_node) return true;
58  }
59  while((node= node->m_parent) != 0);
60 
61  return false;
62 }
63 
64 // move cursor to the nearest common ancestor
66 {
67  if(BelongSubtree(node)) {
68  m_node= node;
69  return true;
70  }
72  while(!AboveNode(node)) {
73  if(m_node->m_parent == 0) {
74  m_node= pN;
75  return false;
76  }
78  }
79  return true;
80 }
81 
82 
83 // add child to a node pointed by cursor
85 {
86  if(new_node) {
88  new_node->m_parent= m_node;
89  new_node->m_sibling= m_node->m_child;
90  new_node->m_child= 0;
91  m_node->m_child= new_node;
92  m_tree->Done(new_node);
93  return true;
94  }
95  return false;
96 }
97 
98 // add sibling to a node pointed by cursor
100 {
101  if(new_node && m_node->m_parent) {
103  new_node->m_parent= m_node->m_parent;
104  new_node->m_sibling= m_node->m_sibling;
105  new_node->m_child= 0;
106  m_node->m_sibling= new_node;
107  m_tree->Done(new_node);
108  return true;
109  }
110  return false;
111 }
112 
114 {
115  if((to_node == 0) || AboveNode(to_node)) {
116  return false;
117  }
118 
119  if(m_node->m_parent == to_node) return true;
120 
121  // notify the spies
122  m_tree->MoveNode(m_node, to_node);
123 
124 
125  // detach the node
126  if(m_node->m_parent->m_child == m_node) { // this is a first child
128  }
129  else {
130  CTreeContNodeBase* pN;
131  for( pN= m_node->m_parent->m_child;
132  pN->m_sibling != m_node;
133  pN= pN->m_sibling );
134  pN->m_sibling= m_node->m_sibling;
135  }
136 
137  // attach it
138  m_node->m_sibling= to_node->m_child;
139  m_node->m_parent= to_node;
140  to_node->m_child= m_node;
141 
142  // notify the spies
143  m_tree->Done(m_node);
144 
145  return true;
146 }
147 
149 {
150  if((to_node == 0) || AboveNode(to_node)) {
151  return false;
152  }
153 
154  if((m_node == to_node) || (m_node->m_child == 0)) return true;
155 
156  // notify the spies
157  m_tree->MoveChildren(m_node, to_node);
158 
160 
161  do {
162  pN->m_parent= to_node;
163  if(pN->m_sibling == 0) break;
164  }
165  while((pN= pN->m_sibling) != 0);
166 
167  pN->m_sibling= to_node->m_child;
168  to_node->m_child= m_node->m_child;
169  m_node->m_child= 0;
170 
171  // notify the spies
172  m_tree->Done(m_node);
173 
174  return true;
175 }
176 
178 {
179  CTreeContNodeBase* pNxt;
180  for(CTreeContNodeBase* pChild= pN->m_child; pChild != 0; pChild= pNxt) {
181  pNxt= pChild->m_sibling;
182  DelNodeInternal(pChild);
183  }
184  delete pN;
185 }
186 
188 {
189  if(m_node->m_parent == 0) return false; // can't delete the whole tree
190 
191  // notify the spies
192  m_tree->DeleteSubtree(m_node, this);
193 
194  CTreeContNodeBase* pN;
195 
196  // detach the node
197  if(m_node->m_parent->m_child == m_node) { // this is a first child
199  }
200  else {
201  for(pN= m_node->m_parent->m_child;
202  pN->m_sibling != m_node;
203  pN= pN->m_sibling);
204  pN->m_sibling= m_node->m_sibling;
205  }
206 
207  pN= m_node->m_parent;
208 
210 
211  // notify the spies
212  m_node= pN;
213  m_tree->Done(m_node);
214 
215  return true;
216 }
217 
218 
220 {
221  if(m_node->m_parent == 0) return false; // can't delete the root
222  if(m_node->m_child) {
224  }
225 
226  return DeleteSubtree();
227 }
228 
230 {
231  if(MoveChildren(to_node)) {
232  m_tree->Merge(m_node, to_node, this);
233  to_node->Merge(m_node);
234 
235  // detach the node
236  if(m_node->m_parent->m_child == m_node) { // this is a first child
238  }
239  else {
240  CTreeContNodeBase* pN;
241  for(pN= m_node->m_parent->m_child;
242  pN->m_sibling != m_node;
243  pN= pN->m_sibling);
244  pN->m_sibling= m_node->m_sibling;
245  }
246  delete m_node;
247  m_node= to_node;
248  m_tree->Done(m_node);
249  return true;
250  }
251  return false;
252 }
253 
256 {
257  switch( cb.Execute(m_node) ) {
258  default:
259  case eCont:
260  if(!m_node->IsTerminal()) {
261  switch( cb.LevelBegin(m_node) ) {
262  case eStop: return eStop;
263  default:
264  case eCont:
265  if(GoChild()) {
266  do {
267  if(ForEachDownward(cb)==eStop)
268  return eStop;
269  } while(GoSibling());
270  }
271  case eSkip: // Means skip this level
272  break;
273  }
274  GoParent();
275  if( cb.LevelEnd(m_node) == eStop )
276  return eStop;
277  }
278  case eSkip: break;
279  case eStop: return eStop;
280  }
281  return eCont;
282 }
283 
285 CTreeIterator::ForEachDownward(ForEachFunc ucb, void* user_data)
286 {
287  switch( (*ucb)(m_node, user_data) ) {
288  default:
289  case eCont:
290  if(GoChild()) {
291  do {
292  if(ForEachDownward(ucb, user_data)==eStop)
293  return eStop;
294  } while(GoSibling());
295  GoParent();
296  }
297  case eSkip: break;
298  case eStop: return eStop;
299  }
300  return eCont;
301 }
302 
305 {
306  if(levels > 0) {
307  switch( cb.Execute(m_node) ) {
308  default:
309  case eCont:
310  if(!m_node->IsTerminal()) {
311  switch( cb.LevelBegin(m_node) ) {
312  case eStop: return eStop;
313  default:
314  case eCont:
315  if(GoChild()) {
316  do {
317  if(ForEachDownwardLimited(cb, levels-1)==eStop)
318  return eStop;
319  } while(GoSibling());
320  }
321  case eSkip: // Means skip this level
322  break;
323  }
324  GoParent();
325  if( cb.LevelEnd(m_node) == eStop )
326  return eStop;
327  }
328  case eSkip: break;
329  case eStop: return eStop;
330  }
331  }
332  return eCont;
333 }
334 
336 CTreeIterator::ForEachDownwardLimited(ForEachFunc ucb, void* user_data,
337  int levels)
338 {
339  if(levels > 0) {
340  switch( (*ucb)(m_node, user_data) ) {
341  default:
342  case eCont:
343  if(GoChild()) {
344  do {
345  if(ForEachDownwardLimited(ucb, user_data,
346  levels-1)==eStop)
347  return eStop;
348  } while(GoSibling());
349  GoParent();
350  }
351  case eSkip: break;
352  case eStop: return eStop;
353  }
354  }
355  return eCont;
356 }
357 
358 ///////////////////////////////////////////////////////
359 // Get iterators
360 ///////////////////////////////////////////////////////
363 {
364  return new CTreeIterator(this);
365 }
366 
369 {
370  return new CTreeConstIterator(this);
371 }
372 ///////////////////////////////////////////////////////
373 // delete subtree notification (private method)
374 ///////////////////////////////////////////////////////
375 void
377 {
378  // int i;
379 
380  // if((n= m_cursorPot.nof()) > 1) {
381  // // move all cursors out of deleted subtree
382  // CTreeIterator* iCursor;
383 
384  // for(i= 0; i < n; i++) {
385  // iCursor= (CTreeIterator*)(m_cursorPot.get(i));
386  // if((iCursor != pCursor) && iCursor->belongSubtree(stroot)) {
387  // iCursor->GoNode(stroot->m_parent); // move it up
388  // }
389  // }
390  // }
391 }
392 
393 ////////////////////////////////////////////////////////////
394 // notify others that operation completed (private method)
395 ////////////////////////////////////////////////////////////
397 {
398  // int n= m_spyPot.nof();
399 
400  // if(n > 0) { // notify all spies about delSubtree operation
401  // int i;
402  // CTreeContSpy* pSpy;
403 
404  // for(i= 0; i < n; i++) {
405  // pSpy= (CTreeContSpy*)(m_spyPot.get(i));
406  // pSpy->Done(node);
407  // }
408  // }
409 }
410 
411 ///////////////////////////////////////////////////////////
412 // move node notification (private method)
413 ///////////////////////////////////////////////////////////
415 {
416  // int n= m_spyPot.nof();
417 
418  // if(n > 0) { // notify all spies about delSubtree operation
419  // int i;
420  // CTreeContSpy* pSpy;
421 
422  // for(i= 0; i < n; i++) {
423  // pSpy= (CTreeContSpy*)(m_spyPot.get(i));
424  // pSpy->node_move(node2move, new_parent);
425  // }
426  // }
427 }
428 
429 //////////////////////////////////////////////////////////////
430 // move children (private method)
431 //////////////////////////////////////////////////////////////
433 {
434  // int n= m_spyPot.nof();
435 
436  // if(n > 0) { // notify all spies about delSubtree operation
437  // int i;
438  // CTreeContSpy* pSpy;
439 
440  // for(i= 0; i < n; i++) {
441  // pSpy= (CTreeContSpy*)(m_spyPot.get(i));
442  // pSpy->children_move(old_parent, new_parent);
443  // }
444  // }
445 }
446 
447 ///////////////////////////////////////////////////////////////
448 // add child notification (private method)
449 ///////////////////////////////////////////////////////////////
451 {
452  // int n= m_spyPot.nof();
453 
454  // if(n > 0) { // notify all spies about delSubtree operation
455  // int i;
456  // CTreeContSpy* pSpy;
457 
458  // for(i= 0; i < n; i++) {
459  // pSpy= (CTreeContSpy*)(m_spyPot.get(i));
460  // pSpy->child_add(parent);
461  // }
462  // }
463 }
464 
465 //////////////////////////////////////////////////////
466 // merge nodes notification (private method)
467 //////////////////////////////////////////////////////
469  CTreeIterator* )
470 {
471  // int i;
472  // int n= m_spyPot.nof();
473 
474  // if(n > 0) { // notify all spies about delSubtree operation
475  // CTreeContSpy* pSpy;
476 
477  // for(i= 0; i < n; i++) {
478  // pSpy= (CTreeContSpy*)(m_spyPot.get(i));
479  // pSpy->node_merge(src, dst);
480  // }
481  // }
482 
483  // if((n= m_cursorPot.nof()) > 1) {
484  // // move all cursors out of src
485  // CTreeIterator* iCursor;
486 
487  // for(i= 0; i < n; i++) {
488  // iCursor= (CTreeIterator*)(m_cursorPot.get(i));
489  // if((iCursor != pCursor) && (iCursor->getNode() == src)) {
490  // iCursor->GoNode(dst); // move it to merged node
491  // }
492  // }
493  // }
494 }
495 
497 {
498  // int i, n;
499 
500  // // delete all cursors
501  // if((n= m_cursorPot.nof()) > 1) {
502  // // move all cursors out of deleted subtree
503  // CTreeIterator* iCursor;
504 
505  // for(i= 0; i < n; i++) {
506  // iCursor= (CTreeIterator*)(m_cursorPot.get(i));
507  // delete iCursor;
508  // }
509  // }
510  if(m_root)
512 }
513 
514 
516  CTreeContNodeBase* pNewNode)
517 {
518  if(pNewNode && pParentNode) {
519  pNewNode->m_parent = pParentNode;
520  pNewNode->m_sibling = pParentNode->m_child;
521  pNewNode->m_child = 0;
522  pParentNode->m_child = pNewNode;
523 
524  return true;
525  }
526 
527  return false;
528 }
529 
530 
532  const
533 {
534  if(m_node == subtree_root)
535  return true;
536  for(const CTreeContNodeBase* pN= m_node->m_parent; pN != 0;
537  pN= pN->m_parent) {
538  if(pN == subtree_root)
539  return true;
540  }
541  return false;
542 }
543 
545 {
546  if(node == 0)
547  return false;
548  do {
549  if(node->m_parent == m_node)
550  return true;
551  }
552  while((node= node->m_parent) != 0);
553 
554  return false;
555 }
556 
557 // move cursor to the nearest common ancestor
559 {
560  if(BelongSubtree(node)) {
561  m_node= node;
562  return true;
563  }
564  const CTreeContNodeBase* pN= m_node;;
565  while(!AboveNode(node)) {
566  if(m_node->m_parent == 0) {
567  m_node= pN;
568  return false;
569  }
571  }
572  return true;
573 }
574 
575 // CTreeConstIterator::EAction
576 // CTreeConstIterator::ForEachDownward(C4Each& cb)
577 // {
578 // switch( cb.Execute(m_node) ) {
579 // default:
580 // case eCont:
581 // if(!m_node->IsTerminal()) {
582 // switch( cb.LevelBegin(m_node) ) {
583 // case eStop: return eStop;
584 // default:
585 // case eCont:
586 // if(GoChild()) {
587 // do {
588 // if(ForEachDownward(cb)==eStop) return eStop;
589 // } while(GoSibling());
590 // }
591 // case eSkip: // Means skip this level
592 // break;
593 // }
594 // GoParent();
595 // if( cb.LevelEnd(m_node) == eStop )
596 // return eStop;
597 // }
598 // case eSkip: break;
599 // case eStop: return eStop;
600 // }
601 // return eCont;
602 // }
603 
604 // CTreeConstIterator::EAction
605 // CTreeConstIterator::ForEachDownward(ForEachFunc ucb, void* user_data)
606 // {
607 // switch( (*ucb)(m_node, user_data) ) {
608 // default:
609 // case eCont:
610 // if(GoChild()) {
611 // do {
612 // if(ForEachDownward(ucb, user_data)==eStop) return eStop;
613 // } while(GoSibling());
614 // GoParent();
615 // }
616 // case eSkip: break;
617 // case eStop: return eStop;
618 // }
619 // return eCont;
620 // }
621 
622 // CTreeConstIterator::EAction
623 // CTreeConstIterator::ForEachDownwardLimited(C4Each& cb, int levels)
624 // {
625 // if(levels > 0) {
626 // switch( cb.Execute(m_node) ) {
627 // default:
628 // case eCont:
629 // if(!m_node->IsTerminal()) {
630 // switch( cb.LevelBegin(m_node) ) {
631 // case eStop: return eStop;
632 // default:
633 // case eCont:
634 // if(GoChild()) {
635 // do {
636 // if(ForEachDownwardLimited(cb, levels-1)==eStop)
637 // return eStop;
638 // } while(GoSibling());
639 // }
640 // case eSkip: // Means skip this level
641 // break;
642 // }
643 // GoParent();
644 // if( cb.LevelEnd(m_node) == eStop )
645 // return eStop;
646 // }
647 // case eSkip: break;
648 // case eStop: return eStop;
649 // }
650 // }
651 // return eCont;
652 // }
653 
654 // CTreeConstIterator::EAction
655 // CTreeConstIterator::ForEachDownwardLimited( ForEachFunc ucb,
656 // void* user_data, int levels)
657 // {
658 // if(levels > 0) {
659 // switch( (*ucb)(m_node, user_data) ) {
660 // default:
661 // case eCont:
662 // if(GoChild()) {
663 // do {
664 // if(ForEachDownwardLimited(ucb, user_data,
665 // levels-1)==eStop)
666 // return eStop;
667 // } while(GoSibling());
668 // GoParent();
669 // }
670 // case eSkip: break;
671 // case eStop: return eStop;
672 // }
673 // }
674 // return eCont;
675 // }
676 
677 // add child preserving the sorting order
680 {
681  // Temporary
684 
685  if( GoChild() ) {
686  new_node->m_child = 0;
687  new_node->m_parent = m_node->Parent();
688  prev = 0;
689  next = GetNode();
690  while( next && pred.Execute( next, new_node ) ) {
691  prev = next;
692  next = prev->Sibling();
693  }
694  new_node->m_sibling = next;
695  if( prev ) { // insert after prevtmp
696  prev->m_sibling = new_node;
697  } else { // insert as first child
698  new_node->Parent()->m_child = new_node;
699  }
700  // Restore state
701  GoParent();
702  } else {
703  return AddChild( new_node );
704  }
705  return true;
706 }
707 
709 {
710  // Sorting the list by insertion
714  CTreeContNodeBase* prevtmp;
715 
716  if( GoChild() ) {
717  prev = GetNode();
718  if( GoSibling() ) {
719  next = GetNode();
720  while( next ) {
721  if( !pred.Execute( prev, next ) ) { // The order is not right
722  tmp = prev->Parent()->Child();
723  prevtmp = 0;
724  while( tmp != prev && pred.Execute( tmp, next ) &&
725  (prevtmp = tmp) && (tmp = tmp->Sibling()) );
726  if( tmp ) {
727  // Move from prev place
728  prev->m_sibling = next->m_sibling;
729 
730  if( prevtmp ) { // insert after prevtmp
731  next->m_sibling = prevtmp->m_sibling;
732  prevtmp->m_sibling = next;
733  } else { // insert as first child
734  next->m_sibling = prev->Parent()->Child();
735  prev->Parent()->m_child = next;
736  }
737  }
738  } else { // the oreder is right, move to the next
739  prev = next;
740  }
741  next = prev->Sibling();
742  }
743  }
744  // Restore state
745  GoParent();
746  }
747 }
748 
750 public:
752  : m_pred(pred), m_tree(tree) {}
756  if( it->GoNode( pNode ) ) {
757  it->SortChildren( m_pred );
758  } else {
759  retc = CTreeIterator::eSkip;
760  }
761  delete it;
762  return retc;
763  }
764 private:
767 };
768 
769 void
771 {
772  CLevelSort sorter( pred, m_tree );
773  ForEachDownward( sorter );
774 }
775 
778 {
779  if(!m_node->IsTerminal()) {
780  switch( cb.LevelBegin(m_node) ) {
781  case eStop: return eStop;
782  default:
783  case eCont:
784  if(GoChild()) {
785  do {
786  if(ForEachUpward(cb)==eStop)
787  return eStop;
788  } while(GoSibling());
789  }
790  case eSkip: // Means skip this level
791  break;
792  }
793  GoParent();
794  if( cb.LevelEnd(m_node) == eStop )
795  return eStop;
796  }
797  return cb.Execute(m_node);
798 }
799 
801 CTreeIterator::ForEachUpward(ForEachFunc ucb, void* user_data)
802 {
803  if(GoChild()) {
804  do {
805  if(ForEachUpward(ucb, user_data)==eStop)
806  return eStop;
807  } while(GoSibling());
808  GoParent();
809  }
810  return (*ucb)(m_node, user_data);
811 }
812 
815 {
816  if(levels > 0) {
817  if(!m_node->IsTerminal()) {
818  switch( cb.LevelBegin(m_node) ) {
819  case eStop: return eStop;
820  default:
821  case eCont:
822  if(GoChild()) {
823  do {
824  if(ForEachUpwardLimited(cb, levels-1)==eStop)
825  return eStop;
826  } while(GoSibling());
827  }
828  case eSkip: // Means skip this level
829  break;
830  }
831  GoParent();
832  if( cb.LevelEnd(m_node) == eStop )
833  return eStop;
834  }
835  return cb.Execute(m_node);
836  }
837  return eCont;
838 }
839 
841 CTreeIterator::ForEachUpwardLimited(ForEachFunc ucb, void* user_data,
842  int levels)
843 {
844  if(levels > 0) {
845  if(GoChild()) {
846  do {
847  if(ForEachUpwardLimited(ucb, user_data,
848  levels-1)==eStop)
849  return eStop;
850  } while(GoSibling());
851  GoParent();
852  }
853  return (*ucb)(m_node, user_data);
854  }
855  return eCont;
856 }
857 
858 // CTreeConstIterator::EAction
859 // CTreeConstIterator::ForEachUpward(C4Each& cb)
860 // {
861 // if(!m_node->IsTerminal()) {
862 // switch( cb.LevelBegin(m_node) ) {
863 // case eStop: return eStop;
864 // default:
865 // case eCont:
866 // if(GoChild()) {
867 // do {
868 // if(ForEachUpward(cb)==eStop)
869 // return eStop;
870 // } while(GoSibling());
871 // }
872 // case eSkip: // Means skip this level
873 // break;
874 // }
875 // GoParent();
876 // if( cb.LevelEnd(m_node) == eStop )
877 // return eStop;
878 // }
879 // return cb.Execute(m_node);
880 // }
881 
882 // CTreeConstIterator::EAction
883 // CTreeConstIterator::ForEachUpward(ForEachFunc ucb, void* user_data)
884 // {
885 // if(GoChild()) {
886 // do {
887 // if(ForEachUpward(ucb, user_data)==eStop)
888 // return eStop;
889 // } while(GoSibling());
890 // GoParent();
891 // }
892 // return (*ucb)(m_node, user_data);
893 // }
894 
895 // CTreeConstIterator::EAction
896 // CTreeConstIterator::ForEachUpwardLimited(C4Each& cb, int levels)
897 // {
898 // if(levels > 0) {
899 // if(!m_node->IsTerminal()) {
900 // switch( cb.LevelBegin(m_node) ) {
901 // case eStop: return eStop;
902 // default:
903 // case eCont:
904 // if(GoChild()) {
905 // do {
906 // if(ForEachUpwardLimited(cb, levels-1)==eStop)
907 // return eStop;
908 // } while(GoSibling());
909 // }
910 // case eSkip: // Means skip this level
911 // break;
912 // }
913 // GoParent();
914 // if( cb.LevelEnd(m_node) == eStop )
915 // return eStop;
916 // }
917 // return cb.Execute(m_node);
918 // }
919 // return eCont;
920 // }
921 
922 // CTreeConstIterator::EAction
923 // CTreeConstIterator::ForEachUpwardLimited(ForEachFunc ucb, void* user_data,
924 // int levels)
925 // {
926 // if(levels > 0) {
927 // if(GoChild()) {
928 // do {
929 // if(ForEachUpwardLimited(ucb, user_data,
930 // levels-1)==eStop)
931 // return eStop;
932 // } while(GoSibling());
933 // GoParent();
934 // }
935 // return (*ucb)(m_node, user_data);
936 // }
937 // return eCont;
938 // }
939 
940 
941 END_objects_SCOPE
CLevelSort(CTreeIterator::CSortPredicate &pred, CTreeCont *tree)
Definition: ctreecont.cpp:751
CTreeCont * m_tree
Definition: ctreecont.cpp:766
virtual CTreeIterator::EAction Execute(CTreeContNodeBase *pNode)
Definition: ctreecont.cpp:753
CTreeIterator::CSortPredicate & m_pred
Definition: ctreecont.cpp:765
bool AboveNode(const CTreeContNodeBase *node) const
Definition: ctreecont.cpp:544
bool GoAncestor(const CTreeContNodeBase *node)
Definition: ctreecont.cpp:558
const CTreeContNodeBase * m_node
Definition: ctreecont.hpp:338
bool BelongSubtree(const CTreeContNodeBase *subtree_root) const
Definition: ctreecont.cpp:531
bool IsTerminal() const
Definition: ctreecont.hpp:64
CTreeContNodeBase * m_sibling
Definition: ctreecont.hpp:92
const CTreeContNodeBase * Parent() const
Definition: ctreecont.hpp:82
CTreeContNodeBase * m_child
Definition: ctreecont.hpp:93
CTreeContNodeBase * m_parent
Definition: ctreecont.hpp:89
void Merge(CTreeContNodeBase *)
Definition: ctreecont.hpp:80
void DelNodeInternal(CTreeContNodeBase *pN)
Definition: ctreecont.cpp:177
void Merge(CTreeContNodeBase *src, CTreeContNodeBase *dst, CTreeIterator *pCur)
Definition: ctreecont.cpp:468
void DeleteSubtree(CTreeContNodeBase *stroot, CTreeIterator *pCur)
Definition: ctreecont.cpp:376
void MoveNode(CTreeContNodeBase *node2move, CTreeContNodeBase *new_parent)
Definition: ctreecont.cpp:414
CTreeConstIterator * GetConstIterator() const
Definition: ctreecont.cpp:368
void MoveChildren(CTreeContNodeBase *old_parent, CTreeContNodeBase *new_parent)
Definition: ctreecont.cpp:432
void Done(CTreeContNodeBase *node)
Definition: ctreecont.cpp:396
CTreeIterator * GetIterator()
Definition: ctreecont.cpp:362
bool AddNode(CTreeContNodeBase *pParentNode, CTreeContNodeBase *pNewNode)
Definition: ctreecont.cpp:515
friend class CTreeConstIterator
Definition: ctreecont.hpp:98
void AddChild(CTreeContNodeBase *parent)
Definition: ctreecont.cpp:450
CTreeContNodeBase * m_root
Definition: ctreecont.hpp:126
friend class CTreeIterator
Definition: ctreecont.hpp:97
virtual EAction Execute(CTreeContNodeBase *pNode)=0
virtual EAction LevelBegin(CTreeContNodeBase *)
Definition: ctreecont.hpp:198
virtual EAction LevelEnd(CTreeContNodeBase *)
Definition: ctreecont.hpp:201
virtual bool Execute(CTreeContNodeBase *p1, CTreeContNodeBase *p2)=0
Base class for all iterators over modifiable object.
Definition: iterator.hpp:480
bool GoSibling()
Definition: ctreecont.hpp:160
bool GoParent()
Definition: ctreecont.hpp:146
bool MoveNode(CTreeContNodeBase *to_node)
Definition: ctreecont.cpp:113
EAction ForEachDownward(ForEachFunc ucb, void *user_data)
Definition: ctreecont.cpp:285
CTreeContNodeBase * GetNode() const
Definition: ctreecont.hpp:254
CTreeContNodeBase * m_node
Definition: ctreecont.hpp:273
bool DeleteSubtree()
Definition: ctreecont.cpp:187
bool AboveNode(CTreeContNodeBase *node)
Definition: ctreecont.cpp:53
void SortAllChildrenInSubtree(CSortPredicate &)
Definition: ctreecont.cpp:770
class CTreeCont * m_tree
Definition: ctreecont.hpp:274
bool AddSibling(CTreeContNodeBase *new_node)
Definition: ctreecont.cpp:99
bool BelongSubtree(const CTreeContNodeBase *subtree_root)
Definition: ctreecont.cpp:42
bool GoChild()
Definition: ctreecont.hpp:153
bool Merge(CTreeContNodeBase *to_node)
Definition: ctreecont.cpp:229
EAction ForEachUpwardLimited(ForEachFunc ucb, void *user_data, int levels)
Definition: ctreecont.cpp:841
EAction ForEachDownwardLimited(ForEachFunc ucb, void *user_data, int levels)
Definition: ctreecont.cpp:336
bool GoAncestor(CTreeContNodeBase *node)
Definition: ctreecont.cpp:65
bool MoveChildren(CTreeContNodeBase *to_node)
Definition: ctreecont.cpp:148
EAction ForEachUpward(ForEachFunc ucb, void *user_data)
Definition: ctreecont.cpp:801
bool AddChild(CTreeContNodeBase *new_node)
Definition: ctreecont.cpp:84
void SortChildren(CSortPredicate &)
Definition: ctreecont.cpp:708
bool GoNode(CTreeContNodeBase *node)
Definition: ctreecont.hpp:167
bool DeleteNode()
Definition: ctreecont.cpp:219
static DLIST_TYPE *DLIST_NAME() prev(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
Definition: dlist.tmpl.h:61
static DLIST_TYPE *DLIST_NAME() next(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
Definition: dlist.tmpl.h:56
static char tmp[3200]
Definition: utf8.c:42
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
Modified on Tue May 21 10:58:11 2024 by modify_doxy.py rev. 669887