]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkComplexBlackBox.cxx
*** empty log message ***
[bbtk.git] / kernel / src / bbtkComplexBlackBox.cxx
index d15a45cc726c94b137be1158e8c17c4a2b3d2dee..f47e401248fdf3c0c5bd7fec30479eec353721a1 100644 (file)
@@ -3,8 +3,8 @@
 Program:   bbtk
 Module:    $RCSfile: bbtkComplexBlackBox.cxx,v $
 Language:  C++
-Date:      $Date: 2008/04/22 14:30:25 $
-Version:   $Revision: 1.15 $
+Date:      $Date: 2008/07/24 14:37:05 $
+Version:   $Revision: 1.20 $
                                                                                 
 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
 l'Image). All rights reserved. See Doc/License.txt or
@@ -22,6 +22,7 @@ PURPOSE.  See the above copyright notices for more information.
  *  \brief class bbtk::ComplexBlackBox : user defined complex black boxes
  */
 #include "bbtkComplexBlackBox.h"
+#include "bbtkWx.h"
 #include "bbtkBlackBoxDescriptor.h"
 #include "bbtkFactory.h"
 #include "bbtkConfigurationFile.h"
@@ -79,13 +80,17 @@ namespace bbtk
                        <<from.bbGetName()<<"\",\""
                        <<name<<"\")"<<std::endl);
     bbtkDebugMessage("object",4,"  * Cloning Black Boxes"<<std::endl);
+
+    // We have to make the shared_ptr on this because it is used 
+    // in bbUnsafeAddBlackBox !
+    MakeBlackBoxPointer(this,true);
+
     BlackBoxMapType::const_iterator i;
     for ( i = from.mBlackBoxMap.begin(); i != from.mBlackBoxMap.end(); ++i ) 
       {
        bbtkDebugMessageInc("object",5,"    * Cloning \""<<i->first<<"\""<<std::endl);
        BlackBox::Pointer B = i->second->bbClone(i->second->bbGetName());
        bbUnsafeAddBlackBox(B);
-       
       }
    
     bbtkDebugMessage("object",4,"  * Cloning Connections"<<std::endl);
@@ -231,12 +236,12 @@ namespace bbtk
   /// Executes the box so that its outputs are up-to-date on exit
   void ComplexBlackBox::bbExecute(bool force)
   {
-    bbtkDebugMessageInc("Process",1,
-                       "ComplexBlackBox::bbExecute() ["
+    bbtkDebugMessageInc("process",2,
+                       "=> ComplexBlackBox::bbExecute() ["
                        <<bbGetFullName()<<"]"<<std::endl);
 
 
-    Wx::BeginBusyCursor();
+    Wx::BusyCursor wait;
     
     if (mExecutionList.size() != 0) 
       {
@@ -246,7 +251,7 @@ namespace bbtk
             i!=mExecutionList.end();
             ++i) 
          {
-           bbtkDebugMessage("Process",2," -> Executing '"<<*i<<"'"<<std::endl);
+           bbtkDebugMessage("process",3," -> Executing '"<<*i<<"'"<<std::endl);
            mBlackBoxMap[*i]->bbExecute(force);
          }
       }
@@ -259,26 +264,23 @@ namespace bbtk
          }
       } 
 
-    Wx::EndBusyCursor();
-    
-
-    bbtkDebugDecTab("Process",1);
-    
   }
   //==================================================================
 
   //==================================================================
   void ComplexBlackBox::bbSetModifiedStatus(BlackBoxInputConnector* c)
   {
-    bbtkDebugMessage("Process",3,
-                       "ComplexBlackBox::bbSetModifiedStatus("
+    bbtkDebugMessage("modified",1,
+                       "==> ComplexBlackBox::bbSetModifiedStatus("
                     <<c<<") ["<<bbGetFullName()<<"]"<<std::endl);
 
     c->GetBlackBox()->bbSetModifiedStatus(c);
 
-    bbtkDebugMessage("Process",3,
-                    "EO ComplexBlackBox::bbSetModifiedStatus("
+    /*
+    bbtkDebugMessage("modified",1,
+                    "<== ComplexBlackBox::bbSetModifiedStatus("
                     <<c<<") ["<<bbGetFullName()<<"]"<<std::endl);
+    */
   }
   //==================================================================
 
@@ -300,8 +302,8 @@ namespace bbtk
   //==================================================================
   IOStatus ComplexBlackBox::bbBackwardUpdate(Connection::Pointer caller)
   {
-    bbtkDebugMessageInc("Process",1,
-                       "ComplexBlackBox::bbBackwardUpdate("
+    bbtkDebugMessageInc("process",3,
+                       "==> ComplexBlackBox::bbBackwardUpdate("
                        <<(caller?caller->GetFullName():"0")<<") ["
                        <<bbGetFullName()<<"]"<<std::endl);
     //    bbtkInternalError("ComplexBlackBox::bbBackwardUpdate should never be called !");
@@ -333,7 +335,7 @@ namespace bbtk
        // Get the internal box 
        BlackBox::Pointer b = bbUnsafeGetBlackBox ( d->GetTarget() );
        // Calls BackwardUpdate on it
-       bbtkDebugMessageInc("Process",2,"Internal box connected to output : "<<d->GetTarget()<<std::endl);
+       bbtkDebugMessageInc("process",4,"Internal box connected to output : "<<d->GetTarget()<<std::endl);
        // Because internal box can also be a complex box we have to 
        // temporarily change the connection BlackBoxFromOutput to the 
        // mapped one
@@ -354,13 +356,11 @@ namespace bbtk
        // ??? STATUS OF CBBs ???
        // ??? Here it is only the final status of the boxes connected to the output 
        if (s1==MODIFIED) s=MODIFIED;
-       bbtkDebugDecTab("Process",2);
       }
     else 
       {
        bbtkError("Connection '"<<caller->GetFullName()<<"' does not point to a valid output of the complex box !");
       }
-    bbtkDebugDecTab("Process",1);
 
     return s;