- 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();
- BlackBoxDescriptor::OutputDescriptorMapType::const_iterator i
- = omap.find(caller->GetBlackBoxFromOutput());
- if (i!=omap.end())
- {
- // Cast the BBOutputDescriptor into a ComplexBBOutputDescriptor
- ComplexBlackBoxOutputDescriptor* d =
- (ComplexBlackBoxOutputDescriptor*)i->second;
- // Get the internal box
- 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
- // 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);
- IOStatus s1 = b->bbBackwardUpdate(caller);
- //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;
- bbtkDebugDecTab("Process",2);
- }
- else
- {
- bbtkError("Connection '"<<caller->GetFullName()<<"' does not point to a valid output of the complex box !");
- }
- bbtkDebugDecTab("Process",1);
-
- bbSetExecuting(false);
-
- return s;