]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkComplexBlackBoxDescriptor.cxx
#3512 clean bbs2 python version
[bbtk.git] / kernel / src / bbtkComplexBlackBoxDescriptor.cxx
index 20d2ca9a2db3572ab4cf3a9306ba77a55e31fa31..5f445e23582210373e7d849ab57069541662a56d 100644 (file)
@@ -202,29 +202,23 @@ namespace bbtk
                        <<std::endl);
   // 
     if (!GetFactory()) 
-      { 
-       bbtkError("ComplexBlackBoxDescriptor::Connect : no factory set");
-      }
+    {
+        bbtkError("ComplexBlackBoxDescriptor::Connect : no factory set");
+    }
     
-
   // Verify that a box with the same name does not exist already
     BlackBox::Pointer bbfrom = mPrototype->bbGetBlackBox( from );
     if ( !bbfrom ) 
-      {
-       bbtkError("the black box \""<<from<<"\" does not exist");
-      }
+    {
+        bbtkError("the black box \""<<from<<"\" does not exist");
+    }
     BlackBox::Pointer bbto = mPrototype->bbGetBlackBox( to );
     if ( !bbto ) 
-      {
-       bbtkError("the black box \""<<to<<"\" does not exist");
-      }
-    
-    Connection::Pointer c 
-      = GetFactory()->NewConnection( bbfrom, output, bbto, input );
-
+    {
+        bbtkError("the black box \""<<to<<"\" does not exist");
+    }
+    Connection::Pointer c = GetFactory()->NewConnection( bbfrom, output, bbto, input );
     mPrototype->bbAddConnection(c);
-
-
   }
   //=======================================================================
 
@@ -416,7 +410,7 @@ namespace bbtk
              Package::Pointer p = d->GetPackage();
            
              std::string name = b->second->bbGetTypeName();
-
+                               
              std::string url;
              if (relative_link) 
                 url = p->GetDocRelativeURL();
@@ -666,6 +660,60 @@ size_t  ComplexBlackBoxDescriptor::GetObjectInternalSize() const
     return s;
   }
   //==========================================================================
-
+void ComplexBlackBoxDescriptor::GetBoxesInside (NodeTreeC& tree, int cont) 
+       {
+               std::cout<<"getBoxesInside recursivo "<<std::endl;
+               cont++;
+               std::string name = GetTypeName();
+               std::cout<<"despues de getTypeName : "<<name<<std::endl;
+    std::string descr = GetDescription();
+    std::string author = GetAuthor();
        
+       //list.push_back(name);
+               tree.setData(name);
+       //list.push_back(descr);
+       //list.push_back(author);
+               int k = 0;
+               
+    const ComplexBlackBox::BlackBoxMapType& B = mPrototype->bbGetBlackBoxMap();
+
+               std::cout<<"----B size "<< B.size() << std::endl;
+               std::cout<<"----antes if "<<std::endl;
+    if (B.size()) 
+    {
+          std::set<BlackBoxDescriptor::Pointer> pdeps;
+          ComplexBlackBox::BlackBoxMapType::const_iterator b;
+                       std::cout<<"----antes for "<<std::endl;
+          for ( b = B.begin(); b != B.end(); ++b ) 
+          {
+                               BlackBoxDescriptor::Pointer d = b->second->bbGetDescriptor();
+                               //std::cout<<"nombre objeto d "<< d->GetObjectName() <<std::endl;
+                               
+             //if (pdeps.find(d) != pdeps.end()) 
+        //    continue;
+             //pdeps.insert(d);
+                               std::cout<<"----1~ "<<std::endl;
+             Package::Pointer p = d->GetPackage();
+             std::string nameBox = b->second->bbGetTypeName();
+                               std::string packageBox = p->GetName();
+                               tree.insertChild(nameBox);
+                               std::cout<<"----2~ "<<std::endl;
+                               //list.push_back(nameBox);
+                               //list.push_back(packageBox);
+                               std::cout<<"-----cont "<<cont<<std::endl;
+                               //tree.treeTour(cont);
+                               d->GetBoxesInside (tree.childs[k], cont);
+                               std::cout<<"----3~ "<<std::endl;
+                               //std::cout<<"--despues de la recursion "<<k<<std::endl;
+                               k++;
+           }   // for
+                       std::cout<<"----despues for "<<std::endl;
+     } // If B.size
+                       std::cout<<"----despues if "<<std::endl;
+                       std::cout<<"end getBoxesInside recursivo"<<std::endl;
+       }
+
+//===================================================
+
+        //==========================================================================
 }