+
+
+
+
+
+
+ //=========================================================================
+ /// Main processing method of the box.
+ void BlackBox::bbExecute(bool force)
+ {
+ bbtkBlackBoxDebugMessage("process",2,
+ "=> BlackBox::bbExecute("<<(int)force<<")"
+ <<std::endl);
+
+ // If already executing : return
+ /*
+ if (bbGetExecuting())
+ {
+ bbtkBlackBoxDebugMessage("process",2,
+ " -> already executing : abort"<<std::endl);
+ return;
+ }
+ */
+
+ // If execution frozen : return
+ if (bbGlobalGetFreezeExecution())
+ {
+ bbtkBlackBoxDebugMessage("process",2,
+ " -> FreezeExecution global flag is 'true' : abort execution"<<std::endl);
+ }
+
+ BBTK_BUSY_CURSOR;
+
+ // If force is true then update is triggered even if the box is UPTODATE
+ // if (force) bbSetModifiedStatus();
+
+ if ( bbBoxProcessModeIsManual() )
+ {
+ bbLetRecursiveExecuteManualMode = true;
+ }
+
+
+ // Calls the main recursive execution method
+ bbRecursiveExecute(Connection::Pointer());
+
+
+ if ( bbBoxProcessModeIsManual() )
+ {
+ bbLetRecursiveExecuteManualMode = false;
+ }
+
+
+ bbtkBlackBoxDebugMessage("process",2,
+ "<= BlackBox::bbExecute()"
+ <<std::endl);
+ }
+ //=========================================================================
+
+ //=========================================================================
+ void BlackBox::bbInitializeProcessing()
+ {
+ if (!bbmInitialized)
+ {
+ bbtkBlackBoxDebugMessage("process",2,"** Initialize processing"
+ <<std::endl);
+ this->bbRecursiveInitializeProcessing();
+ bbmInitialized = true;
+ }
+ }
+ //=========================================================================
+
+ //=========================================================================
+ void BlackBox::bbFinalizeProcessing()
+ {
+ if (bbmInitialized)
+ {
+ bbtkBlackBoxDebugMessage("process",2,"** Finalize processing"
+ <<std::endl);
+ this->bbRecursiveFinalizeProcessing();
+ bbmInitialized = false;
+ }
+ }
+ //=========================================================================
+
+
+ //=========================================================================
+ void BlackBox::bbRecursiveExecute( Connection::Pointer caller )
+ {
+ bbtkBlackBoxDebugMessage("process",3,
+ "=> BlackBox::bbRecursiveExecute("
+ <<(caller?caller->GetFullName():"0")<<")"
+ <<std::endl);
+
+ // If already executing : return
+ if (bbGetExecuting())
+ {
+ bbtkBlackBoxDebugMessage("process",3,
+ " -> already executing : abort"<<std::endl);
+ return;
+ }
+
+ // If not initialized do it
+ bbInitializeProcessing();
+
+ bbSetExecuting(true);
+ bool wasExecuting = bbGlobalGetSomeBoxExecuting();
+ bbGlobalSetSomeBoxExecuting(true);
+
+ // Creates the window if the black box has one
+ this->bbCreateWindow();
+
+ // Updates its inputs
+
+// IOStatus s;
+ IOStatus s=UPTODATE;
+// IOStatus s=OUTOFDATE;
+// IOStatus s=MODIFIED;
+
+
+ if ( ( bbBoxProcessModeIsManual()==false ) ||
+ ( (bbBoxProcessModeIsManual()==true) && (bbLetRecursiveExecuteManualMode==true) ) )
+ {
+ s = bbUpdateInputs();
+ }
+
+ if ( (s != UPTODATE) || bbBoxProcessModeIsAlways() )
+ {
+ // Displays the window (WxBlackbox)
+ // bbShowWindow(caller);
+
+ // Actual processing (virtual)
+ if ( ( bbBoxProcessModeIsManual()==false ) ||
+ ( (bbBoxProcessModeIsManual()==true)&&(bbLetRecursiveExecuteManualMode==true) )
+ )
+ {
+// printf("EED BlackBox::bbRecursiveExecute bbProcess start %s \n", bbGetFullName().c_str() );
+ this->bbProcess();
+// printf("EED BlackBox::bbRecursiveExecute bbProcess end %s \n", bbGetFullName().c_str() );
+ } // Manual analysis
+
+//EED ups if ((bbBoxProcessModeIsManual()==true) && (bbLetRecursiveExecuteManualMode==false))
+//EED ups {
+//EED ups bbSignalOutputModification(true);
+//EED ups }
+
+
+ // 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: "
+ <<"all inputs are Up-to-date but output '"
+ <<o->first<<"' is Out-of-date ???");
+ }
+ } // for
+
+ bbtkBlackBoxDebugMessage("process",3," -> Up-to-date : nothing to do"
+ <<std::endl);
+ } // if
+
+ // Shows the window if the black box has one
+ this->bbShowWindow();
+
+
+ bbtkBlackBoxDebugMessage("process",3,
+ "<= BlackBox::bbRecursiveExecute()"
+ <<std::endl);
+
+ bbSetExecuting(false);
+ bbGlobalSetSomeBoxExecuting(wasExecuting);
+
+ return;
+ }
+ //=========================================================================
+
+
+
+
+