Main Page   Class Hierarchy   Data Structures   File List   Data Fields   Globals  

merge_low.C

Go to the documentation of this file.
00001 
00005 
00006 //   version 1:  September 1999         Steve McMillan
00007 
00008 #include "dyn.h"
00009 
00010 #ifndef TOOLBOX
00011 
00012 void merge_low_level_nodes(dyn * b)     // root node
00013 {
00014     for_all_daughters(dyn, b, bb)
00015         if (bb->is_parent()) {
00016             dyn * od = bb->get_oldest_daughter();
00017             dyn * yd = od->get_younger_sister();
00018 
00019             // Assume that CM node is consistent, so all we need to
00020             // do is delete the daughters.
00021 
00022             rmtree(od);
00023             rmtree(yd);
00024 
00025             bb->set_oldest_daughter(NULL);
00026         }
00027 }
00028 
00029 #else
00030 
00031 //-----------------------------------------------------------------------------
00032 //  main  --  driver to use  flatten_node() as a tool.
00033 //-----------------------------------------------------------------------------
00034 
00035 main(int argc, char ** argv)
00036 {
00037     bool  c_flag = FALSE;
00038     char  *comment;
00039 
00040     check_help();
00041 
00042     extern char *poptarg;
00043     int c;
00044     char* param_string = "c:";
00045 
00046     while ((c = pgetopt(argc, argv, param_string)) != -1)
00047         switch(c) {
00048 
00049             case 'c': c_flag = TRUE;
00050                       comment = poptarg;
00051                       break;
00052             case '?': params_to_usage(cerr, argv[0], param_string);
00053                       get_help();
00054                       exit(1);
00055         }            
00056 
00057     dyn *b;
00058 
00059     while (b = get_dyn(cin)) {
00060 
00061         if (c_flag == TRUE)
00062             b->log_comment(comment);
00063         b->log_history(argc, argv);
00064 
00065         merge_low_level_nodes(b);
00066         put_dyn(cout, *b);      
00067         delete b;
00068     }
00069 }
00070 
00071 #endif

Generated at Sun Feb 24 09:57:09 2002 for STARLAB by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001