]> Creatis software - bbtk.git/commitdiff
2397 BBTK Feature New Normal Feature GetBoxesInside for showing the tree of a blackbo...
authorctorres <carlos.torres@creatis.insa-lyon.fr>
Wed, 18 Jun 2014 13:32:01 +0000 (15:32 +0200)
committerctorres <carlos.torres@creatis.insa-lyon.fr>
Wed, 18 Jun 2014 13:32:01 +0000 (15:32 +0200)
kernel/src/bbtkAtomicBlackBoxDescriptor.cxx
kernel/src/bbtkBlackBoxDescriptor.cxx
kernel/src/bbtkBlackBoxDescriptor.h
kernel/src/bbtkComplexBlackBoxDescriptor.cxx
kernel/src/bbtkComplexBlackBoxDescriptor.h
kernel/src/bbtkPackage.cxx
kernel/src/bbtkPackage.h
kernel/src/bbtkUtilities.cxx
kernel/src/bbtkUtilities.h

index b60f6bb9dda4fc82afb4635d8d4540e3ae47c037..aafb10de89ee218cb0d80db3a641ec309c4127d0 100644 (file)
@@ -86,4 +86,6 @@ namespace bbtk
   {  
     bbtkDDebugMessage("object",3,"==> ~AtomicBlackBoxDescriptor()"<<std::endl);
   }
+
+       
 }// namespace bbtk
index 9f40f1f1864fee03816b6de076a8fab0c21caa7d..24e7024ff3820166bcc1494dcadbdf263cf75515 100644 (file)
@@ -315,7 +315,7 @@ namespace bbtk
     return "::" + mTypeName;
   }
   //=========================================================================
-        void BlackBoxDescriptor::GetBoxesInside (NodeTreeC& tree, std::vector<std::string>& temp, int cont){
+        void BlackBoxDescriptor::GetBoxesInside (NodeTreeC& tree, int cont){
                
        }
   //=========================================================================
index 25f454436c8f887cb0b4c30855337fa484bf86b7..8124b35a10689f9c97d0cb3ccf3aad4108d38996 100644 (file)
@@ -170,7 +170,7 @@ namespace bbtk
     ///
     virtual void Check(bool recursive=true) const;
 
-         virtual void GetBoxesInside (NodeTreeC& tree, std::vector<std::string>& temp, int cont);
+         virtual void GetBoxesInside (NodeTreeC& tree, int cont);
          
          /// Sets the name of the script file from which it is defined
          void SetScriptFileName(const std::string& n) { mScriptFileName = n; }
index c25819f5003eb9bb497c8f4aa6e7530defb99cbb..b79fed3e10f1a81d3f5456a91313da7bd09651d2 100644 (file)
@@ -666,47 +666,57 @@ size_t  ComplexBlackBoxDescriptor::GetObjectInternalSize() const
     return s;
   }
   //==========================================================================
-void ComplexBlackBoxDescriptor::GetBoxesInside (NodeTreeC& tree, std::vector<std::string>& list, int cont) 
+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);
+       
+       //list.push_back(name);
                tree.setData(name);
-   //  list.push_back(descr);
-   //  list.push_back(author);
+       //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();
-                               
+                               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);
-
-                               list.push_back(nameBox);
-                               list.push_back(packageBox);
-
-                               d->GetBoxesInside (tree.childs[k],list, cont+1);
+                               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;
        }
 
 //===================================================
index f9e7f8d8997e61525dc933c96aa4e6b280f8df58..e39b6d766e9dd1e24a5367b3f3b3b524930192d2 100644 (file)
@@ -144,7 +144,7 @@ namespace bbtk
                          const std::string& output_dir = "",
                          bool relative_link = false );
     
-               void GetBoxesInside (NodeTreeC& tree, std::vector<std::string>& list, int cont);
+               void GetBoxesInside (NodeTreeC& tree, int cont);
    ///
     virtual void Check(bool recursive=true) const;
        
index 1b0abc03a0c9fe96193faa090698101105aa6f9c..16f4ffbf692335afcb22c3d115116272ff7b0403 100644 (file)
@@ -1404,15 +1404,14 @@ namespace bbtk
     return s;
   }
   //==========================================================================
-  void  Package::GetBoxesInside(NodeTreeC& tree, std::vector<std::string>& list, int cont) 
+  void  Package::GetBoxesInside(NodeTreeC& tree, int cont) 
   {
                DescriptorMapType::const_iterator i;
-
-               std::vector<std::string>  temp;
+               std::cout<<"*********a********"<<std::endl;
                for (i=mDescriptorMap.begin(); i!=mDescriptorMap.end(); ++i) 
                {
-                       i->second->GetBoxesInside(tree, list, cont);
-                       list.insert( list.end(), temp.begin(), temp.end() );
+                       i->second->GetBoxesInside(tree, cont);
+                       std::cout<<"*****************"<<std::endl;
                }    
   }
        //==========================================================================
index f39dfc6d7dcb049c1cce7581a94c56a5a78fd398..860cbd9bff956c041d3ade1680ff1b87acf5d8f8 100644 (file)
@@ -73,7 +73,7 @@ namespace bbtk
                                            const std::string& pkgname,
                                            const std::string& path);
 
-       void  GetBoxesInside(NodeTreeC& tree, std::vector<std::string>& list, int cont);
+       void  GetBoxesInside(NodeTreeC& tree, int cont);
     /// NOTE : All the static methods below for package destruction
     /// are not member because they can cause the package death 
     /// and thus close the dynamic library from which it has been loaded.
index 0a6fd9f0cee96db2acf7821da2be679edf2720d3..747f772fdcf67fa7fa0f94c593f39c95b752df68 100644 (file)
@@ -786,68 +786,39 @@ NodeTreeC::~NodeTreeC()
 {
 
 }
+void NodeTreeC::deleteTree()
+{
+       data = "";
+       std::cout<<"NodeTreeC::deleteTree 1"<<std::endl;
+       childs.erase(childs.begin(),childs.begin()+childs.size());
+       std::cout<<"NodeTreeC::deleteTree 2"<<std::endl;
+}
 
 void NodeTreeC::insertChild(std::string _data)
 {
        NodeTreeC temp = NodeTreeC(_data);
        childs.push_back(temp);
+       //std::cout<<"NodeTreeC::insertChild"<<std::endl;
 }
 
-void NodeTreeC::treeTour()
+void NodeTreeC::treeTour(int lvl)
 {
-       std::cout <<"data "<< data << std::endl;
-       std::cout <<"size "<< childs.size() << std::endl;
+       std::string space = "";
+       for (int j=0; j<lvl ; j++){
+                               space += "   ";
+       }
+       lvl++;
+       std::cout <<space<<"data: "<< data << "  size: "<< childs.size() << std::endl;
        for(int i = 0 ; i < childs.size(); i++)
        {
-               childs[i].treeTour();           
+               childs[i].treeTour(lvl);                
        }
 }
 
 void NodeTreeC::setData(std::string _data)
 {
        data = _data;
+       //std::cout<<"NodeTreeC::setData"<<std::endl;
 }
 
-
-//---------Tree------------
-/*
-TreeC::TreeC()
-{
-
-}
-
-TreeC::TreeC(std::string _data)
-{
-       root = NodeTreeC(_data);
-}
-
-TreeC::~TreeC()
-{
-
-}
-
-void TreeC::insertRoot(std::string _data)
-{
-       NodeTreeC temp = NodeTreeC(_data);
-       root = temp;
-}
-
-void TreeC::treeTour()
-{
-       root.treeTour();
-}
-
-void TreeC::insertData(std::string _data)
-{
-       
-}
-
-TreeC* TreeC::getSubTree()
-{
-       TreeC temp;
-       temp.root = root.childs[0];
-       return ;
-}
-*/
-
 }
index 1a1a3992f4374d3581ca18bd89558c64cc3f6835..1f8f6c3552f43b1f8ab765d9d28e61234b941878 100644 (file)
@@ -211,24 +211,10 @@ public:
        NodeTreeC(std::string _data);
        ~NodeTreeC();
        void insertChild(std::string _data);
-       void treeTour();
+       void treeTour(int lvl);
        void setData(std::string _data);
+       void deleteTree();
 };
-/*
-class TreeC
-{
-public:
-       NodeTreeC root;
-
-  TreeC();
-       TreeC(std::string _data);
-       ~TreeC();
-       void insertRoot(std::string _data);
-       void treeTour();
-       void insertData(std::string _data);
-       TreeC getSubTree();
-};
- */
   
 } // namespace bbtk