X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkBlackBox.cxx;h=a4dea22c8624d2e0959d574c573799a54122dd72;hb=f31300e2cc245436a25e7074a26158ac0eed1518;hp=d0e93b5c14ba13b8f28590dc20ab03c6a3da50b6;hpb=13aaa782a7f5942f5072728201750c06afbdfb2d;p=bbtk.git diff --git a/kernel/src/bbtkBlackBox.cxx b/kernel/src/bbtkBlackBox.cxx index d0e93b5..a4dea22 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 11:48:31 $ - Version: $Revision: 1.33 $ + Date: $Date: 2008/12/11 15:30:04 $ + Version: $Revision: 1.38 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -153,42 +153,6 @@ namespace bbtk //========================================================================= - //========================================================================= - /// Main processing method of the box. - void BlackBox::bbExecute(bool force) - { - bbtkDebugMessageInc("process",2, - "=> BlackBox::bbExecute("<<(int)force<<") [" - < already executing : bailing out"< FreezeExecution global flag is 'true' : abort execution"<second, OUTOFDATE); if (o->second->GetStatus()==UPTODATE) { o->second->SetStatus(OUTOFDATE); @@ -605,81 +570,6 @@ namespace bbtk } //========================================================================= - //========================================================================= - void BlackBox::bbSetStatusAndPropagate(BlackBoxOutputConnector* c, - IOStatus s) - { - bbtkError("bbSetStatusAndPropagate(BlackBoxOutputConnector* c,IOStatus s)"); - /* - if (i->GetStatus()==UPTODATE) - { - i->second->SetStatus(s); - i->second->SignalChange(GetThisPointer(),i->first); - } - */ - } - //========================================================================= - - - /// Signals that the BlackBox has been modified - /* - void BlackBox::bbSetModifiedStatus(BlackBoxInputConnector* c) - { - bbtkDebugMessage("modified",1, - "==> BlackBox::bbSetModifiedStatus("<second) ) - // && (bbCanReact())) - { - bbtkDebugMessage("modified",2, - "-> Hide triggered by WinHide input change" - <bbHideWindow(); - 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)) - && (bbCanReact() ) ) - { - bbtkDebugMessage("modified",2, - "-> Execution triggered by Reactive mode or BoxExecute input change"<bbSetStatus(MODIFIED); - bbGlobalAddToExecutionList( GetThisPointer() ); - } - - //else if ( bbGetStatus() == MODIFIED ) //! this->bbIsUptodate()) - // { -// bbtkDebugMessage("modified",2,"-> Already modified"< Status set to modified"<bbSetStatus(MODIFIED); - } - - this->bbSignalOutputModification(false); - - bbtkDebugMessageDec("process",5, - "<= BlackBox::bbSetModifiedStatus("<second->GetStatus()==UPTODATE) - { - // i->second->SetStatus(MODIFIED); + // std::cout << "Stat = " + //<second->GetStatus()) + // <second->GetStatus()==UPTODATE) + // { i->second->SignalChange(GetThisPointer(),i->first); - } + // } } if (reaction) bbGlobalProcessExecutionList(); @@ -726,9 +620,8 @@ namespace bbtk bbtkError("BlackBox["<second->GetStatus()==UPTODATE) - { - // i->second->SetStatus(MODIFIED); + // if (i->second->GetStatus()==UPTODATE) + // { i->second->SignalChange(GetThisPointer(),i->first); // Has to notify the output "BoxChange" also if (output != "BoxChange") @@ -736,12 +629,11 @@ namespace bbtk i = bbGetOutputConnectorMap().find("BoxChange"); if ( i != bbGetOutputConnectorMap().end() ) { - // i->second->SetStatus(MODIFIED); i->second->SignalChange(GetThisPointer(),i->first); } } if (reaction) bbGlobalProcessExecutionList(); - } + // } bbtkDebugMessageDec("change",5, "<= BlackBox::bbSignalOutputModification(" @@ -770,25 +662,22 @@ namespace bbtk { bbtkError("BlackBox["<second->GetStatus()==UPTODATE) - { - // i->second->SetStatus(MODIFIED); + + // 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) - { - // i->second->SetStatus(MODIFIED); + // if (i->second->GetStatus()==UPTODATE) + // { i->second->SignalChange(GetThisPointer(),i->first); if (reaction) bbGlobalProcessExecutionList(); - } + // } } bbtkDebugMessageDec("change",5, @@ -798,9 +687,128 @@ 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"<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" + <second->BackwardUpdate(); + i->second->RecursiveExecute(); IOStatus t = i->second->GetStatus(); if (t > s) s = t; bbtkDebugMessageDec("change",2, @@ -911,13 +919,8 @@ namespace bbtk bbtkError("no input called '"<second->SetConnection(c); - - // Check the status of the from.output of c - // to set the new status of the input - IOStatus s = MODIFIED; - if ( c->GetBlackBoxFrom()->bbGetOutputConnector(c->GetBlackBoxFromOutput()).GetStatus() == OUTOFDATE ) - s = OUTOFDATE; - bbSetStatusAndPropagate(i->second,s); + // The input *MUST* be set OUTOFDATE to update its input on next execution + bbSetStatusAndPropagate(i->second,OUTOFDATE); bbtkDebugMessage("connection",2, "<== BlackBox::bbConnectInput(\""