00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 #include <mln/core/image/image2d.hh>
00027 #include <mln/util/tree.hh>
00028 #include <mln/util/branch_iter.hh>
00029 
00030 int main()
00031 {
00032   using namespace mln;
00033 
00034   util::tree_node<int> n(11);
00035   util::tree<int> t(&n);
00036   util::tree_node<int>* f = n.add_child(21);
00037   util::tree_node<int>* g = f->add_child(31);
00038 
00039   f->add_child(32);
00040   g->add_child(41)->add_child(51)->add_child(61)->add_child(71)
00041     ->add_child(81)->add_child(91);
00042   g->add_child(42);
00043   f->add_child(33);
00044   f->add_child(34);
00045   n.add_child(22);
00046 
00047   util::branch<int> b(t, n);
00048 
00049   std::vector< util::tree_node<int>* >::iterator it;
00050   util::branch_iter<int> p(b);
00051 
00052   int prev;
00053   int current;
00054   for(p.start(), prev = util::tree_node<int>(p).elt(), p.next();
00055       p.is_valid();
00056       prev = util::tree_node<int>(p).elt(), p.next())
00057     {
00058       current = util::tree_node<int>(p).elt ();
00059 
00060       
00061       if (prev + 10 == current)
00062         continue;
00063 
00064       
00065       if (prev + 1 == current)
00066         continue;
00067 
00068       
00069       if (prev > current)
00070         continue;
00071 
00072       mln_assertion (false);
00073     }
00074 
00075 }