X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkComplexBlackBox.cxx;h=c07ba9f383b74ef805b56f208243c17ce8aadb51;hb=7a86b21a88862240b2b56d165433cbcbb50ab316;hp=d15a45cc726c94b137be1158e8c17c4a2b3d2dee;hpb=5934ccb7ca0fabdbe6c1907b2aea3696e19a0251;p=bbtk.git diff --git a/kernel/src/bbtkComplexBlackBox.cxx b/kernel/src/bbtkComplexBlackBox.cxx index d15a45c..c07ba9f 100644 --- a/kernel/src/bbtkComplexBlackBox.cxx +++ b/kernel/src/bbtkComplexBlackBox.cxx @@ -1,29 +1,48 @@ +/* + # --------------------------------------------------------------------- + # + # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image + # pour la SantÈ) + # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton + # Previous Authors : Laurent Guigues, Jean-Pierre Roux + # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil + # + # 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. + # ------------------------------------------------------------------------ */ + + /*========================================================================= - -Program: bbtk -Module: $RCSfile: bbtkComplexBlackBox.cxx,v $ -Language: C++ -Date: $Date: 2008/04/22 14:30:25 $ -Version: $Revision: 1.15 $ - -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: 2012/11/16 08:49:01 $ + Version: $Revision: 1.33 $ =========================================================================*/ + /** * \file * \brief class bbtk::ComplexBlackBox : user defined complex black boxes */ #include "bbtkComplexBlackBox.h" -#include "bbtkBlackBoxDescriptor.h" -#include "bbtkFactory.h" +#include "bbtkWx.h" +//#include "bbtkBlackBoxDescriptor.h" +//#include "bbtkFactory.h" #include "bbtkConfigurationFile.h" namespace bbtk @@ -34,12 +53,9 @@ namespace bbtk ComplexBlackBox::Pointer ComplexBlackBox::New(const std::string& name, ComplexBlackBoxDescriptor::Pointer desc) { - bbtkDebugMessage("object",1,"##> ComplexBlackBox::New('"<GetTypeName()<<"')" <GetTypeName()<<"')" < ComplexBlackBox::New('"<GetTypeName()<<"')" <GetTypeName()<<"')" < ComplexBlackBox::ComplexBlackBox(\"" + bbtkBlackBoxDebugMessage("object",3, + "##> ComplexBlackBox(\"" < ComplexBlackBox::ComplexBlackBox(\"" + bbtkBlackBoxDebugMessage("object",3, + "##> ComplexBlackBox(\"" <first<<"\""<first<<"\""<second->bbClone(i->second->bbGetName()); bbUnsafeAddBlackBox(B); - } - bbtkDebugMessage("object",4," * Cloning Connections"<GetFullName()<<"\""<GetOriginalBlackBoxFrom()->bbGetName() ); @@ -110,8 +130,8 @@ namespace bbtk } bbAllocateConnectors(); - bbtkDebugMessage("object",3, - "<## ComplexBlackBox::ComplexBlackBox(\"" + bbtkBlackBoxDebugMessage("object",3, + "<## ComplexBlackBox(\"" < ComplexBlackBox::~ComplexBlackBox() [" - < ~ComplexBlackBox()" + <bbDesallocateConnectors(); + + bbtkBlackBoxDebugMessage("object",3, + "<== ~ComplexBlackBox()" + < ComplexBlackBox::Clear()" + < Releasing connections"< Releasing boxes"<bbDesallocateConnectors(); - - bbtkDebugMessage("object",3, - "<== ComplexBlackBox::~ComplexBlackBox() [" - < ComplexBlackBox::bbAllocateConnectors()" <first<<"\""<first<<"\""<first<<"\""<first<<"\""<second->GetName()] = c; } - - bbtkDebugDecTab("Kernel",8); - } + bbtkBlackBoxDebugMessage("kernel",8, + "<== ComplexBlackBox::bbAllocateConnectors()" + < ComplexBlackBox::DesallocateConnectors()" < ComplexBlackBox::bbClone(\""< ComplexBlackBox::bbExecute()" + < Executing '"<<*i<<"'"< Executing '"<<*i<<"'"<bbExecute(force); } } @@ -258,111 +298,23 @@ namespace bbtk i->second->bbExecute(force); } } - - Wx::EndBusyCursor(); - - - bbtkDebugDecTab("Process",1); + bbtkBlackBoxDebugMessage("process",2, + "<** ComplexBlackBox::bbExecute()" + <GetBlackBox()->bbSetModifiedStatus(c); - - bbtkDebugMessage("Process",3, - "EO ComplexBlackBox::bbSetModifiedStatus(" - <GetFullName():"0")<<") [" - <GetBlackBoxFrom()->bbGetFullName() - <<"."<GetBlackBoxFromOutput()<<"----" - <GetOriginalBlackBoxFrom()->bbGetFullName() - <<"."<GetOriginalBlackBoxFromOutput()<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 : "<GetTarget()<GetBlackBoxFromOutput(); - // std::cout << "oldout = "<GetFullName()<<"' does not point to a valid output of the complex box !"); - } - bbtkDebugDecTab("Process",1); - - return s; } //================================================================== @@ -371,9 +323,9 @@ namespace bbtk //================================================================== Data ComplexBlackBox::bbGetOutput( const std::string &name ) { - bbtkDebugMessageInc("Data",7, - "ComplexBlackBox::bbGetOutput(\""<GetTarget())->bbGetOutput(d->GetOutput()); - - bbtkDebugDecTab("Data",7); return p; } //================================================================== @@ -391,9 +341,9 @@ namespace bbtk /// Gets the input Data of a given name Data ComplexBlackBox::bbGetInput( const std::string &name ) { - bbtkDebugMessageInc("Data",7, - "ComplexBlackBox::bbGetInput(\""<GetTarget())->bbGetInput(d->GetInput()); - bbtkDebugDecTab("Data",7); return p; } //================================================================== @@ -410,9 +359,9 @@ namespace bbtk /// Sets the data of the output called void ComplexBlackBox::bbSetOutput( const std::string &name, Data data) { - bbtkDebugMessageInc("Data",7, - "ComplexBlackBox::bbSetOutput(\""<GetTarget())->bbSetOutput(d->GetOutput(),data); - bbtkDebugDecTab("Data",7); } //================================================================== @@ -429,16 +377,15 @@ namespace bbtk void ComplexBlackBox::bbSetInput( const std::string &name, Data data, bool setModified) { - bbtkDebugMessageInc("Data",7, - "ComplexBlackBox::bbSetInput(\""<GetInputDescriptor(name); bbGetBlackBox(d->GetTarget())->bbSetInput(d->GetInput(),data,setModified); - bbtkDebugDecTab("Data",7); } //================================================================== @@ -449,10 +396,10 @@ namespace bbtk void* data, bool setModified) { - bbtkDebugMessageInc("Data",7, + bbtkBlackBoxDebugMessage("data",7, "ComplexBlackBox::bbBruteForceSetInputPointer('" - <GetInputDescriptor(name); @@ -461,7 +408,6 @@ namespace bbtk data, setModified); - bbtkDebugDecTab("Data",7); } //================================================================== @@ -469,10 +415,9 @@ namespace bbtk /// Connects the input to the connection c void ComplexBlackBox::bbConnectInput( const std::string& name, Connection* c) { - bbtkDebugMessage("connection",2, + bbtkBlackBoxDebugMessage("connection",2, "==> ComplexBlackBox::bbConnectInput(\"" - <GetFullName()<<") [" - <GetFullName()<<")" <GetTarget()); - bbtkDebugMessage("connection",2," - Target = "<GetTarget()<<" = "<bbGetFullName()<bbGetFullName()<SetBlackBoxTo(t); c->SetBlackBoxToInput(d->GetInput()); - bbtkDebugMessage("connection",2," - New conn = "<GetFullName()<GetFullName()<<") [" - <GetFullName()<<")" < to the connection c void ComplexBlackBox::bbConnectOutput( const std::string& name, Connection* c) { - bbtkDebugMessage("connection",2, + bbtkBlackBoxDebugMessage("connection",2, "==> ComplexBlackBox::bbConnectOutput(\"" - <GetFullName()<<") [" - <GetFullName()<<")" + <GetOutputDescriptor(name); BlackBox::Pointer t = bbGetBlackBox(d->GetTarget()); - bbtkDebugMessage("connection",2," - Target = "<GetTarget()<<" = "<bbGetFullName()<bbGetFullName()<SetBlackBoxFrom(t); c->SetBlackBoxFromOutput(d->GetOutput()); - bbtkDebugMessage("connection",2," - New conn = "<GetFullName()<GetFullName()<<") [" - <GetFullName()<<")" + <bbGetName() - <<"\") [" - <bbGetName() + <<"\")" + <bbGetName()) ) { @@ -546,7 +490,6 @@ namespace bbtk b->bbSetParent(GetThisPointer()); mBlackBoxMap[b->bbGetName()] = b; - bbtkDebugDecTab("Kernel",7); } //================================================================== @@ -554,15 +497,14 @@ namespace bbtk /// Adds the black box to the complex box (unsafe) void ComplexBlackBox::bbUnsafeAddBlackBox( BlackBox::Pointer b) { - bbtkDebugMessageInc("Kernel",7, + bbtkBlackBoxDebugMessage("kernel",7, "ComplexBlackBox::UnsafeAddBlackBox(\""<bbGetName() - <<"\") [" - <bbSetParent(GetThisPointer()); mBlackBoxMap[b->bbGetName()] = b; - bbtkDebugDecTab("Kernel",7); } //================================================================== @@ -571,9 +513,9 @@ namespace bbtk void ComplexBlackBox::bbRemoveBlackBox( const std::string& name, bool remove_connections ) { - bbtkDebugMessageInc("Kernel",7, - "ComplexBlackBox::RemoveBlackBox(\""< BlackBox::Pointer ComplexBlackBox::bbGetBlackBox( const std::string& name ) { - bbtkDebugMessageInc("Kernel",9, - "ComplexBlackBox::GetBlackBox(\""<second; } //================================================================== @@ -645,19 +582,16 @@ namespace bbtk /// if it does not exist but return a null pointer BlackBox::Pointer ComplexBlackBox::bbUnsafeGetBlackBox( const std::string& name ) { - bbtkDebugMessageInc("Kernel",9, - "ComplexBlackBox::UnsafeGetBlackBox(\""<second; } @@ -666,18 +600,16 @@ namespace bbtk //================================================================== void ComplexBlackBox::bbPrintBlackBoxes() { - bbtkDebugMessageInc("Kernel",9, - "ComplexBlackBox::PrintBlackBoxes() [" - <second->bbGetFullName()<second->bbGetFullName()<\n\n"; // End @@ -1155,13 +1102,13 @@ namespace bbtk BlackBoxMapType::const_iterator i; for ( i = mBlackBoxMap.begin(); i != mBlackBoxMap.end(); ++i ) { - s += i->second->GetObjectRecursiveSize(); + s += i->second->GetObjectRecursiveSize(); } ConnectionListType::const_iterator j; for ( j = mConnectionList.begin(); j != mConnectionList.end(); ++j ) { - s += (*j)->GetObjectRecursiveSize(); + s += (*j)->GetObjectRecursiveSize(); } return s; }