void EnabledModuleList::addModuleOfferingToCopy (const File& f) { ModuleDescription m (f); if (! m.isValid()) m = ModuleDescription (f.getChildFile (ModuleDescription::getManifestFileName())); if (! m.isValid()) { AlertWindow::showMessageBoxAsync (AlertWindow::InfoIcon, "Add Module", "This wasn't a valid module folder!"); return; } if (isModuleEnabled (m.getID())) { AlertWindow::showMessageBoxAsync (AlertWindow::InfoIcon, "Add Module", "The project already contains this module!"); return; } addModule (m.manifestFile, areMostModulesCopiedLocally()); }
void ScimSetupWindow::load() { removeAllModules(); //first we load all plugins and retrieve a list of kcmodules which belong to //disabled plugins QStringList disabledModules; QValueList<SkimPluginInfo *> plugins = m_mc->availablePlugins(); for (QValueList<SkimPluginInfo *>::ConstIterator it = plugins.begin(); it != plugins.end(); ++it ) { if( (*it)->pluginName() == "skimplugin_scim") //all kcmodules for this plugin should always be shown continue; if( !( *it )->isPluginEnabled() ) { const QValueList< KService::Ptr > & kcms = ( *it )->kcmServices(); for(uint i=0; i<kcms.size(); i++) disabledModules << kcms[i]->library(), kdDebug() << kcms[i]->library() << " is disabled\n"; } } ScimSetupWindowPrivate::SetupDirRespType::const_iterator pit; for ( pit = d->dirReposition.begin(); pit != d->dirReposition.end(); ++pit ) { setFolderIcon((*pit).second.path, SmallIcon( (*pit).second.iconfile, IconSize( KIcon::Small ) )); for( ScimSetupWindowPrivate::WeightsMap::const_iterator it = (*pit).second.sortedMods.begin(); it != (*pit).second.sortedMods.end(); ++it ) { if( !disabledModules.contains(d->mods[(*it).second].library()) ) addModule(d->mods[(*it).second], (*pit).second.path); } } unfoldTreeList(); }
ModuleLoader::ModuleLoader() { addModule("", new DefaultModule); }
void CmdPartDesignBody::activated(int iMsg) { Q_UNUSED(iMsg); if ( !PartDesignGui::assureModernWorkflow( getDocument() ) ) return; App::Part *actPart = PartDesignGui::getActivePart (); App::Part* partOfBaseFeature = nullptr; std::vector<App::DocumentObject*> features = getSelection().getObjectsOfType(Part::Feature::getClassTypeId()); App::DocumentObject* baseFeature = nullptr; bool viewAll = features.empty(); if (!features.empty()) { if (features.size() == 1) { baseFeature = features[0]; if ( baseFeature->isDerivedFrom ( PartDesign::Feature::getClassTypeId() ) && PartDesign::Body::findBodyOf ( baseFeature ) ) { // Prevent creating bodies based on features already belonging to other bodies QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Bad base feature"), QObject::tr("Body can't be based on a PartDesign feature.")); baseFeature = nullptr; } else if (PartDesign::Body::findBodyOf ( baseFeature )){ QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Bad base feature"), QObject::tr("%1 already belongs to a body, can't use it as base feature for another body.") .arg(QString::fromUtf8(baseFeature->Label.getValue()))); baseFeature = nullptr; } else if ( baseFeature->isDerivedFrom ( Part::BodyBase::getClassTypeId() ) ) { // Prevent creating bodies based on bodies QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Bad base feature"), QObject::tr("Body can't be based on another body.")); baseFeature = nullptr; } else { partOfBaseFeature = App::Part::getPartOfObject(baseFeature); if (partOfBaseFeature != 0 && partOfBaseFeature != actPart){ //prevent cross-part mess QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Bad base feature"), QObject::tr("Base feature (%1) belongs to other part.") .arg(QString::fromUtf8(baseFeature->Label.getValue()))); baseFeature = nullptr; }; } } else { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Bad base feature"), QObject::tr("Body may be based no more than on one feature.")); return; } } openCommand("Add a Body"); std::string bodyName = getUniqueObjectName("Body"); // add the Body feature itself, and make it active doCommand(Doc,"App.activeDocument().addObject('PartDesign::Body','%s')", bodyName.c_str()); if (baseFeature) { if (partOfBaseFeature){ //withdraw base feature from Part, otherwise visibility mandess results doCommand(Doc,"App.activeDocument().%s.removeObject(App.activeDocument().%s)", partOfBaseFeature->getNameInDocument(), baseFeature->getNameInDocument()); } doCommand(Doc,"App.activeDocument().%s.BaseFeature = App.activeDocument().%s", bodyName.c_str(), baseFeature->getNameInDocument()); } addModule(Gui,"PartDesignGui"); // import the Gui module only once a session doCommand(Gui::Command::Gui, "Gui.activeView().setActiveObject('%s', App.activeDocument().%s)", PDBODYKEY, bodyName.c_str()); // Make the "Create sketch" prompt appear in the task panel doCommand(Gui,"Gui.Selection.clearSelection()"); doCommand(Gui,"Gui.Selection.addSelection(App.ActiveDocument.%s)", bodyName.c_str()); if (actPart) { doCommand(Doc,"App.activeDocument().%s.addObject(App.ActiveDocument.%s)", actPart->getNameInDocument(), bodyName.c_str()); } // The method 'SoCamera::viewBoundingBox' is still declared as protected in Coin3d versions // older than 4.0. #if COIN_MAJOR_VERSION >= 4 // if no part feature was there then auto-adjust the camera if (viewAll) { Gui::Document* doc = Gui::Application::Instance->getDocument(getDocument()); Gui::View3DInventor* view = doc ? qobject_cast<Gui::View3DInventor*>(doc->getActiveView()) : nullptr; if (view) { SoCamera* camera = view->getViewer()->getCamera(); SbViewportRegion vpregion = view->getViewer()->getViewportRegion(); float aspectratio = vpregion.getViewportAspectRatio(); float size = Gui::ViewProviderOrigin::defaultSize(); SbBox3f bbox; bbox.setBounds(-size,-size,-size,size,size,size); camera->viewBoundingBox(bbox, aspectratio, 1.0f); } } #endif updateActive(); }
void ModuleState::addConvertFloatToInt(FormatCode input, FormatCode output, const PCMInfo &inputMapping, const PCMInfo &outputMapping) { addModule(new ConvertFloatToIntClip(input, output, inputMapping, outputMapping)); }
void ModuleState::addConvertIntToFloat(FormatCode input, FormatCode output) { addModule(new ConvertIntToFloat(input, output)); }
status ModuleState::arrange(AFfilehandle file, Track *track) { bool isReading = file->m_access == _AF_READ_ACCESS; AudioFormat in, out; if (isReading) { in = track->f; out = track->v; } else { in = track->v; out = track->f; } FormatCode infc = getFormatCode(in); FormatCode outfc = getFormatCode(out); if (infc == kUndefined || outfc == kUndefined) return AF_FAIL; m_chunks.clear(); m_chunks.push_back(new Chunk()); m_chunks.back()->f = in; m_modules.clear(); if (isReading) { addModule(m_fileModule.get()); addModule(m_fileRebufferModule.get()); } // Convert to native byte order. if (in.byteOrder != _AF_BYTEORDER_NATIVE) { size_t bytesPerSample = in.bytesPerSample(!isReading); if (bytesPerSample > 1 && in.compressionType == AF_COMPRESSION_NONE) addModule(new SwapModule()); else in.byteOrder = _AF_BYTEORDER_NATIVE; } // Handle 24-bit integer input format. if (in.isInteger() && in.bytesPerSample(false) == 3) { if (isReading || in.compressionType != AF_COMPRESSION_NONE) addModule(new Expand3To4Module(in.isSigned())); } // Make data signed. if (in.isUnsigned()) addModule(new ConvertSign(infc, false)); in.pcm = m_chunks.back()->f.pcm; // Reverse the unsigned shift for output. if (out.isUnsigned()) { const double shift = intmappings[outfc]->minClip; out.pcm.intercept += shift; out.pcm.minClip += shift; out.pcm.maxClip += shift; } // Clip input samples if necessary. if (in.pcm.minClip < in.pcm.maxClip && !isTrivialIntClip(in, infc)) addModule(new Clip(infc, in.pcm)); bool alreadyClippedOutput = false; bool alreadyTransformedOutput = false; // Perform range transformation if input and output PCM mappings differ. bool transforming = (in.pcm.slope != out.pcm.slope || in.pcm.intercept != out.pcm.intercept) && !(isTrivialIntMapping(in, infc) && isTrivialIntMapping(out, outfc)); // Range transformation requires input to be floating-point. if (isInteger(infc) && transforming) { if (infc == kInt32 || outfc == kDouble || outfc == kInt32) { addConvertIntToFloat(infc, kDouble); infc = kDouble; } else { addConvertIntToFloat(infc, kFloat); infc = kFloat; } } if (transforming && infc == kDouble && isFloat(outfc)) addModule(new Transform(infc, in.pcm, out.pcm)); // Add format conversion if needed. if (isInteger(infc) && isInteger(outfc)) addConvertIntToInt(infc, outfc); else if (isInteger(infc) && isFloat(outfc)) addConvertIntToFloat(infc, outfc); else if (isFloat(infc) && isInteger(outfc)) { addConvertFloatToInt(infc, outfc, in.pcm, out.pcm); alreadyClippedOutput = true; alreadyTransformedOutput = true; } else if (isFloat(infc) && isFloat(outfc)) addConvertFloatToFloat(infc, outfc); if (transforming && !alreadyTransformedOutput && infc != kDouble) addModule(new Transform(outfc, in.pcm, out.pcm)); if (in.channelCount != out.channelCount) addModule(new ApplyChannelMatrix(infc, isReading, in.channelCount, out.channelCount, in.pcm.minClip, in.pcm.maxClip, track->channelMatrix)); // Perform clipping if necessary. if (!alreadyClippedOutput) { if (out.pcm.minClip < out.pcm.maxClip && !isTrivialIntClip(out, outfc)) addModule(new Clip(outfc, out.pcm)); } // Make data unsigned if necessary. if (out.isUnsigned()) addModule(new ConvertSign(outfc, true)); // Handle 24-bit integer output format. if (out.isInteger() && out.bytesPerSample(false) == 3) { if (!isReading || out.compressionType != AF_COMPRESSION_NONE) addModule(new Compress4To3Module(out.isSigned())); } if (out.byteOrder != _AF_BYTEORDER_NATIVE) { size_t bytesPerSample = out.bytesPerSample(isReading); if (bytesPerSample > 1 && out.compressionType == AF_COMPRESSION_NONE) addModule(new SwapModule()); else out.byteOrder = _AF_BYTEORDER_NATIVE; } if (!isReading) { addModule(m_fileRebufferModule.get()); addModule(m_fileModule.get()); } return AF_SUCCEED; }
MainWindow::MainWindow() { setWindowTitle(tr("Peanuts")); currentLiveState = false; livescreen = new LiveScreen; QShortcut *quitShortcut = new QShortcut(QKeySequence(Qt::Key_Escape), this); QPushButton *settingsButton = new QPushButton("Settings"); QFrame *divider = new QFrame(); divider->setFrameShape(QFrame::VLine); clearButton = new QPushButton("Clear"); clearButton->setCheckable(true); blackoutButton = new QPushButton("Blackout"); blackoutButton->setCheckable(true); goLiveButton = new QPushButton("Go Live"); goLiveButton->setCheckable(true); QVBoxLayout *layout = new QVBoxLayout(this); QHBoxLayout *toolBar = new QHBoxLayout(); toolBar->addWidget(settingsButton); toolBar->addWidget(divider); toolBar->addWidget(clearButton); toolBar->addWidget(blackoutButton); toolBar->addWidget(goLiveButton); liveSelectButtons = new QHBoxLayout(); liveSelectGroup = new QButtonGroup(); QHBoxLayout *mainArea = new QHBoxLayout(); tehTabs = new QTabWidget(); mainArea->addWidget(tehTabs); addModule(new ScoresModule); addModule(new PrizeBoardModule); addModule(new SongsModule); addModule(new BalloonsModule); addModule(new NumberChoiceModule); addModule(new ThemeCutModule); addModule(new QuestionsModule); addModule(new BuzzerModule); liveSelectButtons->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding)); layout->addLayout(toolBar); layout->addLayout(liveSelectButtons); layout->addLayout(mainArea); setLayout(layout); /*QPixmap *tehballon = new QPixmap("BalloonRed.png"); QWidget *balloons = new QWidget(); balloons->render(tehballon); balloons->setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::SplashScreen); balloons->show(); QPushButton *buttonthing = new QPushButton("Stuff", balloons); buttonthing->show();*/ // Decided that this stuff is best down here as things go wrong if objects haven't been created before I try to connect them connect(goLiveButton, SIGNAL(clicked()), this, SLOT(toggleLiveScreen())); connect(blackoutButton, SIGNAL(clicked()), livescreen, SLOT(blackoutWindow())); connect(clearButton, SIGNAL(clicked()), livescreen, SLOT(clearWindow())); connect(this, SIGNAL(isLiveSignal(bool)), goLiveButton, SLOT(setChecked(bool))); connect(livescreen, SIGNAL(liveClosed()), this, SLOT(closeLiveScreen())); connect(quitShortcut, SIGNAL(activated()), this, SLOT(closeLiveScreen())); connect(liveSelectGroup, SIGNAL(buttonClicked(int)), livescreen, SLOT(switchLivescreen(int))); }
/****************************************************************************** * AUTHOR : Thanigai * DATE : 29-JUL-2005 * NAME : createShapeRecognizer * DESCRIPTION : create an instance of shape recognizer object and call * initialize function. Also loads the model data. * ARGUMENTS : strProjectName - project name; strProfileName - profile name * outShapeRecognizerPtr - return shape recognizer object * RETURNS : if success returns 0 or if fails returns error code * NOTES : * CHANGE HISTROY * Author Date Description of change ******************************************************************************/ int LTKLipiEngineModule::createShapeRecognizer(const string& strProjName, const string& strProfName, LTKShapeRecognizer** outShapeRecoObj) { LOG(LTKLogger::LTK_LOGLEVEL_INFO)<< "Entering: LTKLipiEngineModule::createShapeRecognizer()"<<endl; int errorCode; int iResult = 0; void *dllHandler = NULL; string recognizerName = ""; string strProjectName = strProjName; string strProfileName = strProfName; //Validating Project names and profile names errorCode = validateProjectAndProfileNames(strProjectName, strProfileName, "SHAPEREC", recognizerName); if (errorCode != SUCCESS) { LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << getErrorMessage(errorCode) << "LTKLipiEngineModule::createShapeRecognizer()"<<endl; LTKReturnError(errorCode); } #if 0 /* Android port: commenting the load of shared objects and mapping of functions * as there is only one shared object. */ // Load the dlaal of the shape recognizer errorCode = loadRecognizerDLL(recognizerName, &dllHandler); if( errorCode!= SUCCESS) { LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << getErrorMessage(errorCode) << "LTKLipiEngineModule::createShapeRecognizer()"<<endl; LTKReturnError(errorCode); } // Map Algo DLL functions... errorCode = mapShapeAlgoModuleFunctions(dllHandler); if( errorCode!= SUCCESS) { LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << getErrorMessage(errorCode) << "LTKLipiEngineModule::createShapeRecognizer()"<<endl; LTKReturnError(errorCode); } #endif // Create control Info object char currentVersion[VERSION_STR_LEN]; int iMajor, iMinor, iBugfix; getToolkitVersion(iMajor, iMinor, iBugfix); sprintf(currentVersion, "%d.%d.%d", iMajor, iMinor, iBugfix); LTKControlInfo controlInfo; controlInfo.lipiRoot = m_strLipiRootPath; controlInfo.projectName = strProjectName; controlInfo.profileName = strProfileName; controlInfo.toolkitVersion = currentVersion; // Call recognition module's createShapeRecognizer(); #if 0 errorCode = module_createShapeRecognizer(controlInfo,outShapeRecoObj); #endif /* Android port : calling the function directly instead of the mapped function. * createShapeRecognizer() is used in LTKLipiEngineModule class and NN recognizer * module. To avoid compilation errors createShapeRecognizer() in NN recognizer is being * renamed to createShapeRecognizer_Dll. */ errorCode = createShapeRecognizer_Dll(controlInfo,outShapeRecoObj); if(errorCode !=SUCCESS) { LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< getErrorMessage(ECREATE_SHAPEREC) << " "<< recognizerName << "LTKLipiEngineModule::createShapeRecognizer()"<<endl; #if 0 /* Android port : there is no dll to unload */ m_OSUtilPtr->unloadSharedLib(dllHandler); #endif LTKReturnError(ECREATE_SHAPEREC); } #if 0 /* Android port : dllHandler is null */ addModule(*outShapeRecoObj, dllHandler); #endif LOG(LTKLogger::LTK_LOGLEVEL_INFO)<< "Exiting: LTKLipiEngineModule::createShapeRecognizer()"<<endl; return SUCCESS; }
bool VM::runProgram(gc<String> path) { // Remember where the program is so we can import modules from there. programDir_ = path::dir(path::real(path)); // Traverse the import graph. ErrorReporter reporter; addModule(reporter, NULL, path); if (reporter.numErrors() > 0) return false; // Sort the modules by their imports so that dependencies are run before // modules that depend on them. // See: http://en.wikipedia.org/wiki/Topological_sorting // Clone the import graph so we can destructively modify it. // TODO(bob): This does lots of array copies since ImportGraph stores an // array directly. Do something smarter here. Array<ImportGraph> graph; for (int i = 0; i < modules_.count(); i++) { graph.add(ImportGraph(modules_[i])); } Array<Module*> modules; while (graph.count() > 0) { bool madeProgress = false; for (int i = 0; i < graph.count(); i++) { // See if all of this module's imports are accounted for. if (graph[i].imports.count() == 0) { // They are, so it's ready to process. modules.add(graph[i].module); // And now everything that imports it doesn't have to worry about it // anymore. for (int j = 0; j < graph.count(); j++) { for (int k = 0; k < graph[j].imports.count(); k++) { if (graph[j].imports[k] == graph[i].module) { graph[j].imports.removeAt(k); k--; } } } graph.removeAt(i); i--; madeProgress = true; } } // Bail if there is an import cycle. // TODO(bob): Better error-handling. if (!madeProgress) return false; } // Compile all modules before running any of them. for (int i = 0; i < modules.count(); i++) { if (!modules[i]->compile(*this)) return false; } scheduler_.run(modules); return true; }
void VoreenApplication::initialize() { if (initialized_) { if (tgt::LogManager::isInited()) LWARNING("init() Application already initialized. Skip."); return; } // // Command line parser // prepareCommandParser(); cmdParser_.execute(); // // tgt initialization // tgt::InitFeature::Features featureset; if (appFeatures_ & APP_CONSOLE_LOGGING) featureset = tgt::InitFeature::ALL; else featureset = tgt::InitFeature::Features(tgt::InitFeature::ALL &~ tgt::InitFeature::LOG_TO_CONSOLE); tgt::init(featureset, logLevel_); // detect documents path first, needed for log file #ifdef WIN32 TCHAR szPath[MAX_PATH]; // get "my documents" directory if (SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, 0, szPath) == S_OK) documentsPath_ = szPath; #else if (getenv("HOME") != 0) documentsPath_ = getenv("HOME"); #endif // HTML logging if (appFeatures_ & APP_HTML_LOGGING) { #ifdef VRN_DEPLOYMENT LogMgr.reinit(documentsPath_); #endif if (logFile_.empty()) logFile_ = name_ + "-log.html"; // add a file logger tgt::Log* log = new tgt::HtmlLog(logFile_); log->addCat("", true, logLevel_); LogMgr.addLog(log); } // log version VoreenVersion::logAll("voreen.VoreenApplication"); #ifdef VRN_DEPLOYMENT LINFO("Deployment build."); #endif // // Path detection // // detect base path based on program location string prog = cmdParser_.getProgramPath(); basePath_ = "."; // cut path from program location string::size_type p = prog.find_last_of("/\\"); if (p != string::npos) { basePath_ = prog.substr(0, p); prog = prog.substr(p + 1); } // try to find base path starting at program path basePath_ = tgt::FileSystem::absolutePath(findBasePath(basePath_)); LINFO("Base path: " << basePath_); // mac app resources path #ifdef __APPLE__ appBundleResourcesPath_ = findAppBundleResourcesPath(); if (appBundleResourcesPath_.empty()) LERROR("Application bundle's resources path could not be detected!"); else LINFO("Application bundle's resources path: " << appBundleResourcesPath_); #endif // shader path if (appFeatures_ & APP_SHADER) { #if defined(__APPLE__) && defined(VRN_DEPLOYMENT) shaderPath_ = appBundleResourcesPath_ + "/glsl"; #else shaderPath_ = findShaderPath(basePath_); #endif } // data path if (appFeatures_ & APP_DATA) { dataPath_ = findDataPath(basePath_); cachePath_ = dataPath_ + "/cache"; temporaryPath_ = dataPath_ + "/tmp"; volumePath_ = findVolumePath(basePath_); #if defined(__APPLE__) && defined(VRN_DEPLOYMENT) fontPath_ = appBundleResourcesPath_ + "/fonts"; texturePath_ = appBundleResourcesPath_ + "/textures"; documentationPath_ = appBundleResourcesPath_ + "/doc"; #else fontPath_ = dataPath_ + "/fonts"; texturePath_ = dataPath_ + "/textures"; documentationPath_ = findDocumentationPath(basePath_); #endif } // log location of HTML log to console if ((appFeatures_ & APP_HTML_LOGGING) && !logFile_.empty()) { std::string logPath = tgt::FileSystem::absolutePath(logFile_); LINFO("HTML log file: " << logPath); } // core pseudo module is always included addModule(new CoreModule()); // // Modules // if (appFeatures_ & APP_AUTOLOAD_MODULES) { LDEBUG("Loading modules from module registration header"); addAllModules(this); if (modules_.empty()) { LWARNING("No modules loaded"); } else { std::vector<std::string> moduleNames; for (size_t i=0; i<modules_.size(); i++) moduleNames.push_back(modules_[i]->getName()); LINFO("Modules: " << strJoin(moduleNames, ", ")); } } else { LDEBUG("Module auto loading disabled"); } // init timer schedulingTimer_ = createTimer(&eventHandler_); eventHandler_.addListenerToFront(this); initialized_ = true; }
void Simulation::configure(const config::Configuration& config) { // Resize world { auto size = config.get<SizeVector>("world-size"); if (size.getWidth() == Zero || size.getHeight() == Zero) throw config::Exception("Width or height is zero!"); setWorldSize(size); } // Time step setTimeStep(config.get<units::Time>("dt")); if (config.has("length-coefficient")) { m_converter.setLengthCoefficient(config.get<RealType>("length-coefficient")); } // Set gravity setGravity(config.get("gravity", getGravity())); // Number of iterations setIterations(config.get("iterations", getIterations())); // Background color setBackgroundColor(config.get("background", getBackgroundColor())); #if CONFIG_RENDER_TEXT_ENABLE setFontColor(config.get("text-color", getBackgroundColor().inverted())); #endif #if CONFIG_RENDER_TEXT_ENABLE setFontSize(config.get("text-size", getFontSize())); #endif #if CONFIG_RENDER_TEXT_ENABLE setSimulationTimeRender(config.get("show-simulation-time", isSimulationTimeRender())); #endif #ifdef CECE_ENABLE_RENDER setVisualized(config.get("visualized", isVisualized())); #endif // Parse plugins for (auto&& pluginConfig : config.getConfigurations("plugin")) { // Returns valid pointer or throws an exception requirePlugin(pluginConfig.get("name"))->configure(*this, pluginConfig); } // Parse parameters for (auto&& parameterConfig : config.getConfigurations("parameter")) { setParameter(parameterConfig.get("name"), units::parse(parameterConfig.get("value"))); } // Register user types for (auto&& typeConfig : config.getConfigurations("type")) { addObjectType({ typeConfig.get("name"), typeConfig.get("base"), typeConfig.toMemory() }); } // Parse init for (auto&& initConfig : config.getConfigurations("init")) { const String typeName = initConfig.has("language") ? initConfig.get("language") : initConfig.get("type"); auto initializer = getPluginContext().createInitializer(typeName); if (initializer) { // Configure initializer initializer->loadConfig(*this, initConfig); // Register initializer addInitializer(std::move(initializer)); } } // Parse modules for (auto&& moduleConfig : config.getConfigurations("module")) { // Get name auto name = moduleConfig.get("name"); if (hasModule(name)) continue; const String typeName = moduleConfig.has("language") ? moduleConfig.get("language") : moduleConfig.has("type") ? moduleConfig.get("type") : name ; auto module = getPluginContext().createModule(typeName, *this); if (module) { module->loadConfig(*this, moduleConfig); addModule(std::move(name), std::move(module)); } } // Parse programs for (auto&& programConfig : config.getConfigurations("program")) { const String typeName = programConfig.has("language") ? programConfig.get("language") : programConfig.get("type"); auto program = getPluginContext().createProgram(typeName); if (program) { // Configure program program->loadConfig(*this, programConfig); // Register program addProgram(programConfig.get("name"), std::move(program)); } } // Parse objects for (auto&& objectConfig : config.getConfigurations("object")) { // Create object auto object = buildObject( objectConfig.get("class"), objectConfig.get("type", object::Object::Type::Dynamic) ); if (object) object->configure(objectConfig, *this); } if (config.has("data-out-objects-filename")) { m_dataOutObjects = makeUnique<OutFileStream>(config.get("data-out-objects-filename")); *m_dataOutObjects << "iteration;totalTime;id;typeName;posX;posY;velX;velY\n"; } }
bool processPackage( QDomDocument* list, QString path ) { QString map = findMapInDir( path ); if( map.isEmpty() ) { printf( "no map file in dir (required for parsing)\n" ); printf( "package path: " + path.toUtf8() + "\n" ); return false; } QDomElement mapElement = findPackageElement( *list, "map", map ); if( path.endsWith( "MoNav.ini" ) ) { if( !mapElement.isNull() ) { QString pHash = computePackageHash( path ); if( mapElement.attribute( "hash" ) != pHash ) { updateMap( list, &mapElement ); mapElement.setAttribute( "hash", pHash ); } else printf( "map already in list\n" ); return false; } addMap( list, map, path ); } else if( path.endsWith( ".mmm" ) ) { if( mapElement.isNull() ) addMap( list, map, path ); QString package = path.right( path.size() - path.lastIndexOf( '/' ) - 1 ); QStringList packageAttributes = package.split( "_" ); QString type = packageAttributes[0]; QString name = packageAttributes[1].replace( ".mmm", "" ); QDomElement packageElement = findPackageElement( *list, "module", name, map ); if( !packageElement.isNull() ) { QString pHash = computePackageHash( path ); if( packageElement.attribute( "hash" ) != pHash ) { updateModule( list, &packageElement ); packageElement.setAttribute( "hash", pHash ); } else printf( "package already in list\n" ); return false; } addModule( list, &mapElement, name, type, path ); } else { printf( "unrecognized package format\n" ); return false; } return true; }
CommandLineModuleManager::CommandLineModuleManager(const ProgramInfo &programInfo) : impl_(new Impl(programInfo)) { impl_->helpModule_ = new CommandLineHelpModule(impl_->modules_); addModule(CommandLineModulePointer(impl_->helpModule_)); }
Demo::Demo(App* _app) : GApplet(_app), app(_app) { manipulator = new ThirdPersonManipulator(); addModule(manipulator); }
void Project::addDefaultModules (bool shouldCopyFilesLocally) { addModule ("juce_core", shouldCopyFilesLocally); if (! isConfigFlagEnabled ("JUCE_ONLY_BUILD_CORE_LIBRARY")) { addModule ("juce_events", shouldCopyFilesLocally); addModule ("juce_graphics", shouldCopyFilesLocally); addModule ("juce_data_structures", shouldCopyFilesLocally); addModule ("juce_gui_basics", shouldCopyFilesLocally); addModule ("juce_gui_extra", shouldCopyFilesLocally); addModule ("juce_gui_audio", shouldCopyFilesLocally); addModule ("juce_cryptography", shouldCopyFilesLocally); addModule ("juce_video", shouldCopyFilesLocally); addModule ("juce_opengl", shouldCopyFilesLocally); addModule ("juce_audio_basics", shouldCopyFilesLocally); addModule ("juce_audio_devices", shouldCopyFilesLocally); addModule ("juce_audio_formats", shouldCopyFilesLocally); addModule ("juce_audio_processors", shouldCopyFilesLocally); } }
/****************************************************************************** * AUTHOR : Thanigai * DATE : 29-JUL-2005 * NAME : createWordRecognizer * DESCRIPTION : create an instance of word recognizer object and call initialize * function. Also loads the model data. * ARGUMENTS : strProjectName - project name; strProfileName - profile name * outShapeRecognizerPtr - return shape recognizer object * RETURNS : if success returns 0 or if fails returns error code * NOTES : * CHANGE HISTROY * Author Date Description of change ******************************************************************************/ int LTKLipiEngineModule::createWordRecognizer(const string& strProjName, const string& strProfName, LTKWordRecognizer** outWordRecoObj) { LOG(LTKLogger::LTK_LOGLEVEL_INFO)<< "Entering: LTKLipiEngineModule::createWordRecognizer()"<<endl; string recognizerName = ""; int iResult = 0; void *dllHandler = NULL; string strProjectName = strProjName; string strProfileName = strProfName; int errorCode; errorCode = validateProjectAndProfileNames(strProjectName,strProfileName, "WORDREC", recognizerName); if (errorCode != SUCCESS) { LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << getErrorMessage(errorCode) << "LTKLipiEngineModule::createWordRecognizer()"<<endl; LTKReturnError(errorCode); } // Load the dll of the word recognizer errorCode = loadRecognizerDLL(recognizerName, &dllHandler); if( errorCode!= SUCCESS) { LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << getErrorMessage(errorCode) << "LTKLipiEngineModule::createWordRecognizer()"<<endl; LTKReturnError(errorCode); } // Get version information char currentVersion[VERSION_STR_LEN]; int iMajor, iMinor, iBugFix; getToolkitVersion(iMajor, iMinor, iBugFix); sprintf(currentVersion, "%d.%d.%d", iMajor, iMinor, iBugFix); // Create controlInfo object LTKControlInfo controlInfo; controlInfo.lipiRoot = m_strLipiRootPath; controlInfo.projectName = strProjectName; controlInfo.profileName = strProfileName; controlInfo.toolkitVersion = currentVersion; // Map Algo DLL functions... errorCode = mapWordAlgoModuleFunctions(dllHandler); if(errorCode!= SUCCESS) { // Unable to map the functions LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << getErrorMessage(errorCode) << "LTKLipiEngineModule::createWordRecognizer()"<<endl; LTKReturnError(errorCode); } // Call recognition module's createWordRecognizer(); errorCode = module_createWordRecognizer(controlInfo,outWordRecoObj ); if(errorCode != SUCCESS) { /* Error, unable to create word recognizer instance */ LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< getErrorMessage(ECREATE_WORDREC) << " "<<recognizerName<< "LTKLipiEngineModule::createWordRecognizer()"<<endl; m_OSUtilPtr->unloadSharedLib(dllHandler); LTKReturnError(ECREATE_WORDREC); } addModule(*outWordRecoObj, dllHandler); LOG(LTKLogger::LTK_LOGLEVEL_INFO)<< "Exiting: LTKLipiEngineModule::createWordRecognizer()"<<endl; return SUCCESS; }