X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkBlackBox.cxx;h=8be7d01d0e3a283d659957fcf63f6284a8dbb7ba;hb=a35973b128a2f7130b619a2a11a35cfd418b21b6;hp=1ff72d10bdb6f49542d099ca5faf82c2fe784240;hpb=554eb3a09fb2700fa281cc46e04642f11cdbad28;p=bbtk.git diff --git a/kernel/src/bbtkBlackBox.cxx b/kernel/src/bbtkBlackBox.cxx index 1ff72d1..8be7d01 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/12/09 13:45:13 $ - Version: $Revision: 1.35 $ + Date: $Date: 2009/03/30 14:42:16 $ + Version: $Revision: 1.41 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -54,6 +54,7 @@ namespace bbtk static std::set bbmgExecutionList; //========================================================================= + BlackBox::Deleter::Deleter() { } @@ -78,7 +79,7 @@ namespace bbtk b->bbDelete(); - bbtkDebugMessage("object",2,"##> BlackBox::Deleter(\""< BlackBox::Deleter(\""< BlackBox::bbExecute("<<(int)force<<") [" - < already executing : bailing out"< FreezeExecution global flag is 'true' : abort execution"<SetStatus(s); + + // Flash reaction + /* + if (bbGetBoxProcessModeValue() == Flash) + { + this->bbExecute(); + } + */ + OutputConnectorMapType::const_iterator o; for ( o = bbGetOutputConnectorMap().begin(); o != bbGetOutputConnectorMap().end(); ++o ) @@ -617,10 +600,15 @@ namespace bbtk for ( i = bbGetOutputConnectorMap().begin(); i != bbGetOutputConnectorMap().end(); ++i) { - if (i->second->GetStatus()==UPTODATE) - { + // std::cout << "Stat = " + //<second->GetStatus()) + // <second->GetStatus()==UPTODATE) + // { i->second->SignalChange(GetThisPointer(),i->first); - } + // } } if (reaction) bbGlobalProcessExecutionList(); @@ -649,8 +637,8 @@ namespace bbtk bbtkError("BlackBox["<second->GetStatus()==UPTODATE) - { + // if (i->second->GetStatus()==UPTODATE) + // { i->second->SignalChange(GetThisPointer(),i->first); // Has to notify the output "BoxChange" also if (output != "BoxChange") @@ -662,7 +650,7 @@ namespace bbtk } } if (reaction) bbGlobalProcessExecutionList(); - } + // } bbtkDebugMessageDec("change",5, "<= BlackBox::bbSignalOutputModification(" @@ -691,23 +679,22 @@ namespace bbtk { bbtkError("BlackBox["<second->GetStatus()==UPTODATE) - { + + // if (i->second->GetStatus()==UPTODATE) + // { i->second->SignalChange(GetThisPointer(),i->first); changed = true; - } + // } } // Has to notify the output "BoxChange" also i = bbGetOutputConnectorMap().find("BoxChange"); if ( changed && (i != bbGetOutputConnectorMap().end())) { - // Already OUTOFDATE : noting to do - if (i->second->GetStatus()==UPTODATE) - { + // if (i->second->GetStatus()==UPTODATE) + // { i->second->SignalChange(GetThisPointer(),i->first); if (reaction) bbGlobalProcessExecutionList(); - } + // } } bbtkDebugMessageDec("change",5, @@ -717,9 +704,133 @@ namespace bbtk } //========================================================================= + + + + + + + //========================================================================= + /// Main processing method of the box. + void BlackBox::bbExecute(bool force) + { + bbtkDebugMessageInc("process",2, + "=> BlackBox::bbExecute("<<(int)force<<") [" + < already executing : abort"< FreezeExecution global flag is 'true' : abort execution"< BlackBox::bbRecursiveExecute(" + <<(caller?caller->GetFullName():"0")<<") [" + < already executing : abort"<bbCreateWidget(); + + // Updates its inputs + IOStatus s = bbUpdateInputs(); + + if ( (s != UPTODATE) || + bbBoxProcessModeIsAlways() ) + { + // Displays the window (WxBlackbox) + // bbShowWindow(caller); + + // Actual processing (virtual) + this->bbProcess(); + + + // Update the I/O statuses + bbComputePostProcessStatus(); + } + else + { + // Test output status... + OutputConnectorMapType::iterator o; + for ( o = bbGetOutputConnectorMap().begin(); + o!= bbGetOutputConnectorMap().end(); ++o) + { + if (o->second->GetStatus() != UPTODATE) + { + bbtkWarning("BlackBox::bbRecursiveExecute [" + <first<<"' is Out-of-date ???"); + } + } + + bbtkDebugMessage("process",3," -> Up-to-date : nothing to do" + <bbShowWidget(); + + + bbtkDebugMessage("process",3, + "<= BlackBox::bbRecursiveExecute() [" + <second->BackwardUpdate(); + i->second->RecursiveExecute(); IOStatus t = i->second->GetStatus(); if (t > s) s = t; bbtkDebugMessageDec("change",2,