示例#1
0
bool ProxyOrchestrator::start()
{
    if (serverSource == nullptr || clientSource == nullptr ) {
        return false;
    }

    emit startChildren();

    return true;
}
示例#2
0
void SortEngine::stepForward()
{
  int status;
  if(_inputVector.size()==1)
    {
      _outputVector=_inputVector;
      _saveQVectorToPipe(_fdWrite, _outputVector);
      _interface->setOutputVector(_outputVector);
      QApplication::quit();
    }
  else
    {
      switch(_count)
	{
	case 0:
	  startChildren();
	  wait(&status);
	  wait(&status);
	  _count++;
	  break;

	case 1:
	  _readSonsResults();
	  _printSonsResults();
	  _count++;
	  break;

	case 2:
	  _sortSonsResults();
	  _interface->setOutputVector(_outputVector);
	  if(!_final)
	    {
	      _saveQVectorToPipe(_fdWrite, _outputVector);
	      _count++;
	    }
	  else
	    _count=4;
	  break;
	  
	case 3:
	  QApplication::quit();
	  break;
	}
    }
}
SingleSourceOrchestrator::SingleSourceOrchestrator(BlocksSource *source, QObject *parent) :
    SourcesOrchestatorAbstract(parent),
    source(source)
{
    hasDirection = true;
    if (source != nullptr) {

        forwarder = source->isReflexive();

        connect(this, SIGNAL(startChildren()), source, SLOT(startListening()), Qt::QueuedConnection);
        connect(this, SIGNAL(stopChildren()), source, SLOT(stopListening()), Qt::QueuedConnection);
        connect(this, SIGNAL(resetChildren()), source, SLOT(restart()), Qt::QueuedConnection);
        connect(source, SIGNAL(started()), SIGNAL(started()));
        connect(source, SIGNAL(stopped()), SIGNAL(stopped()));
        connect(source, SIGNAL(destroyed(QObject*)), this, SLOT(onBlockSourceDestroyed()));
        connect(source, SIGNAL(blockReceived(Block*)), SLOT(onBlockReceived(Block*)));
        connect(source, SIGNAL(reflexionChanged(bool)), this, SLOT(sourceReflexionChanged(bool)));
        connect(source, SIGNAL(log(QString,QString,Pip3lineConst::LOGLEVEL)), this, SIGNAL(log(QString,QString,Pip3lineConst::LOGLEVEL)), Qt::QueuedConnection);
        connect(source, SIGNAL(updated()), this, SIGNAL(connectionsChanged()), Qt::QueuedConnection);
        connect(source, SIGNAL(newConnection(BlocksSource*)), this, SIGNAL(connectionsChanged()), Qt::QueuedConnection);
        connect(source, SIGNAL(connectionClosed(BlocksSource*)), this, SIGNAL(connectionsChanged()), Qt::QueuedConnection);
    }