- //=========================================================================
- /// Main processing method of the box.
- IOStatus AtomicBlackBox::bbBackwardUpdate( Connection::Pointer caller )
- {
- bbtkDebugMessageInc("process",3,
- "=> AtomicBlackBox::bbBackwardUpdate("
- <<(caller?caller->GetFullName():"0")<<") ["
- <<bbGetFullName()<<"]"<<std::endl);
-
- // If already executing : return
- if (bbGetExecuting())
- {
- bbtkDebugMessage("process",3,
- " -> already executing : bailing out"<<std::endl);
- return bbGetStatus();
- }
- bbSetExecuting(true);
- bool wasExecuting = bbGlobalGetSomeBoxExecuting();
- bbGlobalSetSomeBoxExecuting(true);
-
- bbtkDebugMessage("process",5,"Initial Status = "<<bbGetStatus()
- <<std::endl);
- bbtkDebugMessage("process",5,"BoxProcessMode = "
- <<bbGetInputBoxProcessMode()<<std::endl);
-
-
- if ( ( bbGetStatus() == MODIFIED ) ||
- ( bbBoxProcessModeIsAlways() ) )
- {
-
- // bbSetStatus(UPDATING);
-
- // Updates its inputs
- IOStatus s = bbUpdateInputs();
-
- bbtkDebugMessage("process",6,"=> AtomicBlackBox::bbBackwardUpdate("
- <<(caller?caller->GetFullName():"0")<<") ["
- <<bbGetFullName()<<"] : Inputs post-update status = "<<s<<std::endl);
- // If all inputs are in UPTODATE post-update status
- // and mProcessMode is not "Always"
- // then the box is now UPTODATE
- IOStatus new_status;
- if ( ( s == UPTODATE ) &&
- ( ! bbBoxProcessModeIsAlways() ) )
- {
- new_status = UPTODATE;
- }
- else
- {
- // else it remains MODIFIED
- new_status = MODIFIED;
- }
- bbSetStatus(new_status);
-
- // User process
- bbProcess();
-
- // Displays the window (WxBlackbox)
- bbShowWindow(caller);
-
-
- }
- else
- {
- bbtkDebugMessage("process",5,"Up-to-date : nothing to do"<<std::endl);
- }
-
- bbtkDebugMessage("process",5,"=> AtomicBlackBox::bbBackwardUpdate("
- <<(caller?caller->GetFullName():"0")<<") ["
- <<bbGetFullName()<<"] : Final Status = "
- <<bbGetStatus()<<std::endl);
- bbtkDebugMessage("process",3,
- "<= AtomicBlackBox::bbBackwardUpdate() ["
- <<bbGetFullName()<<"]"<<std::endl);
-
- bbSetExecuting(false);
- bbGlobalSetSomeBoxExecuting(wasExecuting);
-
- return bbGetStatus();
-
- }
- //=========================================================================