]> Creatis software - bbtk.git/commitdiff
Bug fix in status propagation
authorguigues <guigues>
Tue, 9 Dec 2008 11:48:31 +0000 (11:48 +0000)
committerguigues <guigues>
Tue, 9 Dec 2008 11:48:31 +0000 (11:48 +0000)
kernel/src/bbtkBlackBox.cxx
kernel/src/bbtkBlackBoxInputConnector.cxx
kernel/src/bbtkConnection.cxx

index b7a7ec78f4ee6d3d71be5de580d38085f24954c3..d0e93b5c14ba13b8f28590dc20ab03c6a3da50b6 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkBlackBox.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/12/08 12:53:45 $
-  Version:   $Revision: 1.32 $
+  Date:      $Date: 2008/12/09 11:48:31 $
+  Version:   $Revision: 1.33 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
@@ -572,6 +572,11 @@ namespace bbtk
   void BlackBox::bbSetStatusAndPropagate(BlackBoxInputConnector* c,
                                         IOStatus s)
   {
+    bbtkDebugMessageInc("change",5,
+                       "=> BlackBox::bbSetStatusAndPropagate(input,"
+                       <<GetIOStatusString(s)<<") ["
+                       <<bbGetFullName()<<"]"<<std::endl);
+
     if (s==UPTODATE) bbtkError("bbSetStatusAndPropagate with status UPTODATE!");
     c->SetStatus(s);
     OutputConnectorMapType::const_iterator o;  
@@ -590,10 +595,13 @@ namespace bbtk
           (c==bbGetInputConnectorMap().find("BoxExecute")->second))
         && (bbCanReact() ) )
       {
-       bbtkDebugMessage("modified",2,
+       bbtkDebugMessage("change",2,
                         "-> Execution triggered by Reactive mode or BoxExecute input change"<<std::endl);
         bbGlobalAddToExecutionList( GetThisPointer<BlackBox>() );
       }    
+    bbtkDebugMessageInc("change",5,
+                       "<= BlackBox::bbSetStatusAndPropagate(input) ["
+                       <<bbGetFullName()<<"]"<<std::endl);
   }
   //=========================================================================
 
@@ -676,7 +684,7 @@ namespace bbtk
   //=========================================================================  
   void BlackBox::bbSignalOutputModification(bool reaction)
   {
-    bbtkDebugMessageInc("process",5,
+    bbtkDebugMessageInc("change",5,
                        "=> BlackBox::bbSignalOutputModification("
                        <<reaction<<") ["
                        <<bbGetFullName()<<"]"<<std::endl);
@@ -694,7 +702,7 @@ namespace bbtk
 
     if (reaction) bbGlobalProcessExecutionList();
 
-    bbtkDebugMessageDec("process",5,
+    bbtkDebugMessageDec("change",5,
                        "<= BlackBox::bbSignalOutputModification() ["
                        <<bbGetFullName()<<"]"<<std::endl);
     
@@ -704,7 +712,7 @@ namespace bbtk
   void BlackBox::bbSignalOutputModification(const std::string& output,
                                            bool reaction)
   {
-    bbtkDebugMessageInc("process",5,
+    bbtkDebugMessageInc("change",5,
                        "=> BlackBox::bbSignalOutputModification("
                        <<output<<","<<reaction<<") ["
                        <<bbGetFullName()<<"]"<<std::endl);
@@ -735,7 +743,7 @@ namespace bbtk
        if (reaction) bbGlobalProcessExecutionList();
       }
 
-    bbtkDebugMessageDec("process",5,
+    bbtkDebugMessageDec("change",5,
                        "<= BlackBox::bbSignalOutputModification("
                        <<output<<") ["
                        <<bbGetFullName()<<"]"<<std::endl);
@@ -746,7 +754,7 @@ namespace bbtk
   void BlackBox::bbSignalOutputModification(const std::vector<std::string>& output,
        bool reaction)
   {
-    bbtkDebugMessageInc("process",5,
+    bbtkDebugMessageInc("change",5,
                        "=> BlackBox::bbSignalOutputModification(vector of outputs) ["
                        <<bbGetFullName()<<"]"<<std::endl);
     OutputConnectorMapType::iterator i;
@@ -783,7 +791,7 @@ namespace bbtk
          }
       }
 
-    bbtkDebugMessageDec("process",5,
+    bbtkDebugMessageDec("change",5,
                        "<= BlackBox::bbSignalOutputModification(vector of outputs) ["
                        <<bbGetFullName()<<"]"<<std::endl);
 
@@ -812,9 +820,21 @@ namespace bbtk
        //if (  bbGetDescriptor()->GetInputDescriptor(i->first)->GetTypeInfo() 
        //      == typeid(Void) ) 
        //  continue;
+       bbtkDebugMessageDec("change",2,
+                           bbGetName()<<"."<<i->first
+                           <<" ["<<i->second<<"] "
+                           <<" status before update = '"
+                           <<GetIOStatusString(i->second->GetStatus())
+                           <<"'"<<std::endl);
        i->second->BackwardUpdate();
        IOStatus t = i->second->GetStatus();
        if (t > s) s = t;
+       bbtkDebugMessageDec("change",2,
+                           bbGetName()<<"."<<i->first
+                           <<" ["<<i->second<<"] "
+                           <<" status before process = '"
+                           <<GetIOStatusString(i->second->GetStatus())
+                           <<"'"<<std::endl);
       }
     
     bbtkDebugMessageDec("process",4,
@@ -831,6 +851,11 @@ namespace bbtk
   /// Computes the final IOStatus of inputs and outputs after processing
   void BlackBox::bbComputePostProcessStatus()
   {
+    bbtkDebugMessageInc("process",4,
+                       "=> BlackBox::bbComputePostProcessStatus() ["
+                       <<bbGetFullName()<<"]"
+                       <<std::endl);   
+
     IOStatus new_output_status = UPTODATE;
     if (bbBoxProcessModeIsAlways()) new_output_status = OUTOFDATE;
 
@@ -843,8 +868,16 @@ namespace bbtk
        if (t == OUTOFDATE) new_output_status = OUTOFDATE;
        // A previously MODIFIED status turns to UPTODATE
        if (t==MODIFIED) i->second->SetStatus(UPTODATE);
+       bbtkDebugMessage("change",2,
+                        bbGetName()<<"."<<i->first<<" : "
+                        << GetIOStatusString(t) << " -> "
+                        << GetIOStatusString(i->second->GetStatus())
+                        << std::endl);
       }
-
+       bbtkDebugMessage("change",2,
+                        bbGetName()<<" new output status : "
+                        << GetIOStatusString(new_output_status)
+                        <<std::endl);
     // Update the output statuses
     OutputConnectorMapType::iterator o;
     for ( o = bbGetOutputConnectorMap().begin(); 
@@ -852,6 +885,12 @@ namespace bbtk
       {
        o->second->SetStatus(new_output_status);
       }
+
+    bbtkDebugMessageInc("process",4,
+                       "<= BlackBox::bbComputePostProcessStatus() ["
+                       <<bbGetFullName()<<"]"
+                       <<std::endl);   
+
   }
   //==================================================================
 
index f980cc3470f8324908baeece6d7d44b3ae707ae1..dcfcb332a80120f4da3b14c2c1d1b77133370da5 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkBlackBoxInputConnector.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/12/08 12:53:50 $
-  Version:   $Revision: 1.7 $
+  Date:      $Date: 2008/12/09 11:48:31 $
+  Version:   $Revision: 1.8 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
@@ -75,8 +75,6 @@ namespace bbtk
   //========================================================================
   void BlackBoxInputConnector::BackwardUpdate()
   {
-    bbtkDebugMessage("process",9,"==> BlackBoxInputConnector::BackwardUpdate()"
-                    <<std::endl);
 
     // If UPTODATE or MODIFIED : nothing to do
     //  if (mStatus != OUTOFDATE) return;
@@ -86,8 +84,20 @@ namespace bbtk
     // (either MODIFIED or OUTOFDATE)
     if ( mConnection && (mStatus == OUTOFDATE) )
       {
+       bbtkDebugMessage("process",9,
+                        "==> BlackBoxInputConnector::BackwardUpdate() : "
+                        <<"calling connection BackwardUpdate"
+                        <<std::endl);
        mConnection->BackwardUpdate();
       }
+    else
+      {
+       bbtkDebugMessage("process",9,
+                        "==> BlackBoxInputConnector::BackwardUpdate() : "
+                        <<"input Up-to-date or Modified : nothing to do"
+                        <<std::endl);
+
+      }
     // If not connected : it was set to OUTOFDATE on creation
     // Becomes MODIFIED
     // LGTODO : Initialize to MODIFIED and set to OUTOFDATE on connection ?
index 38051fbff9e41ac2b83df54e4bf2e5e53062ca38..4e39eb45668d740ace70c5f68f1f7149e7333ece 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkConnection.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/12/08 14:02:15 $
-  Version:   $Revision: 1.17 $
+  Date:      $Date: 2008/12/09 11:48:31 $
+  Version:   $Revision: 1.18 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
@@ -341,7 +341,7 @@ Connection::Connection(BlackBox::Pointer from, const std::string& output,
   /// Backward Update
   void Connection::BackwardUpdate()
   {
-    bbtkDebugMessage("process",5,
+    bbtkDebugMessage("process",3,
                     "===> Connection::BackwardUpdate() ["
                     <<GetFullName()<<"]"<<std::endl);
 
@@ -352,10 +352,20 @@ Connection::Connection(BlackBox::Pointer from, const std::string& output,
     // Transfer status
     IOStatus s = MODIFIED;
     if ( mFrom->bbGetOutputConnector(mOutput).GetStatus() == OUTOFDATE) 
-      s = OUTOFDATE,
+      {
+       s = OUTOFDATE;
+      }
     mTo->bbGetInputConnector(mInput).SetStatus(s);
-
-    bbtkDebugMessage("process",5,
+    
+    bbtkDebugMessage("process",3,
+                    " --> '"<<mTo->bbGetName()<<"."<<mInput
+                    <<" ["<<&mTo->bbGetInputConnector(mInput)<<"] "
+                    <<"' new status '"
+                    <<GetIOStatusString(s)
+                    <<"'"
+                    << std::endl);
+
+    bbtkDebugMessage("process",3,
                     "<=== Connection::BackwardUpdate() ["
                     <<GetFullName()<<"]"<<std::endl);
     return; // s;
@@ -517,7 +527,8 @@ Connection::Connection(BlackBox::Pointer from, const std::string& output,
                                  IOStatus status)
   {
     bbtkDebugMessage("change",2,
-                    "==> Connection::OnOutputChange("<<status<<") ["
+                    "==> Connection::OnOutputChange("
+                    <<GetIOStatusString(status)<<") ["
                     <<GetFullName()<<"]"<<std::endl);
     if (mAdaptor) 
       {