Program: bbtk
Module: $RCSfile: bbtkComplexBlackBox.cxx,v $
Language: C++
-Date: $Date: 2008/03/07 10:21:30 $
-Version: $Revision: 1.7 $
+Date: $Date: 2008/04/08 06:59:29 $
+Version: $Revision: 1.8 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
"ComplexBlackBox::bbExecute() ["
<<bbGetFullName()<<"]"<<std::endl);
+
Wx::BeginBusyCursor();
if (mExecutionList.size() != 0)
Wx::EndBusyCursor();
+
bbtkDebugDecTab("Process",1);
}
IOStatus ComplexBlackBox::bbBackwardUpdate(Connection* caller)
{
bbtkDebugMessageInc("Process",1,
- "ComplexBlackBox::bbBackwardUpdate("<<caller->GetFullName()<<") ["
+ "ComplexBlackBox::bbBackwardUpdate("
+ <<(caller?caller->GetFullName():"0")<<") ["
<<bbGetFullName()<<"]"<<std::endl);
+ if (caller==0)
+ {
+ bbtkInternalError("ComplexBlackBox::bbBackwardUpdate called with caller=0");
+ }
+
+ if (bbGetExecuting())
+ {
+ bbtkWarning(bbGetFullName()<<" : Cyclic execution stopped");
+ return UPTODATE;
+ }
+ bbSetExecuting(true);
+
IOStatus s = UPTODATE;
const BlackBoxDescriptor::OutputDescriptorMapType& omap
= bbGetDescriptor()->GetOutputDescriptorMap();
BlackBox* b = bbUnsafeGetBlackBox ( d->GetTarget() );
// Calls BackwardUpdate on it
bbtkDebugMessageInc("Process",2,"Internal box connected to output : "<<d->GetTarget()<<std::endl);
- IOStatus s1 = b->bbBackwardUpdate(caller);
+ // Because internal box can also be a complex box we have to
+ // temporarily change the connection BlackBoxFromOutput to the
+ // mapped one
+
+ // std::string oldout = caller->GetBlackBoxFromOutput();
+ // std::cout << "oldout = "<<oldout<<std::endl;
+ // std::cout << "tmpout = "<<d->GetOutput()<<std::endl;
+ // caller->SetBlackBoxFromOutput(d->GetOutput());
+ //
+ Connection newcaller(*caller);
+ newcaller.SetBlackBoxFromOutput(d->GetOutput());
+ IOStatus s1 = b->bbBackwardUpdate(&newcaller);
+ newcaller.Clear();
+ // restore old output
+ // caller->SetBlackBoxFromOutput(oldout);
+
// ??? STATUS OF CBBs ???
// ??? Here it is only the final status of the boxes connected to the output
if (s1==MODIFIED) s=MODIFIED;
bbtkError("Connection '"<<caller->GetFullName()<<"' does not point to a valid output of the complex box !");
}
bbtkDebugDecTab("Process",1);
- return s;
- }
- //==================================================================
-
- /*
- //==================================================================
- void ComplexBlackBox::bbForwardUpdate(Connection* caller)
- {
- bbtkDebugMessageInc("Process",1,
- "ComplexBlackBox::bbForwardUpdate("<<caller->GetFullName()<<") ["
- <<bbGetFullName()<<"]"<<std::endl);
- const BlackBoxDescriptor::InputDescriptorMapType& imap
- = bbGetDescriptor()->GetInputDescriptorMap();
- BlackBoxDescriptor::InputDescriptorMapType::const_iterator i
- = imap.find(caller->GetBlackBoxToInput());
- if (i!=imap.end())
- {
- // Cast the BBOutputDescriptor into a ComplexBBOutputDescriptor
- ComplexBlackBoxInputDescriptor* d =
- (ComplexBlackBoxInputDescriptor*)i->second;
- // Get the internal box
- BlackBox* b = bbUnsafeGetBlackBox ( d->GetTarget() );
- // Calls ForwardUpdate on it
- bbtkDebugMessage("Process",2,"-> Internal box connected to input : "<<d->GetTarget()<<std::endl);
- b->bbForwardUpdate(caller);
- }
- else
- {
- bbtkError("Connection '"<<caller->GetFullName()<<"' does not point to a valid input of the complex box !");
- }
- bbtkDebugDecTab("Process",1);
+ bbSetExecuting(false);
+
+ return s;
}
//==================================================================
- */
//==================================================================
} // if parentblackbox
}
//=========================================================================
+
- /*
+ /*
+
//=======================================================================
/// Generates the list of the packages of which its depends
/// (cause an internal box belongs to it)