Program: bbtk
Module: $RCSfile: bbtkComplexBlackBox.cxx,v $
Language: C++
- Date: $Date: 2008/12/08 12:54:09 $
- Version: $Revision: 1.22 $
+ Date: $Date: 2008/12/12 12:11:21 $
+ Version: $Revision: 1.24 $
=========================================================================*/
/* ---------------------------------------------------------------------
bbtkDebugMessage("object",3,
"==> ComplexBlackBox::~ComplexBlackBox() ["
<<bbGetName()<<"]"<<std::endl);
+
+ Clear();
+ this->bbDesallocateConnectors();
+
+ bbtkDebugMessage("object",3,
+ "<== ComplexBlackBox::~ComplexBlackBox() ["
+ <<bbGetName()<<"]"<<std::endl);
+ }
+ //=======================================================================
+
+
+ //=======================================================================
+ /// Clear
+ void ComplexBlackBox::Clear()
+ {
+ bbtkDebugMessage("object",3,
+ "==> ComplexBlackBox::Clear() ["
+ <<bbGetName()<<"]"<<std::endl);
bbtkDebugMessage("object",4,
" -> Releasing connections"<<std::endl);
" -> Releasing boxes"<<std::endl);
mBlackBoxMap.clear();
- // Clear();
- this->bbDesallocateConnectors();
-
bbtkDebugMessage("object",3,
- "<== ComplexBlackBox::~ComplexBlackBox() ["
+ "<== ComplexBlackBox::Clear() ["
<<bbGetName()<<"]"<<std::endl);
}
//=======================================================================
-
//=========================================================================
/// Allocates the i/o connectors of the black box
}
//==================================================================
- /*
- //==================================================================
- void ComplexBlackBox::bbSetModifiedStatus(BlackBoxInputConnector* c)
- {
- bbtkDebugMessage("modified",1,
- "==> ComplexBlackBox::bbSetModifiedStatus("
- <<c<<") ["<<bbGetFullName()<<"]"<<std::endl);
-
- c->GetBlackBox()->bbSetModifiedStatus(c);
-
- }
- //==================================================================
-*/
-
//==================================================================
void ComplexBlackBox::bbAddToExecutionList( const std::string& name )
{
- bbtkDebugMessageInc("Kernel",9,
+ bbtkDebugMessageInc("Kernel",9,
"ComplexBlackBox::bbAddToExecutionList(\""
<<name<<"\") ["
<<bbGetFullName()<<"]"<<std::endl);
-
- mExecutionList.push_back( name );
-
- bbtkDebugDecTab("Kernel",9);
-
- }
- //==================================================================
-
- //==================================================================
- void ComplexBlackBox::bbBackwardUpdate(Connection::Pointer caller)
- {
- bbtkDebugMessageInc("process",3,
- "==> ComplexBlackBox::bbBackwardUpdate("
- <<(caller?caller->GetFullName():"0")<<") ["
- <<bbGetFullName()<<"]"<<std::endl);
- // bbtkInternalError("ComplexBlackBox::bbBackwardUpdate should never be called !");
- if (caller==0)
- {
- bbtkInternalError("ComplexBlackBox::bbBackwardUpdate called with caller=0");
- }
-
- /*
- std::cout << "CBB BUP : "<<caller->GetBlackBoxFrom()->bbGetFullName()
- <<"."<<caller->GetBlackBoxFromOutput()<<"----"
- <<caller->GetOriginalBlackBoxFrom()->bbGetFullName()
- <<"."<<caller->GetOriginalBlackBoxFromOutput()<<std::endl;
- */
-
-
-
- // 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",4,"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;
- }
- else
- {
- bbtkError("Connection '"<<caller->GetFullName()<<"' does not point to a valid output of the complex box !");
- }
-
- return; // s;
+ mExecutionList.push_back( name );
+
+ bbtkDebugDecTab("Kernel",9);
}
//==================================================================