X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkComplexBlackBox.cxx;h=f47e401248fdf3c0c5bd7fec30479eec353721a1;hb=e6b2de923e0e69c303c7d18fb8a5c1970541bb3a;hp=56fdb05c09bb5055c5d4aa9dabcec1ef4ee54c20;hpb=5f49dad37400bf38b313463dd56455ea91086f5f;p=bbtk.git diff --git a/kernel/src/bbtkComplexBlackBox.cxx b/kernel/src/bbtkComplexBlackBox.cxx index 56fdb05..f47e401 100644 --- a/kernel/src/bbtkComplexBlackBox.cxx +++ b/kernel/src/bbtkComplexBlackBox.cxx @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkComplexBlackBox.cxx,v $ Language: C++ -Date: $Date: 2008/04/21 11:41:56 $ -Version: $Revision: 1.11 $ +Date: $Date: 2008/07/24 14:37:05 $ +Version: $Revision: 1.20 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -22,6 +22,7 @@ PURPOSE. See the above copyright notices for more information. * \brief class bbtk::ComplexBlackBox : user defined complex black boxes */ #include "bbtkComplexBlackBox.h" +#include "bbtkWx.h" #include "bbtkBlackBoxDescriptor.h" #include "bbtkFactory.h" #include "bbtkConfigurationFile.h" @@ -79,13 +80,17 @@ namespace bbtk <first<<"\""<second->bbClone(i->second->bbGetName()); bbUnsafeAddBlackBox(B); - } bbtkDebugMessage("object",4," * Cloning Connections"< Releasing boxes"<bbDesallocateConnectors(); - if (mLockedDescriptor) - { - bbtkMessage("object",3," --> Releasing descriptor"<GetInputDescriptorMap(); @@ -175,7 +173,6 @@ namespace bbtk ->bbGetInputConnectorMap()[ d->GetInput() ]; bbGetInputConnectorMap()[i->second->GetName()] = c; -//new BlackBoxInputConnector(); } // Output connectors @@ -195,11 +192,8 @@ namespace bbtk ->bbGetOutputConnectorMap()[ d->GetOutput() ]; bbGetOutputConnectorMap()[o->second->GetName()] = c; - //new BlackBoxOutputConnector(); } - -*/ - + bbtkDebugDecTab("Kernel",8); } //========================================================================= @@ -217,11 +211,9 @@ namespace bbtk // but by the internal boxes. Hence **DO NOT** desallocate ! // just clear the maps to avoid that // BlackBox::bbDesallocateConnectors delete the connectors - - /* - bbGetInputConnectorMap().clear(); + bbGetInputConnectorMap().clear(); bbGetOutputConnectorMap().clear(); - */ + bbtkDebugDecTab("Kernel",8); } @@ -244,12 +236,12 @@ namespace bbtk /// Executes the box so that its outputs are up-to-date on exit void ComplexBlackBox::bbExecute(bool force) { - bbtkDebugMessageInc("Process",1, - "ComplexBlackBox::bbExecute() [" + bbtkDebugMessageInc("process",2, + "=> ComplexBlackBox::bbExecute() [" < Executing '"<<*i<<"'"< Executing '"<<*i<<"'"<bbExecute(force); } } @@ -272,26 +264,23 @@ namespace bbtk } } - Wx::EndBusyCursor(); - - - bbtkDebugDecTab("Process",1); - } //================================================================== //================================================================== void ComplexBlackBox::bbSetModifiedStatus(BlackBoxInputConnector* c) { - bbtkDebugMessage("Process",3, - "ComplexBlackBox::bbSetModifiedStatus(" + bbtkDebugMessage("modified",1, + "==> ComplexBlackBox::bbSetModifiedStatus(" <GetBlackBox()->bbSetModifiedStatus(c); - bbtkDebugMessage("Process",3, - "EO ComplexBlackBox::bbSetModifiedStatus(" + /* + bbtkDebugMessage("modified",1, + "<== ComplexBlackBox::bbSetModifiedStatus(" < ComplexBlackBox::bbBackwardUpdate(" <<(caller?caller->GetFullName():"0")<<") [" <GetBlackBoxFrom()->bbGetFullName() + <<"."<GetBlackBoxFromOutput()<<"----" + <GetOriginalBlackBoxFrom()->bbGetFullName() + <<"."<GetOriginalBlackBoxFromOutput()<GetTarget() ); // Calls BackwardUpdate on it - bbtkDebugMessageInc("Process",2,"Internal box connected to output : "<GetTarget()<GetTarget()<GetFullName()<<"' does not point to a valid output of the complex box !"); } - bbtkDebugDecTab("Process",1); - - bbSetExecuting(false); return s; - // return UPTODATE; } //================================================================== @@ -481,52 +467,64 @@ namespace bbtk //========================================================================= /// Connects the input to the connection c - void ComplexBlackBox::bbConnectInput( const std::string& name, Connection::Pointer c) + void ComplexBlackBox::bbConnectInput( const std::string& name, Connection* c) { - bbtkDebugMessageInc("Kernel",7, - "ComplexBlackBox::bbConnectInput(\"" - < ComplexBlackBox::bbConnectInput(\"" + <GetFullName()<<") [" + <GetInputDescriptor(name); + BlackBox::Pointer t = bbGetBlackBox(d->GetTarget()); + + bbtkDebugMessage("connection",2," - Target = "<GetTarget()<<" = "<bbGetFullName()<SetBlackBoxTo(t); c->SetBlackBoxToInput(d->GetInput()); - t->bbConnectInput(d->GetInput(),c); - bbtkMessage("Debug",1,"ComplexBlackBox["<GetFullName()<GetFullName()<<") [" + < to the connection c - void ComplexBlackBox::bbConnectOutput( const std::string& name, Connection::Pointer c) + void ComplexBlackBox::bbConnectOutput( const std::string& name, Connection* c) { - bbtkDebugMessageInc("Kernel",7, - "ComplexBlackBox::bbConnectOutput(\"" - < ComplexBlackBox::bbConnectOutput(\"" + <GetFullName()<<") [" + <GetOutputDescriptor(name); BlackBox::Pointer t = bbGetBlackBox(d->GetTarget()); + + bbtkDebugMessage("connection",2," - Target = "<GetTarget()<<" = "<bbGetFullName()<SetBlackBoxFrom(t); c->SetBlackBoxFromOutput(d->GetOutput()); + + bbtkDebugMessage("connection",2," - New conn = "<GetFullName()<bbConnectOutput(d->GetOutput(),c); - bbtkMessage("Debug",5,"ComplexBlackBox["<GetFullName()<GetFullName()<<") [" + <Check(); + (*j)->Check(); } } if (p.use_count()!=1) @@ -1032,21 +1030,21 @@ namespace bbtk { if (ii->second) { - Connection::Pointer con = ii->second->GetConnection(); + Connection* con = ii->second->GetConnection(); if (con!=NULL){ - BlackBox::Pointer a=con->GetBlackBoxFrom(); - BlackBox::Pointer b=con->GetBlackBoxTo(); + BlackBox::Pointer a=con->GetOriginalBlackBoxFrom(); + BlackBox::Pointer b=con->GetOriginalBlackBoxTo(); fprintf(ff," "); a->bbWriteDotInputOutputName(ff,false,detail,level); if (detail==1) { - fprintf(ff,":%s",con->GetBlackBoxFromOutput().c_str()); + fprintf(ff,":%s",con->GetOriginalBlackBoxFromOutput().c_str()); } fprintf(ff,"->"); b->bbWriteDotInputOutputName(ff,true,detail,level); if (detail==1) { - fprintf(ff,":%s",con->GetBlackBoxToInput().c_str()); + fprintf(ff,":%s",con->GetOriginalBlackBoxToInput().c_str()); } fprintf(ff,"%s\n",";"); } // if con @@ -1080,7 +1078,7 @@ namespace bbtk //======================================================================= void ComplexBlackBox::Check(bool recursive) { - bbtkMessage("Debug",1,"**** Checking Complex Black Box "<<(void*)this + bbtkMessage("debug",1,"**** Checking Complex Black Box "<<(void*)this <<" ["<Check(); + (*j)->Check(); } - bbtkMessage("Debug",1,"**** Checking Complex Black Box "<<(void*)this + bbtkMessage("debug",1,"**** Checking Complex Black Box "<<(void*)this <<" ["<