]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkBlackBox.cxx
*** MAJOR CHANGE *** NOT WORKING YET !!!
[bbtk.git] / kernel / src / bbtkBlackBox.cxx
index 4aa8d0160fcb3d3b2b867d73b273d3bff7cb9f65..76fce5343da8a4c96dcb2e838c6454fa1470e6e9 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkBlackBox.cxx,v $
   Language:  C++
-  Date:      $Date: 2009/04/30 14:31:31 $
-  Version:   $Revision: 1.43 $
+  Date:      $Date: 2009/05/14 14:43:33 $
+  Version:   $Revision: 1.44 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
@@ -107,7 +107,7 @@ namespace bbtk
   BlackBox::BlackBox(const std::string &name) 
     : 
     //    bbmStatus(MODIFIED), 
-    bbmConstructed(false),
+    bbmInitialized(false),
     bbmExecuting(false),
     bbmName(name),
     bbmBoxProcessMode("Pipeline"),
@@ -129,7 +129,7 @@ namespace bbtk
   BlackBox::BlackBox(BlackBox& from, const std::string &name) 
     :
     //    bbmStatus(from.bbmStatus), 
-    bbmConstructed(false),
+    bbmInitialized(false),
     bbmExecuting(false),
     bbmName(name), 
     bbmBoxProcessMode(from.bbmBoxProcessMode),
@@ -753,7 +753,31 @@ namespace bbtk
   }
   //=========================================================================
 
+  //=========================================================================
+  void BlackBox::bbInitializeProcessing()
+  {
+    if (!bbmInitialized) 
+      {
+       std::cout << "INIT "<<bbGetFullName()<<std::endl;
+       this->bbRecursiveInitializeProcessing();
+       bbmInitialized = true;
+      }
+  }
+  //=========================================================================
 
+  //=========================================================================
+  void BlackBox::bbFinalizeProcessing()
+  {
+    if (bbmInitialized) 
+      {
+       std::cout << "FINI "<<bbGetFullName()<<std::endl;
+       this->bbRecursiveFinalizeProcessing();
+       bbmInitialized = false;
+      }
+  }
+  //=========================================================================
+
+  
   //=========================================================================
   /// Main recursive processing method of the box.
   void BlackBox::bbRecursiveExecute( Connection::Pointer caller )
@@ -771,13 +795,8 @@ namespace bbtk
        return; 
       }
     
-    // If not constructed do it 
-    if (!bbmConstructed) 
-      {
-       this->bbConstructor();
-       bbmConstructed = true;
-      }
-
+    // If not initialized do it
+    bbInitializeProcessing();
 
     bbSetExecuting(true);
     bool wasExecuting = bbGlobalGetSomeBoxExecuting();