X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkBlackBox.cxx;h=0206b2924369b54871e9eba5df07b74a59de64c4;hb=ffe082cfc10dbb2c326c513563286caa2606110f;hp=04d146c6ca2780483e5171b71430655adca552c7;hpb=0a7afaadd37a67878b1dfe9166c1c7abd867e53f;p=bbtk.git diff --git a/kernel/src/bbtkBlackBox.cxx b/kernel/src/bbtkBlackBox.cxx index 04d146c..0206b29 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 12:54:02 $ - Version: $Revision: 1.34 $ + Date: $Date: 2009/03/23 13:06:41 $ + Version: $Revision: 1.40 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -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"<second, OUTOFDATE); if (o->second->GetStatus()==UPTODATE) { o->second->SetStatus(OUTOFDATE); @@ -605,81 +571,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 +621,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 +630,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 +663,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 +688,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,