]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkComplexBlackBox.cxx
*** empty log message ***
[bbtk.git] / kernel / src / bbtkComplexBlackBox.cxx
index c494d6555c6a4cd0bfdf1df7e47fda954ab3603c..840c596091e0c1e404355089e7a05c7c6088fe13 100644 (file)
@@ -3,8 +3,8 @@
 Program:   bbtk
 Module:    $RCSfile: bbtkComplexBlackBox.cxx,v $
 Language:  C++
-Date:      $Date: 2008/04/18 12:59:15 $
-Version:   $Revision: 1.10 $
+Date:      $Date: 2008/04/22 06:59:31 $
+Version:   $Revision: 1.13 $
                                                                                 
 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
 l'Image). All rights reserved. See Doc/License.txt or
@@ -317,19 +317,20 @@ namespace bbtk
                        "ComplexBlackBox::bbBackwardUpdate("
                        <<(caller?caller->GetFullName():"0")<<") ["
                        <<bbGetFullName()<<"]"<<std::endl);
-    bbtkInternalError("ComplexBlackBox::bbBackwardUpdate should never be called !");
-    /*
+    //    bbtkInternalError("ComplexBlackBox::bbBackwardUpdate should never be called !");
+    
     if (caller==0)
       {
        bbtkInternalError("ComplexBlackBox::bbBackwardUpdate called with caller=0");
       }
 
-    if (bbGetExecuting()) 
-      {
-       bbtkWarning(bbGetFullName()<<" : Cyclic execution stopped");
-       return UPTODATE;
-      }
-    bbSetExecuting(true);
+    std::cout << "CBB BUP : "<<caller->GetBlackBoxFrom()->bbGetFullName()
+             <<"."<<caller->GetBlackBoxFromOutput()<<"----"
+             <<caller->GetOriginalBlackBoxFrom()->bbGetFullName()
+             <<"."<<caller->GetOriginalBlackBoxFromOutput()<<std::endl;
+      
+      
+
 
     IOStatus s = UPTODATE;
     const BlackBoxDescriptor::OutputDescriptorMapType& omap 
@@ -342,7 +343,7 @@ namespace bbtk
        ComplexBlackBoxOutputDescriptor* d = 
          (ComplexBlackBoxOutputDescriptor*)i->second;
        // Get the internal box 
-       BlackBox* b = bbUnsafeGetBlackBox ( d->GetTarget() );
+       BlackBox::Pointer b = bbUnsafeGetBlackBox ( d->GetTarget() );
        // Calls BackwardUpdate on it
        bbtkDebugMessageInc("Process",2,"Internal box connected to output : "<<d->GetTarget()<<std::endl);
        // Because internal box can also be a complex box we have to 
@@ -373,11 +374,8 @@ namespace bbtk
       }
     bbtkDebugDecTab("Process",1);
 
-    bbSetExecuting(false);
-
     return s;
-    */
-    return UPTODATE;
+    
   }
   //==================================================================
 
@@ -483,24 +481,31 @@ namespace bbtk
   /// Connects the input <name> to the connection c
   void ComplexBlackBox::bbConnectInput( const std::string& name, Connection::Pointer c)
   {
-    bbtkDebugMessageInc("Kernel",7,
-                       "ComplexBlackBox::bbConnectInput(\""
-                       <<name<<"\","<<c<<") ["
-                       <<bbGetFullName()<<"]"
-                       <<std::endl);       
-
+    bbtkDebugMessage("connection",2,
+                    "==> ComplexBlackBox::bbConnectInput(\""
+                    <<name<<"\","<<c->GetFullName()<<") ["
+                    <<bbGetFullName()<<"]"
+                    <<std::endl);       
+    
    ComplexBlackBoxInputDescriptor* d = (ComplexBlackBoxInputDescriptor*)
       bbGetDescriptor()->GetInputDescriptor(name);
 
+
    BlackBox::Pointer t = bbGetBlackBox(d->GetTarget());
+
+   bbtkDebugMessage("connection",2," - Target = "<<d->GetTarget()<<" = "<<t->bbGetFullName()<<std::endl);
+
    c->SetBlackBoxTo(t);
    c->SetBlackBoxToInput(d->GetInput());
-   t->bbConnectInput(d->GetInput(),c);
 
-   bbtkMessage("Debug",1,"ComplexBlackBox["<<bbGetFullName()<<"]::bbConnectInput : "
-              <<c->GetFullName()<<std::endl);
+   bbtkDebugMessage("connection",2," - New conn = "<<c->GetFullName()<<std::endl);
+   t->bbConnectInput(d->GetInput(),c);
 
-    bbtkDebugDecTab("Kernel",7);
+   bbtkDebugMessage("connection",2,
+                    "<== ComplexBlackBox::bbConnectInput(\""
+                    <<name<<"\","<<c->GetFullName()<<") ["
+                    <<bbGetFullName()<<"]"
+                    <<std::endl);       
   }
   //=========================================================================
 
@@ -509,24 +514,29 @@ namespace bbtk
   /// Connects the output <name> to the connection c
   void ComplexBlackBox::bbConnectOutput( const std::string& name, Connection::Pointer c)
   {
-    bbtkDebugMessageInc("Kernel",7,
-                       "ComplexBlackBox::bbConnectOutput(\""
-                       <<name<<"\","<<c<<") ["
-                       <<bbGetFullName()<<"]"<<std::endl);       
+    bbtkDebugMessage("connection",2,
+                    "==> ComplexBlackBox::bbConnectOutput(\""
+                    <<name<<"\","<<c->GetFullName()<<") ["
+                    <<bbGetFullName()<<"]"<<std::endl);       
 
    ComplexBlackBoxOutputDescriptor* d = (ComplexBlackBoxOutputDescriptor*)
       bbGetDescriptor()->GetOutputDescriptor(name);
 
    BlackBox::Pointer t = bbGetBlackBox(d->GetTarget());
+  bbtkDebugMessage("connection",2," - Target = "<<d->GetTarget()<<" = "<<t->bbGetFullName()<<std::endl);
 
    c->SetBlackBoxFrom(t);
    c->SetBlackBoxFromOutput(d->GetOutput());
+
+   bbtkDebugMessage("connection",2," - New conn = "<<c->GetFullName()<<std::endl);
+
    t->bbConnectOutput(d->GetOutput(),c);
   
-   bbtkMessage("Debug",5,"ComplexBlackBox["<<bbGetFullName()<<"]::bbConnectOutput : "
-              <<c->GetFullName()<<std::endl);
-
-    bbtkDebugDecTab("Kernel",7);
+    bbtkDebugMessage("connection",2,
+                    "<== ComplexBlackBox::bbConnectOutput(\""
+                    <<name<<"\","<<c->GetFullName()<<") ["
+                    <<bbGetFullName()<<"]"<<std::endl);       
   }
   //=========================================================================
 
@@ -590,7 +600,7 @@ namespace bbtk
        for ( j = mConnectionList.begin(); 
              j != mConnectionList.end(); ++j ) 
          {
-           //(*j)->Check();
+           (*j)->Check();
          }
       }
     if (p.use_count()!=1)