Ejemplo n.º 1
0
void ConfiguredThreadedRT::start()
{
	assert(isConfigurated() && "The configurated threaded runtime should be configured before starting.");
	if (isConfigurated())
	{
		for (int i = 0; i < poolManager->getNumberOfConfigurations(); i++)
		{
			poolManager->getPool(i)->setWorkersCounter(&worker);
			poolManager->getPool(i)->setStopReqest(&stop_request_cond);
			poolManager->getPool(i)->startPool(poolManager->calculateNOfThreads(i, numberOfObjects[i]));
		}
	}
}
Ejemplo n.º 2
0
void V4LCamera::configure() {
    CaptureDevice configuration = _configEngine->getConfiguration();
    _deviceName = configuration.deviceName;
    struct v4l2_format config = configuration.configuration;
    if (config.fmt.pix.width != _fmt.fmt.pix.width || config.fmt.pix.height != _fmt.fmt.pix.height) {
        settingsDialogRequest = false;
        _fmt = config;
        frameSizeList.clear();
    }
    if (!isConfigurated()) {
#ifdef _DEBUG_CAPTURE_THREADS
        qDebug() << "[CAMERA_THREAD::V4L_CAMERA] - configure() - No Configuration, Config Dialog Invoked! - Current Configuration: (" << \
                      _deviceName << ", " << _fmt.fmt.pix.width << "x" << _fmt.fmt.pix.height << ")";
#endif //_DEBUG_CAPTURE_THREADS
//        qDebug() << "Status:" << _configEngine->getDialogStatus() << _configEngine->getDialogStatus();
        settingsDialogRequest = false;
        _configEngine->resetConfiguration();
    }
    else {
        _startAction->setEnabled(true);
        if (frameSizeList.isEmpty()) {
            frameSizeList.clear();
            frameSizeList = _configEngine->getSupportedFrameSizes();
            QString selectedSize = QString("%1x%2").arg(_configEngine->getConfiguration().configuration.fmt.pix.width).arg(_configEngine->getConfiguration().configuration.fmt.pix.height);
            frameSizeList.swap(frameSizeList.indexOf(selectedSize), 0);
            } else {
                _fmt = _configEngine->getConfiguration().configuration;
            }
            emit configurated();
          }
    settingsDialogRequest = true;
}
Ejemplo n.º 3
0
void ThreadPoolManager::recalculateThreads(int id,int n)
{
	if (!isConfigurated()) {
		abort();
	}
	
	configuration->getThreadPool(id)->modifiedThreads(calculateNOfThreads(id,n));
}
Ejemplo n.º 4
0
StateMachineThreadPool* ThreadPoolManager::getPool(int id)
{
	if (!isConfigurated()) {
		abort();
	}
	
	return configuration->getThreadPool(id);
}
Ejemplo n.º 5
0
int ThreadPoolManager::getNumberOfConfigurations()
{
	if (!isConfigurated()) {
		abort();
	}
	
	return ((int)configuration->getNumberOfConfigurations());
}
Ejemplo n.º 6
0
void ThreadPoolManager::enqueObject(IStateMachine* sm)
{
	if (!isConfigurated()) {
		abort();
	}
	
	int objectId = sm->getPoolId();
	configuration->getThreadPool(objectId)->enqueObject(sm);
}
Ejemplo n.º 7
0
int ThreadPoolManager::calculateNOfThreads(int id, int n)
{
	if (!isConfigurated()) {
		abort();
	}
	
	LinearFunction function = *(configuration->getFunction(id));
	int max = configuration->getMax(id);
	return std::min(function(n),max);
	
}
Ejemplo n.º 8
0
ThreadPoolManager::~ThreadPoolManager()
{
	if(isConfigurated())
		delete configuration;
}