X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkComplexBlackBox.cxx;h=3625afdb8705fa9d40da4092c59c5ca6be54ac98;hb=284c682653a60e969e2cff74445702fe54c32a76;hp=8a6c65b2ee07d55d927dab236b69d9cb298f5da4;hpb=2b8d8f686974ab38c9ffcf0f88dd533b01b68e84;p=bbtk.git diff --git a/kernel/src/bbtkComplexBlackBox.cxx b/kernel/src/bbtkComplexBlackBox.cxx index 8a6c65b..3625afd 100644 --- a/kernel/src/bbtkComplexBlackBox.cxx +++ b/kernel/src/bbtkComplexBlackBox.cxx @@ -1,29 +1,42 @@ -/*========================================================================= - -Program: bbtk -Module: $RCSfile: bbtkComplexBlackBox.cxx,v $ -Language: C++ -Date: $Date: 2008/04/23 14:49:27 $ -Version: $Revision: 1.16 $ - -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: 2010/03/19 08:18:41 $ + Version: $Revision: 1.32 $ =========================================================================*/ +/* --------------------------------------------------------------------- + +* 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 "bbtkBlackBoxDescriptor.h" -#include "bbtkFactory.h" +#include "bbtkWx.h" +//#include "bbtkBlackBoxDescriptor.h" +//#include "bbtkFactory.h" #include "bbtkConfigurationFile.h" namespace bbtk @@ -53,12 +66,12 @@ namespace bbtk mLockedDescriptor(desc), mDescriptor(desc) { - bbtkDebugMessage("object",3, - "##> 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 +127,8 @@ namespace bbtk } bbAllocateConnectors(); - bbtkDebugMessage("object",3, - "<## ComplexBlackBox::ComplexBlackBox(\"" + bbtkBlackBoxDebugMessage("object",3, + "<## ComplexBlackBox(\"" < ComplexBlackBox::~ComplexBlackBox() [" - < ~ComplexBlackBox()" + <bbDesallocateConnectors(); - bbtkDebugMessage("object",4, + 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,113 +295,23 @@ namespace bbtk i->second->bbExecute(force); } } - - Wx::EndBusyCursor(); - - - bbtkDebugDecTab("Process",1); + bbtkBlackBoxDebugMessage("process",2, + "<** ComplexBlackBox::bbExecute()" + < ComplexBlackBox::bbSetModifiedStatus(" - <GetBlackBox()->bbSetModifiedStatus(c); - - /* - bbtkDebugMessage("modified",1, - "<== 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; } //================================================================== @@ -373,9 +320,9 @@ namespace bbtk //================================================================== Data ComplexBlackBox::bbGetOutput( const std::string &name ) { - bbtkDebugMessageInc("Data",7, - "ComplexBlackBox::bbGetOutput(\""<GetTarget())->bbGetOutput(d->GetOutput()); - - bbtkDebugDecTab("Data",7); return p; } //================================================================== @@ -393,9 +338,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; } //================================================================== @@ -412,9 +356,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); } //================================================================== @@ -431,16 +374,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); } //================================================================== @@ -451,10 +393,10 @@ namespace bbtk void* data, bool setModified) { - bbtkDebugMessageInc("Data",7, + bbtkBlackBoxDebugMessage("data",7, "ComplexBlackBox::bbBruteForceSetInputPointer('" - <GetInputDescriptor(name); @@ -463,7 +405,6 @@ namespace bbtk data, setModified); - bbtkDebugDecTab("Data",7); } //================================================================== @@ -471,10 +412,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()) ) { @@ -548,7 +487,6 @@ namespace bbtk b->bbSetParent(GetThisPointer()); mBlackBoxMap[b->bbGetName()] = b; - bbtkDebugDecTab("Kernel",7); } //================================================================== @@ -556,15 +494,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); } //================================================================== @@ -573,9 +510,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; } //================================================================== @@ -647,19 +581,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; } @@ -668,18 +599,16 @@ namespace bbtk //================================================================== void ComplexBlackBox::bbPrintBlackBoxes() { - bbtkDebugMessageInc("Kernel",9, - "ComplexBlackBox::PrintBlackBoxes() [" - <second->bbGetFullName()<second->bbGetFullName()<\n\n"; // End