]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkComplexBlackBoxDescriptor.cxx
Obtaining the tree boxes related to a sigle box. The classes changed were Utilities...
[bbtk.git] / kernel / src / bbtkComplexBlackBoxDescriptor.cxx
index 3037cae072d36a075e40e19a3a9786540c36c2c4..c25819f5003eb9bb497c8f4aa6e7530defb99cbb 100644 (file)
@@ -1,32 +1,39 @@
-/*=========================================================================                                                                               
+/*
+ # ---------------------------------------------------------------------
+ #
+ # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+ #                        pour la SantÈ)
+ # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+ # Previous Authors : Laurent Guigues, Jean-Pierre Roux
+ # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+ #
+ #  This software is governed by the CeCILL-B license under French law and
+ #  abiding by the rules of distribution of free software. You can  use,
+ #  modify and/ or redistribute the software under the terms of the CeCILL-B
+ #  license as circulated by CEA, CNRS and INRIA at the following URL
+ #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+ #  or in the file LICENSE.txt.
+ #
+ #  As a counterpart to the access to the source code and  rights to copy,
+ #  modify and redistribute granted by the license, users are provided only
+ #  with a limited warranty  and the software's author,  the holder of the
+ #  economic rights,  and the successive licensors  have only  limited
+ #  liability.
+ #
+ #  The fact that you are presently reading this means that you have had
+ #  knowledge of the CeCILL-B license and that you accept its terms.
+ # ------------------------------------------------------------------------ */
+
+
+/*=========================================================================
   Program:   bbtk
   Module:    $RCSfile: bbtkComplexBlackBoxDescriptor.cxx,v $
   Language:  C++
-  Date:      $Date: 2009/12/08 14:10:36 $
-  Version:   $Revision: 1.21 $
+  Date:      $Date: 2012/11/16 08:49:01 $
+  Version:   $Revision: 1.23 $
 =========================================================================*/
 
-/* ---------------------------------------------------------------------
-
-* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
-* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
-*
-*  This software is governed by the CeCILL-B license under French law and 
-*  abiding by the rules of distribution of free software. You can  use, 
-*  modify and/ or redistribute the software under the terms of the CeCILL-B 
-*  license as circulated by CEA, CNRS and INRIA at the following URL 
-*  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
-*  or in the file LICENSE.txt.
-*
-*  As a counterpart to the access to the source code and  rights to copy,
-*  modify and redistribute granted by the license, users are provided only
-*  with a limited warranty  and the software's author,  the holder of the
-*  economic rights,  and the successive licensors  have only  limited
-*  liability. 
-*
-*  The fact that you are presently reading this means that you have had
-*  knowledge of the CeCILL-B license and that you accept its terms.
-* ------------------------------------------------------------------------ */                                                                         
+                                                                    
   
 
 /**
@@ -64,6 +71,7 @@ namespace bbtk
   ComplexBlackBoxDescriptor::ComplexBlackBoxDescriptor(const std::string& name)
   {
     bbtkDDebugMessage("object",2,"==> ComplexBlackBoxDescriptor(\""<<name<<"\")"<<std::endl);
+       SetTypeOfScript(TS_SCRIPT_COMPLEXBOX);
     SetTypeName(name);
     AddToCategory("complex box");
     mPrototype = ComplexBlackBox::New(name+std::string("Prototype"),
@@ -408,7 +416,7 @@ namespace bbtk
              Package::Pointer p = d->GetPackage();
            
              std::string name = b->second->bbGetTypeName();
-
+                               
              std::string url;
              if (relative_link) 
                 url = p->GetDocRelativeURL();
@@ -658,5 +666,50 @@ size_t  ComplexBlackBoxDescriptor::GetObjectInternalSize() const
     return s;
   }
   //==========================================================================
+void ComplexBlackBoxDescriptor::GetBoxesInside (NodeTreeC& tree, std::vector<std::string>& list, int cont) 
+       {
+
+               std::string name = GetTypeName();
+    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();
+       
+    if (B.size()) 
+    {
+          std::set<BlackBoxDescriptor::Pointer> pdeps;
+          ComplexBlackBox::BlackBoxMapType::const_iterator b;
+          for ( b = B.begin(); b != B.end(); ++b ) 
+          {
+               BlackBoxDescriptor::Pointer d = b->second->bbGetDescriptor();
+                               
+                               
+             //if (pdeps.find(d) != pdeps.end()) 
+        //    continue;
+             //pdeps.insert(d);
+
+             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);
+                               k++;
+           }   // for
+
+     } // If B.size
+
+       }
+
+//===================================================
 
+        //==========================================================================
 }