]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkWxBlackBox.cxx
*** empty log message ***
[bbtk.git] / kernel / src / bbtkWxBlackBox.cxx
index 5b8e52f0efb5602342b05dae1757008387228853..6a452f3c3350dfb3d60fb03dd035511b26581677 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkWxBlackBox.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/03/10 12:28:43 $
-  Version:   $Revision: 1.10 $
+  Date:      $Date: 2008/04/08 06:59:30 $
+  Version:   $Revision: 1.11 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -531,6 +531,58 @@ namespace bbtk
   //=========================================================================
 
 
+  //=========================================================================
+  /// Main processing method of the box.
+  IOStatus WxBlackBox::bbBackwardUpdate( Connection* caller )
+  {
+    bbtkDebugMessageInc("Process",1,
+                       "=> WxBlackBox::bbBackwardUpdate("
+                       <<(caller?caller->GetFullName():"0")<<") ["
+                       <<bbGetFullName()<<"]"<<std::endl);
+
+    if (bbGetExecuting()) 
+      {
+       bbtkWarning(bbGetFullName()<<" : Cyclic execution stopped");
+       return UPTODATE;
+      }
+    bbSetExecuting(true);
+
+    // If the caller is not the connection to the output widget
+    // and the output 'Widget' is connected then 
+    // we must execute the parent box
+    bool done = false;
+    if ( (caller==0) ||
+        ((caller!=0)&&(caller->GetBlackBoxFromOutput()!="Widget"))
+        )
+      {
+       BlackBox::OutputConnectorMapType::const_iterator i 
+         = bbGetOutputConnectorMap().find("Widget") ;
+       if ( 
+           i->second->GetConnectionVector().size() != 0 ) 
+         {
+           bbtkDebugMessage("Process",2,
+                            "-> Output 'Widget' connected : transfering execution to parent"
+                            <<std::endl);
+           
+           i->second->GetConnectionVector().front()
+             ->GetBlackBoxTo()->bbExecute(false);
+           done = true;
+         }
+      }
+    // call 'standard' BlackBox execution method
+    if (!done) 
+      { 
+       bbSetExecuting(false);
+       AtomicBlackBox::bbBackwardUpdate(caller);
+      }
+    
+    bbtkDebugMessageDec("Process",1,
+                       "<= WxBlackBox::bbBackwardUpdate() ["
+                       <<bbGetFullName()<<"]"<<std::endl);
+    
+    bbSetExecuting(false);
+  }
+
   //=========================================================================
   void WxBlackBox::bbProcess()
   {