X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkBlackBox.cxx;h=ddfc3ed9576598ad5b150716c67dbec7ccafe65e;hb=1e2df7fb6ae571ce1cf72e6af1715f0e34675cbf;hp=c21285cd6b136b7e4a7a96aaf92675ed61b561fd;hpb=6575a389b71b1b85c79e4444885becb76ecf16e4;p=bbtk.git diff --git a/kernel/src/bbtkBlackBox.cxx b/kernel/src/bbtkBlackBox.cxx index c21285c..ddfc3ed 100644 --- a/kernel/src/bbtkBlackBox.cxx +++ b/kernel/src/bbtkBlackBox.cxx @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbtkBlackBox.cxx,v $ Language: C++ - Date: $Date: 2008/10/17 08:18:12 $ - Version: $Revision: 1.25 $ + Date: $Date: 2008/11/25 11:17:13 $ + Version: $Revision: 1.29 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -50,7 +50,7 @@ namespace bbtk static bool bbmgSomeBoxExecuting = false; static bool bbmgFreezeExecution = false; - static std::set bbmgExecutionList; + static std::set bbmgExecutionList; //========================================================================= BlackBox::Deleter::Deleter() @@ -103,6 +103,7 @@ namespace bbtk BlackBox::BlackBox(const std::string &name) : bbmStatus(MODIFIED), + bbmExecuting(false), bbmName(name), bbmBoxProcessMode("Pipeline"), bbmParent() @@ -123,6 +124,7 @@ namespace bbtk BlackBox::BlackBox(BlackBox& from, const std::string &name) : bbmStatus(from.bbmStatus), + bbmExecuting(false), bbmName(name), bbmBoxProcessMode(from.bbmBoxProcessMode), bbmParent() @@ -155,9 +157,16 @@ namespace bbtk void BlackBox::bbExecute(bool force) { bbtkDebugMessageInc("process",2, - "=> BlackBox::bbExecute() [" + "=> BlackBox::bbExecute("<<(int)force<<") [" < already executing : bailing out"<second->GetCopyConstruct() ) continue; std::string input = i->second->GetName(); + bbtkDebugMessage("Kernel",2,"* Copying input "<bbSetInput(input, from.bbGetInput(input) ); } // copies the output values @@ -356,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) ); } @@ -1127,22 +1138,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(); @@ -1150,6 +1177,7 @@ namespace bbtk "<= BlackBox::bbGlobalProcessExecutionList()" <bbGetFullName()<<")"<