X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkComplexBlackBox.cxx;h=a8653ccedbe769f10698b804d512c39291f28b20;hb=8cbad3dc345346d0473d93cdc06dc9eb5cbdbf23;hp=c494d6555c6a4cd0bfdf1df7e47fda954ab3603c;hpb=4ad5b5ee44357ad873bc8c43230defb6d0a79879;p=bbtk.git diff --git a/kernel/src/bbtkComplexBlackBox.cxx b/kernel/src/bbtkComplexBlackBox.cxx index c494d65..a8653cc 100644 --- a/kernel/src/bbtkComplexBlackBox.cxx +++ b/kernel/src/bbtkComplexBlackBox.cxx @@ -1,27 +1,40 @@ -/*========================================================================= - -Program: bbtk -Module: $RCSfile: bbtkComplexBlackBox.cxx,v $ -Language: C++ -Date: $Date: 2008/04/18 12:59:15 $ -Version: $Revision: 1.10 $ - -Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de -l'Image). All rights reserved. See Doc/License.txt or -http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details. - -This software is distributed WITHOUT ANY WARRANTY; without even -the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -PURPOSE. See the above copyright notices for more information. - +/*========================================================================= + Program: bbtk + Module: $RCSfile: bbtkComplexBlackBox.cxx,v $ + Language: C++ + Date: $Date: 2008/10/17 08:18:12 $ + Version: $Revision: 1.21 $ =========================================================================*/ +/* --------------------------------------------------------------------- + +* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) +* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux +* +* This software is governed by the CeCILL-B license under French law and +* abiding by the rules of distribution of free software. You can use, +* modify and/ or redistribute the software under the terms of the CeCILL-B +* license as circulated by CEA, CNRS and INRIA at the following URL +* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +* or in the file LICENSE.txt. +* +* As a counterpart to the access to the source code and rights to copy, +* modify and redistribute granted by the license, users are provided only +* with a limited warranty and the software's author, the holder of the +* economic rights, and the successive licensors have only limited +* liability. +* +* The fact that you are presently reading this means that you have had +* knowledge of the CeCILL-B license and that you accept its terms. +* ------------------------------------------------------------------------ */ + /** * \file * \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 +92,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 +185,6 @@ namespace bbtk ->bbGetInputConnectorMap()[ d->GetInput() ]; bbGetInputConnectorMap()[i->second->GetName()] = c; -//new BlackBoxInputConnector(); } // Output connectors @@ -195,11 +204,8 @@ namespace bbtk ->bbGetOutputConnectorMap()[ d->GetOutput() ]; bbGetOutputConnectorMap()[o->second->GetName()] = c; - //new BlackBoxOutputConnector(); } - -*/ - + bbtkDebugDecTab("Kernel",8); } //========================================================================= @@ -217,11 +223,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 +248,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 +276,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()<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 : "<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 +479,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 +1042,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 +1090,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 <<" ["<