]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkBlackBox.cxx
*** empty log message ***
[bbtk.git] / kernel / src / bbtkBlackBox.cxx
index 1ff72d10bdb6f49542d099ca5faf82c2fe784240..2e5716e3f9ba87e897ae7f3a69d7b10568af3743 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkBlackBox.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/12/09 13:45:13 $
-  Version:   $Revision: 1.35 $
+  Date:      $Date: 2008/12/10 09:33:18 $
+  Version:   $Revision: 1.36 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
@@ -444,16 +444,18 @@ namespace bbtk
 
 
   //=========================================================================
-  void BlackBox::AddChangeObserver(const std::string& output_name
+  void BlackBox::bbAddOutputObserver(const std::string& output
                                   OutputChangeCallbackType f)
   {
+    bbGetOutputConnector(output).AddChangeObserver(f);
   }  
   //=========================================================================
 
   //=========================================================================
-  void BlackBox::RemoveChangeObserver(const std::string& output_name, 
+  void BlackBox::bbRemoveOutputObserver(const std::string& output_name, 
                                      OutputChangeCallbackType f)
   {
+    bbtkError("BlackBox::RemoveChangeObserver NOT IMPLEMENTED");
   }
   //=========================================================================
 
@@ -617,10 +619,15 @@ namespace bbtk
     for ( i  = bbGetOutputConnectorMap().begin(); 
          i != bbGetOutputConnectorMap().end(); ++i) 
       {
-       if (i->second->GetStatus()==UPTODATE) 
-         {
+       //      std::cout << "Stat = "
+       //<<GetIOStatusString(i->second->GetStatus())
+       //                <<std::endl;
+       // LG : CANNOT SIGNAL ONLY WHEN UPTODATE 
+       // See bbtkSampleOutputObserver
+       //      if (i->second->GetStatus()==UPTODATE) 
+       //        {
            i->second->SignalChange(GetThisPointer<BlackBox>(),i->first); 
-         }
+           //    }
       } 
 
     if (reaction) bbGlobalProcessExecutionList();
@@ -649,8 +656,8 @@ namespace bbtk
          bbtkError("BlackBox["<<bbGetFullName()<<"]::bbSignalOutputModification("<<output<<") : unknown output");
        }
 
-    if (i->second->GetStatus()==UPTODATE) 
-      {
+    //    if (i->second->GetStatus()==UPTODATE) 
+    //      {
        i->second->SignalChange(GetThisPointer<BlackBox>(),i->first); 
        // Has to notify the output "BoxChange" also
        if (output != "BoxChange") 
@@ -662,7 +669,7 @@ namespace bbtk
              }
          }
        if (reaction) bbGlobalProcessExecutionList();
-      }
+       //      }
 
     bbtkDebugMessageDec("change",5,
                        "<= BlackBox::bbSignalOutputModification("
@@ -691,23 +698,22 @@ namespace bbtk
          {
            bbtkError("BlackBox["<<bbGetFullName()<<"]::bbSignalOutputModification("<<*o<<") : unknown output");
          }
-       // Already OUTOFDATE : noting to do
-       if (i->second->GetStatus()==UPTODATE)
-         {
+
+       //      if (i->second->GetStatus()==UPTODATE)
+       //        {
            i->second->SignalChange(GetThisPointer<BlackBox>(),i->first); 
            changed = true;
-         }
+           //  }
       }
     // Has to notify the output "BoxChange" also
     i = bbGetOutputConnectorMap().find("BoxChange");
     if ( changed && (i != bbGetOutputConnectorMap().end())) 
       {
-       // Already OUTOFDATE : noting to do
-       if (i->second->GetStatus()==UPTODATE) 
-         {
+       // if (i->second->GetStatus()==UPTODATE) 
+       //        {
            i->second->SignalChange(GetThisPointer<BlackBox>(),i->first); 
            if (reaction) bbGlobalProcessExecutionList();
-         }
+           //  }
       }
 
     bbtkDebugMessageDec("change",5,