X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkBlackBox.cxx;h=5fc7d01babe0b9224cb59e7b194a34e24e9aafe7;hb=ae4497a19b957df306e688ce3f69c3687323668e;hp=7b3c4a8e319b0d4eac2e9d4c5c1b59eea3913776;hpb=a32025c531a0e20e967dc2ba3e0817f6932061b1;p=bbtk.git diff --git a/kernel/src/bbtkBlackBox.cxx b/kernel/src/bbtkBlackBox.cxx index 7b3c4a8..5fc7d01 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/05/07 12:59:23 $ -Version: $Revision: 1.18 $ - -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/12/03 09:34:37 $ + Version: $Revision: 1.30 $ =========================================================================*/ +/* --------------------------------------------------------------------- + +* 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() @@ -90,11 +101,13 @@ namespace bbtk //========================================================================= BlackBox::BlackBox(const std::string &name) - : bbmName(name), - bbmStatus(MODIFIED), - bbmBoxProcessMode("Pipeline"), - bbmParent() - + : + bbmStatus(MODIFIED), + bbmExecuting(false), + bbmName(name), + bbmBoxProcessMode("Pipeline"), + bbmParent() + { bbtkDebugMessage("object",4,"==> BlackBox::BlackBox(\"" < BlackBox::bbExecute() [" + "=> 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 @@ -344,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) ); } @@ -434,6 +457,16 @@ namespace bbtk this->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)) @@ -444,15 +477,18 @@ namespace bbtk this->bbSetStatus(MODIFIED); bbGlobalAddToExecutionList( GetThisPointer() ); } + /* else if ( bbGetStatus() == MODIFIED ) //! this->bbIsUptodate()) { bbtkDebugMessage("modified",2,"-> Already modified"< Status set to modified"<bbSetStatus(MODIFIED); + std::cout << "Status set to modified" <bbSignalOutputModification(false); @@ -1007,7 +1043,7 @@ namespace bbtk InputConnectorMapType::iterator i; unsigned int namelmax = 0; unsigned int valuelmax = 0; - unsigned int connlmax = 0; + // unsigned int connlmax = 0; for ( i = mInputConnectorMap.begin(); i != mInputConnectorMap.end(); ++i ) { iname.push_back(i->first); @@ -1103,22 +1139,38 @@ namespace bbtk } //========================================================================= + static bool bbmgGlobalProcessingExecutionList = false; //========================================================================= void BlackBox::bbGlobalProcessExecutionList() { bbtkDebugMessageInc("process",3, "=> BlackBox::bbGlobalProcessExecutionList()" - <::iterator i; - for (i=bbmgExecutionList.begin(); - i!=bbmgExecutionList.end(); - ++i) + < Executing "<<(*i)->bbGetFullName()<bbExecute(true); + bbtkDebugMessage("process",3,"BlackBox::bbGlobalProcessExecutionList() reentered !"); + return; + } + bbmgGlobalProcessingExecutionList = true; + + std::set::iterator i; + while (bbmgExecutionList.size()>0) + { + 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(); @@ -1126,6 +1178,7 @@ namespace bbtk "<= BlackBox::bbGlobalProcessExecutionList()" <bbGetFullName()<<")"< BlackBox::bbmgExecutionList; -*/ //========================================================================= //========================================================================= @@ -1173,6 +1224,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