X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=kernel%2Fsrc%2FbbtkBlackBox.cxx;h=8be7d01d0e3a283d659957fcf63f6284a8dbb7ba;hb=a35973b128a2f7130b619a2a11a35cfd418b21b6;hp=b7a7ec78f4ee6d3d71be5de580d38085f24954c3;hpb=3928b4ad06b5b5fd142f696f58a7828d064e2883;p=bbtk.git diff --git a/kernel/src/bbtkBlackBox.cxx b/kernel/src/bbtkBlackBox.cxx index b7a7ec7..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/08 12:53:45 $ - Version: $Revision: 1.32 $ + 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"< BlackBox::bbSetStatusAndPropagate(input," + <SetStatus(s); + + // Flash reaction + /* + if (bbGetBoxProcessModeValue() == Flash) + { + this->bbExecute(); + } + */ + OutputConnectorMapType::const_iterator o; for ( o = bbGetOutputConnectorMap().begin(); o != bbGetOutputConnectorMap().end(); ++o ) { - // bbSetStatusAndPropagate(o->second, OUTOFDATE); if (o->second->GetStatus()==UPTODATE) { o->second->SetStatus(OUTOFDATE); @@ -590,93 +577,21 @@ namespace bbtk (c==bbGetInputConnectorMap().find("BoxExecute")->second)) && (bbCanReact() ) ) { - bbtkDebugMessage("modified",2, + bbtkDebugMessage("change",2, "-> Execution triggered by Reactive mode or BoxExecute input change"<() ); } + bbtkDebugMessageInc("change",5, + "<= BlackBox::bbSetStatusAndPropagate(input) [" + <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("< BlackBox::bbSignalOutputModification(" <second->GetStatus()==UPTODATE) - { - // i->second->SetStatus(MODIFIED); + // std::cout << "Stat = " + //<second->GetStatus()) + // <second->GetStatus()==UPTODATE) + // { i->second->SignalChange(GetThisPointer(),i->first); - } + // } } if (reaction) bbGlobalProcessExecutionList(); - bbtkDebugMessageDec("process",5, + bbtkDebugMessageDec("change",5, "<= BlackBox::bbSignalOutputModification() [" < BlackBox::bbSignalOutputModification(" <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") @@ -728,14 +646,13 @@ namespace bbtk i = bbGetOutputConnectorMap().find("BoxChange"); if ( i != bbGetOutputConnectorMap().end() ) { - // i->second->SetStatus(MODIFIED); i->second->SignalChange(GetThisPointer(),i->first); } } if (reaction) bbGlobalProcessExecutionList(); - } + // } - bbtkDebugMessageDec("process",5, + bbtkDebugMessageDec("change",5, "<= BlackBox::bbSignalOutputModification(" <& output, bool reaction) { - bbtkDebugMessageInc("process",5, + bbtkDebugMessageInc("change",5, "=> BlackBox::bbSignalOutputModification(vector of outputs) [" <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("process",5, + bbtkDebugMessageDec("change",5, "<= BlackBox::bbSignalOutputModification(vector of outputs) [" < 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() [" + <GetInputDescriptor(i->first)->GetTypeInfo() // == typeid(Void) ) // continue; - i->second->BackwardUpdate(); + bbtkDebugMessageDec("change",2, + bbGetName()<<"."<first + <<" ["<second<<"] " + <<" status before update = '" + <second->GetStatus()) + <<"'"<second->RecursiveExecute(); IOStatus t = i->second->GetStatus(); if (t > s) s = t; + bbtkDebugMessageDec("change",2, + bbGetName()<<"."<first + <<" ["<second<<"] " + <<" status before process = '" + <second->GetStatus()) + <<"'"< BlackBox::bbComputePostProcessStatus() [" + <second->SetStatus(UPTODATE); + bbtkDebugMessage("change",2, + bbGetName()<<"."<first<<" : " + << GetIOStatusString(t) << " -> " + << GetIOStatusString(i->second->GetStatus()) + << std::endl); } - + bbtkDebugMessage("change",2, + bbGetName()<<" new output status : " + << GetIOStatusString(new_output_status) + <second->SetStatus(new_output_status); } + + bbtkDebugMessageInc("process",4, + "<= BlackBox::bbComputePostProcessStatus() [" + <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(\""