X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkBlackBox.cxx;h=ddfc3ed9576598ad5b150716c67dbec7ccafe65e;hb=1e2df7fb6ae571ce1cf72e6af1715f0e34675cbf;hp=de8091778b696f5c507e30164aab68c88b6fd8e5;hpb=2b8d8f686974ab38c9ffcf0f88dd533b01b68e84;p=bbtk.git diff --git a/kernel/src/bbtkBlackBox.cxx b/kernel/src/bbtkBlackBox.cxx index de80917..ddfc3ed 100644 --- a/kernel/src/bbtkBlackBox.cxx +++ b/kernel/src/bbtkBlackBox.cxx @@ -1,21 +1,32 @@ -/*========================================================================= - -Program: bbtk -Module: $RCSfile: bbtkBlackBox.cxx,v $ -Language: C++ -Date: $Date: 2008/04/23 14:49:27 $ -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: bbtkBlackBox.cxx,v $ + Language: C++ + Date: $Date: 2008/11/25 11:17:13 $ + Version: $Revision: 1.29 $ =========================================================================*/ +/* --------------------------------------------------------------------- + +* 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 @@ -39,7 +50,7 @@ namespace bbtk static bool bbmgSomeBoxExecuting = false; static bool bbmgFreezeExecution = false; - static std::set bbmgExecutionList; + static std::set bbmgExecutionList; //========================================================================= BlackBox::Deleter::Deleter() @@ -65,7 +76,7 @@ namespace bbtk bbtkDebugMessage("object",2,"##> BlackBox::Deleter(\""<bbDelete(); - + bbtkDebugMessage("object",2,"##> BlackBox::Deleter(\""< BlackBox::BlackBox(\"" < BlackBox::bbExecute() [" + bbtkDebugMessageInc("process",2, + "=> BlackBox::bbExecute("<<(int)force<<") [" < already executing : bailing out"< FreezeExecution global flag is 'true' : abort execution"<second->GetCopyConstruct() ) continue; std::string input = i->second->GetName(); + bbtkDebugMessage("Kernel",2,"* Copying input "<bbSetInput(input, from.bbGetInput(input) ); } // copies the output values @@ -341,6 +366,7 @@ namespace bbtk { if (! o->second->GetCopyConstruct() ) continue; std::string output = o->second->GetName(); + bbtkDebugMessage("Kernel",2,"* Copying output "<bbSetOutput(output, from.bbGetOutput(output) ); } @@ -368,7 +394,7 @@ namespace bbtk /// User overloadable destruction method of a black box void BlackBox::bbUserDelete() { - bbtkDebugMessage("Process",5, + bbtkDebugMessage("process",5, "=> BlackBox::bbUserDelete() [" <bbSetStatus(MODIFIED); return; } + if ( (c==bbGetInputConnectorMap().find("WinClose")->second) ) + // && (bbCanReact())) + { + bbtkDebugMessage("modified",2, + "-> Close triggered by WinClose input change" + <bbHideWindow(); + this->bbSetStatus(MODIFIED); + return; + } if ( ( bbBoxProcessModeIsReactive() || (c==bbGetInputConnectorMap().find("BoxExecute")->second)) @@ -441,11 +477,13 @@ namespace bbtk this->bbSetStatus(MODIFIED); bbGlobalAddToExecutionList( GetThisPointer() ); } + /* else if ( bbGetStatus() == MODIFIED ) //! this->bbIsUptodate()) { bbtkDebugMessage("modified",2,"-> Already modified"< Status set to modified"<bbSignalOutputModification(false); /* - bbtkDebugMessageDec("Process",5, + bbtkDebugMessageDec("process",5, "<= BlackBox::bbSetModifiedStatus("< BlackBox::bbSignalOutputModification() [" < BlackBox::bbSignalOutputModification(" <& output, bool reaction) { - bbtkDebugMessageInc("Process",5, + bbtkDebugMessageInc("process",5, "=> BlackBox::bbSignalOutputModification(vector of outputs) [" < BlackBox::bbUpdateInputs() [" <first); @@ -1100,29 +1138,46 @@ namespace bbtk } //========================================================================= + static bool bbmgGlobalProcessingExecutionList = false; //========================================================================= void BlackBox::bbGlobalProcessExecutionList() { - bbtkDebugMessageInc("Process",1, + bbtkDebugMessageInc("process",3, "=> BlackBox::bbGlobalProcessExecutionList()" - <::iterator i; - for (i=bbmgExecutionList.begin(); - i!=bbmgExecutionList.end(); - ++i) + <::iterator i; + while (bbmgExecutionList.size()>0) { - bbtkDebugMessage("Process",2, - " -> Executing "<<(*i)->bbGetFullName()<bbExecute(true); + i = bbmgExecutionList.begin(); + BlackBox::WeakPointer p = *i; + bbmgExecutionList.erase(i); + if (p.lock()) + { + bbtkDebugMessage("process",4, + " -> Executing "<< + p.lock()->bbGetFullName()<bbExecute(true); + } + else + { + bbtkGlobalError("Strange error in BlackBox::bbGlobalProcessExecutionList() : Weak bb pointer in bbmgExecutionList is no more valid..."); + } } bbmgExecutionList.clear(); - bbtkDebugMessageDec("Process",1, + bbtkDebugMessageDec("process",3, "<= BlackBox::bbGlobalProcessExecutionList()" <bbGetFullName()<<")"< BlackBox::bbmgExecutionList; -*/ //========================================================================= //========================================================================= @@ -1170,6 +1223,16 @@ namespace bbtk } //========================================================================= + void BlackBox::bbUserOnShowWidget(std::string nameInput) + { + bbtk::BlackBoxInputConnector *cc; + cc = this->bbGetInputConnectorMap().find( nameInput.c_str() )->second; + if (cc->GetConnection()!=NULL) + { + cc->GetConnection()->GetBlackBoxFrom()->bbUserOnShow(); + } + } + } // EO namespace bbtk