]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkBlackBoxInputConnector.cxx
* Major changes on IOStatus update / propagation
[bbtk.git] / kernel / src / bbtkBlackBoxInputConnector.cxx
index c9371af4007048b7c7787290dff95fab3cb62fd1..f980cc3470f8324908baeece6d7d44b3ae707ae1 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkBlackBoxInputConnector.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/10/17 08:18:12 $
-  Version:   $Revision: 1.6 $
+  Date:      $Date: 2008/12/08 12:53:50 $
+  Version:   $Revision: 1.7 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
 
 namespace bbtk
 {
+  //========================================================================
   BlackBoxInputConnector::BlackBoxInputConnector(BlackBox::Pointer b)  
     : mBox(b), mConnection(0), mStatus(MODIFIED)
   {
     bbtkDebugMessage("Kernel",9,"BlackBoxInputConnector::BlackBoxInputConnector()"<<std::endl);
   }
+  //========================================================================
 
-
+  //========================================================================
   BlackBoxInputConnector::~BlackBoxInputConnector() 
   {
     bbtkDebugMessageInc("Kernel",9,"BlackBoxInputConnector::~BlackBoxInputConnector()"<<std::endl);
     bbtkDebugDecTab("Kernel",9);
   }
-  
+  //========================================================================
+
+  //========================================================================
   void BlackBoxInputConnector::SetConnection(Connection* c) 
   { 
     bbtkDebugMessage("Kernel",9,"BlackBoxInputConnector::SetConnection("<<c<<")"<<std::endl);
     mConnection = c; 
   }
-  
+  //========================================================================
+
+  //========================================================================
   void BlackBoxInputConnector::UnsetConnection(Connection* c) 
   { 
     bbtkDebugMessage("Kernel",9,"BlackBoxInputConnector::UnsetConnection("
                     <<c<<")"<<std::endl);
-    mConnection = 0; //.reset();
+    mConnection = 0; 
   }
+  //========================================================================
   
-  IOStatus BlackBoxInputConnector::BackwardUpdate()
+  //========================================================================
+  void BlackBoxInputConnector::BackwardUpdate()
   {
     bbtkDebugMessage("process",9,"==> BlackBoxInputConnector::BackwardUpdate()"
                     <<std::endl);
 
-    if (mConnection) //.lock()) 
-      {
-       IOStatus s = mConnection->BackwardUpdate();
-       mStatus = s;
-      }
-    else 
+    // If UPTODATE or MODIFIED : nothing to do
+    //  if (mStatus != OUTOFDATE) return;
+
+    // If connected and OUTOFDATE : recursive update
+    // Post-update status is updated by the connection 
+    // (either MODIFIED or OUTOFDATE)
+    if ( mConnection && (mStatus == OUTOFDATE) )
       {
-       mStatus = UPTODATE;
+       mConnection->BackwardUpdate();
       }
-
-    return mStatus;
-
+    // If not connected : it was set to OUTOFDATE on creation
+    // Becomes MODIFIED
+    // LGTODO : Initialize to MODIFIED and set to OUTOFDATE on connection ?
+    //   else 
+    //      {
+    // mStatus = MODIFIED;
+    //    }
   }
+  //========================================================================
 
-
-  //    void Modified();
-  
 }
 // namespace bbtk