コード例 #1
0
void iAFoamCharacterizationItemBinarization::execute()
{
	setExecuting(true);

	QTime t;
	t.start();

	switch (m_eItemFilterType)
	{
		case iftBinarization:
		executeBinarization();
		break;

		default:
		executeOtzu(); 
		break;
	}

	if (m_bIsMask)
	{
		m_pImageDataMask->DeepCopy(m_pImageData);
		m_pImageDataMask->CopyInformationFromPipeline(m_pImageData->GetInformation());
	}

	m_dExecuteTime = 0.001 * (double)t.elapsed();

	setExecuting(false);
}
コード例 #2
0
void BtAbstractDelegate::completeDelegateExecution(int error)
{
    BOstraceFunctionEntryExt( DUMMY_DEVLIST, this, error);
    setExecuting(false);
    emit delegateCompleted(error, this);
    BOstraceFunctionExit0( DUMMY_DEVLIST );
}
コード例 #3
0
void BtDelegateInquiry::exec( const QVariant& params )
{
    BOstraceFunctionEntry1( DUMMY_DEVLIST, this );
    Q_UNUSED(params);
    BTUI_ASSERT_X(!isExecuting(), "BtDelegateInquiry::exec", "operation ongoing!");
    bool ok(false);
    
    setExecuting(true);
    // Inquiry needs BT to be on.
    if(!isBtPowerOn()) {
        mPowerDelegate = new BtDelegatePower(settingModel(), deviceModel(), this);
        ok = connect(
                mPowerDelegate, SIGNAL(delegateCompleted(int,BtAbstractDelegate*)), 
            this, SLOT(handleManagePowerCompleted(int)));
        if (ok ) {
            mPowerDelegate->exec(QVariant(BtPowerOn));
        }
    } else {
コード例 #4
0
ファイル: RActiveSessions.hpp プロジェクト: AndreasGr/rstudio
 void endSession()
 {
    setLastUsed();
    setRunning(false);
    setExecuting(false);
 }
コード例 #5
0
bool rConsoleRead(const std::string& prompt,
                  bool addToHistory,
                  rstudio::r::session::RConsoleInput* pConsoleInput)
{
   // this is an invalid state in a forked (multicore) process
   if (main_process::wasForked())
   {
      LOG_WARNING_MESSAGE("rConsoleRead called in forked processs");
      return false;
   }

   // r is not processing input
   setExecuting(false);

   if (!s_consoleInputBuffer.empty())
   {
      *pConsoleInput = s_consoleInputBuffer.front();
      s_consoleInputBuffer.pop();
   }
   // otherwise prompt and wait for console_input from the client
   else
   {
      // fire console_prompt event (unless we are just starting up, in which
      // case we will either prompt as part of the response to client_init or
      // we shouldn't prompt at all because we are resuming a suspended session)
      if (init::isSessionInitialized())
         consolePrompt(prompt, addToHistory);

      // wait for console_input
      json::JsonRpcRequest request ;
      bool succeeded = http_methods::waitForMethod(
                        kConsoleInput,
                        boost::bind(consolePrompt, prompt, addToHistory),
                        boost::bind(canSuspend, prompt),
                        &request);

      // exit process if we failed
      if (!succeeded)
         return false;

      // extract console input. if there is an error during extraction we log it
      // but still return and empty string and true (returning false will cause R
      // to abort)
      Error error = extractConsoleInput(request);
      if (error)
      {
         LOG_ERROR(error);
         *pConsoleInput = rstudio::r::session::RConsoleInput("", "");
      }
      *pConsoleInput = s_consoleInputBuffer.front();
      s_consoleInputBuffer.pop();
   }

   // fire onBeforeExecute and onConsoleInput events if this isn't a cancel
   if (!pConsoleInput->cancel)
   {
      module_context::events().onBeforeExecute();
      module_context::events().onConsoleInput(pConsoleInput->text);
   }

   // we are about to return input to r so set the flag indicating that state
   setExecuting(true);

   // ensure that output resulting from this input goes to the correct console
   if (clientEventQueue().setActiveConsole(pConsoleInput->console))
   {
      module_context::events().onActiveConsoleChanged(pConsoleInput->console,
            pConsoleInput->text);
   }

   ClientEvent promptEvent(client_events::kConsoleWritePrompt, prompt);
   clientEventQueue().add(promptEvent);
   enqueueConsoleInput(*pConsoleInput);

   // always return true (returning false causes the process to exit)
   return true;
}