当前位置: 首页>>代码示例>>C++>>正文


C++ Plugin类代码示例

本文整理汇总了C++中Plugin的典型用法代码示例。如果您正苦于以下问题:C++ Plugin类的具体用法?C++ Plugin怎么用?C++ Plugin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Plugin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: pluginXmlFile

void PluginManager::addPlugin(QDir* dir) {
    QDomDocument doc;
    QFile pluginXmlFile(dir->absolutePath()+QDir::separator()+"plugin.xml");
    if(!pluginXmlFile.exists()) {
        qDebug("error plugin.xml not exist "+dir->absolutePath().toUtf8());
        return;
    }
    pluginXmlFile.open(QIODevice::ReadOnly);
    doc.setContent(&pluginXmlFile);
    pluginXmlFile.close();
    QDomElement plugin = doc.documentElement();
    QString name = plugin.lastChildElement("name").text();
    QString version = plugin.lastChildElement("version").text();
    QString description = plugin.lastChildElement("description").text();
    QString cellBackground = dir->absolutePath()+QDir::separator()+plugin.lastChildElement("cellBackground").text();
    Plugin* p =  new Plugin(name, description,version);
    p->setCellBackground(cellBackground);
    qDebug("Plugin: "+name.toUtf8());
    QDomNodeList listPawns = plugin.lastChildElement("pawns").elementsByTagName("pawn");
    for(int i = 0;i < listPawns.count(); i++)
    {
        QString pid = listPawns.at(i).lastChildElement("id").text();
        QString pname = listPawns.at(i).lastChildElement("name").text();
        QString picon = dir->absolutePath()+QDir::separator()+listPawns.at(i).lastChildElement("icon").text();
        if(!p->existPawn(pid))
        {
            qDebug("  Pawn: "+pname.toUtf8()+" (id:"+pid.toUtf8()+", icon:"+picon.toUtf8()+")");
            Pawn* pawn =  new Pawn(pid, pname, picon);
            p->addPawn(pawn);
        }
        else
        {
            qDebug("  Pawn can't add");
        }
    }
    QDomNodeList listrules = plugin.lastChildElement("rules").elementsByTagName("rule");
    for(int i = 0;i < listrules.count(); i++)
    {
        QString from = listrules.at(i).attributes().namedItem("pawn").toAttr().value();
        QString to = listrules.at(i).attributes().namedItem("newPawn").toAttr().value();
        if(p->existPawn(from) && p->existPawn(to)) {
            Rule* r = new Rule(p->getPawn(from), p->getPawn(to));
            qDebug("  Rule: (from:"+from.toUtf8()+" to:"+to.toUtf8()+")");
            for(int j = 0;j < listrules.at(i).childNodes().count(); j++)
            {
                QString op = listrules.at(i).childNodes().at(j).nodeName();
                QString pawn = listrules.at(i).childNodes().at(j).attributes().namedItem("pawn").toAttr().value();
                QString value = listrules.at(i).childNodes().at(j).toElement().text();

                int intValue = value.toInt();
                AbstractOperator* o = NULL;
                if(op == "pawnNumberIsEqual")
                    o = new EqualOperator(intValue, pawn);
                if(op == "pawnNumberIsLower")
                    o = new LowerOperator(intValue, pawn);
                if(op == "pawnNumberIsGreater")
                    o = new GreaterOperator(intValue, pawn);

                if(o != NULL && p->existPawn(pawn))
                {
                    r->addOperator(o);
                    qDebug("    with "+pawn.toUtf8()+" "+op.toUtf8()+" "+value.toUtf8());
                }
                else
                {
                    qDebug("    Operator can't add");
                }

            }
            p->getPawn(from)->addRule(r);
        }
        else
        {
            qDebug("  Rule can't add");
        }
    }
    plugins->push_back(p);
}
开发者ID:masters-info-nantes,项目名称:madjan,代码行数:78,代码来源:pluginmanager.cpp

示例2: parse_plugin_list

/** Load plugin.
 * The loading is interrupted if any of the plugins does not load properly.
 * The already loaded plugins are *not* unloaded, but kept.
 * @param plugin_list string containing a comma-separated list of plugins
 * to load. The plugin list can contain meta plugins.
 */
void
PluginManager::load(const std::list<std::string> &plugin_list)
{
  for (std::list<std::string>::const_iterator i = plugin_list.begin(); i != plugin_list.end(); ++i) {
		if ( i->length() == 0 ) continue;

		bool try_real_plugin = true;
		if ( __meta_plugins.find(*i) == __meta_plugins.end() ) {
			std::string meta_plugin = __meta_plugin_prefix + *i;
			bool found_meta = false;
			std::list<std::string> pset;
			try {
				if (__config->is_list(meta_plugin.c_str())) {
					std::vector<std::string> tmp = __config->get_strings(meta_plugin.c_str());
					pset.insert(pset.end(), tmp.begin(), tmp.end());
				}
				else
					pset = parse_plugin_list(__config->get_string(meta_plugin.c_str()).c_str());
				found_meta = true;
			} catch (ConfigEntryNotFoundException &e) {
				// no meta plugin defined by that name
	      //printf("No meta plugin defined with the name %s\n", i->c_str());
				try_real_plugin = true;
			}

			if (found_meta) {
				if (pset.size() == 0) {
					throw Exception("Refusing to load an empty meta plugin");
				}
				//printf("Going to load meta plugin %s (%s)\n", i->c_str(), pset.c_str());
				__meta_plugins.lock();
				// Setting has to happen here, so that a meta plugin will not cause an
				// endless loop if it references itself!
				__meta_plugins[*i] = pset;
				__meta_plugins.unlock();
				try {
					LibLogger::log_info("PluginManager", "Loading plugins %s for meta plugin %s",
                              str_join(pset.begin(), pset.end(), ",").c_str(), i->c_str());
					load(pset);
					LibLogger::log_debug("PluginManager", "Loaded meta plugin %s", i->c_str());
					notify_loaded(i->c_str());
				} catch (Exception &e) {
					e.append("Could not initialize meta plugin %s, aborting loading.", i->c_str());
					__meta_plugins.erase_locked(*i);
					throw;
				}
			
				try_real_plugin = false;
			}
		}

    if (try_real_plugin &&
	(find_if(plugins.begin(), plugins.end(), plname_eq(*i)) == plugins.end()))
    {
      try {
	//printf("Going to load real plugin %s\n", i->c_str());
	Plugin *plugin = plugin_loader->load(i->c_str());
	plugins.lock();
	try {
	  thread_collector->add(plugin->threads());
	  plugins.push_back(plugin);
	  plugin_ids[*i] = next_plugin_id++;
	  LibLogger::log_debug("PluginManager", "Loaded plugin %s", i->c_str());
	  notify_loaded(i->c_str());
	} catch (CannotInitializeThreadException &e) {
	  e.append("Plugin >>> %s <<< could not be initialized, unloading", i->c_str());
	  plugins.unlock();
	  plugin_loader->unload(plugin);
	  throw;
	}
	plugins.unlock();
      } catch (Exception &e) {
	MutexLocker lock(__meta_plugins.mutex());
	if ( __meta_plugins.find(*i) == __meta_plugins.end() ) {
	  // only throw exception if no meta plugin with that name has
	  // already been loaded
	  throw;
	}
      }
    }
  }
}
开发者ID:timn,项目名称:fawkes,代码行数:88,代码来源:manager.cpp

示例3: getPluginByCommand

// FIXME: handle name collisions...
command_result PluginManager::InvokeCommand(color_ostream &out, const std::string & command, std::vector <std::string> & parameters)
{
    Plugin *plugin = getPluginByCommand(command);
    return plugin ? plugin->invoke(out, command, parameters) : CR_NOT_IMPLEMENTED;
}
开发者ID:Putnam3145,项目名称:dfhack,代码行数:6,代码来源:PluginManager.cpp

示例4: enumeratePlugins

void
enumeratePlugins(Verbosity verbosity)
{
    PluginLoader *loader = PluginLoader::getInstance();

    if (verbosity == PluginInformation) {
        cout << "\nVamp plugin libraries found in search path:" << endl;
    }

    vector<PluginLoader::PluginKey> plugins = loader->listPlugins();
    typedef multimap<string, PluginLoader::PluginKey>
        LibraryMap;
    LibraryMap libraryMap;

    for (size_t i = 0; i < plugins.size(); ++i) {
        string path = loader->getLibraryPathForPlugin(plugins[i]);
        libraryMap.insert(LibraryMap::value_type(path, plugins[i]));
    }

    string prevPath = "";
    int index = 0;

    for (LibraryMap::iterator i = libraryMap.begin();
         i != libraryMap.end(); ++i) {
        
        string path = i->first;
        PluginLoader::PluginKey key = i->second;

        if (path != prevPath) {
            prevPath = path;
            index = 0;
            if (verbosity == PluginInformation) {
                cout << "\n  " << path << ":" << endl;
            } else if (verbosity == PluginInformationDetailed) {
                string::size_type ki = i->second.find(':');
                string text = "Library \"" + i->second.substr(0, ki) + "\"";
                cout << "\n" << header(text, 1);
            }
        }

        Plugin *plugin = loader->loadPlugin(key, 48000);
        if (plugin) {

            char c = char('A' + index);
            if (c > 'Z') c = char('a' + (index - 26));

            PluginLoader::PluginCategoryHierarchy category =
                loader->getPluginCategory(key);
            string catstr;
            if (!category.empty()) {
                for (size_t ci = 0; ci < category.size(); ++ci) {
                    if (ci > 0) catstr += " > ";
                        catstr += category[ci];
                }
            }

            if (verbosity == PluginInformation) {

                cout << "    [" << c << "] [v"
                     << plugin->getVampApiVersion() << "] "
                     << plugin->getName() << ", \""
                     << plugin->getIdentifier() << "\"" << " ["
                     << plugin->getMaker() << "]" << endl;
                
                if (catstr != "") {
                    cout << "       > " << catstr << endl;
                }

                if (plugin->getDescription() != "") {
                    cout << "        - " << plugin->getDescription() << endl;
                }

            } else if (verbosity == PluginInformationDetailed) {

                cout << header(plugin->getName(), 2);
                cout << " - Identifier:         "
                     << key << endl;
                cout << " - Plugin Version:     " 
                     << plugin->getPluginVersion() << endl;
                cout << " - Vamp API Version:   "
                     << plugin->getVampApiVersion() << endl;
                cout << " - Maker:              \""
                     << plugin->getMaker() << "\"" << endl;
                cout << " - Copyright:          \""
                     << plugin->getCopyright() << "\"" << endl;
                cout << " - Description:        \""
                     << plugin->getDescription() << "\"" << endl;
                cout << " - Input Domain:       "
                     << (plugin->getInputDomain() == Vamp::Plugin::TimeDomain ?
                         "Time Domain" : "Frequency Domain") << endl;
                cout << " - Default Step Size:  " 
                     << plugin->getPreferredStepSize() << endl;
                cout << " - Default Block Size: " 
                     << plugin->getPreferredBlockSize() << endl;
                cout << " - Minimum Channels:   " 
                     << plugin->getMinChannelCount() << endl;
                cout << " - Maximum Channels:   " 
                     << plugin->getMaxChannelCount() << endl;

            } else if (verbosity == PluginIds) {
//.........这里部分代码省略.........
开发者ID:c4dm,项目名称:vamp-plugin-sdk,代码行数:101,代码来源:vamp-simple-host.cpp

示例5: ToGameTime

inline double ToGameTime(Plugin const& plugin,
                         Instant const& t) {
  return (t - plugin.GameEpoch()) / Second;
}
开发者ID:pdn4kd,项目名称:Principia,代码行数:4,代码来源:interface_body.hpp

示例6: main

int main (int argc, char* argv[])
{

   struct dirent **namelist;
   int n;

   bool listHelp = false;
   bool listPlugins = false;
   std::string arg;

   for ( int i=1; i < argc; i++ ) {
      arg = std::string( argv[i] );

      if ( arg.compare( "--help" ) == 0 ) {
         listHelp = true;
      } else if ( arg.compare( "--list-modules" ) == 0 ) {
         listPlugins = true;
      } else {
         std::cout << "usage: " << argv[0] << " [--help] [--list-modules]" << std::endl;
         exit(0);
      }
   } 

   if ( !listPlugins && !listHelp ) {
      std::cout << "usage: " << argv[0] << " [--help] [--list-modules]" << std::endl;
      exit(0);
   }

   if ( listPlugins )
      std::cout << "Nanox runtime library available plugins at '" << PLUGIN_DIR << "':" << std::endl;

   n = scandir( PLUGIN_DIR, &namelist, 0, alphasort );

   if ( n < 0 )
      perror( "scandir" );
   else {
      while ( n-- ) {
         std::string name( namelist[n]->d_name );

         if ( name.compare( 0,9,"libnanox-" ) != 0 ) continue;

         if ( name.compare( name.size()-3,3,".so" ) == 0 ) {
            name.erase( name.size()-3 );
            name.erase( 0, std::string("libnanox-").size() );

            if ( PluginManager::isPlugin( name ) ) {
               Plugin *plugin = PluginManager::loadAndGetPlugin( name , false );

               if ( listPlugins && plugin != NULL )
                  std::cout << "   " << name << " - " << plugin->getName() << " - version " << plugin->getVersion() << std::endl;
            }
         }

         free( namelist[n] );
      }

      free( namelist );
   }

   if ( listHelp ) {
      if ( listPlugins )
         std::cout << std::endl;

      std::cout << "Nanos++ runtime library version " << VERSION << "." << std::endl;
      std::cout << std::endl;
      std::cout << "The runtime configuration can be set using arguments added" << std::endl;
      std::cout << "to the NX_ARGS environment variable or through specialised" << std::endl;
      std::cout << "environment variables. As an example of NX_ARGS, to execute" << std::endl;
      std::cout << "with verbose mode and 4 PEs the NX_ARGS environment variable" << std::endl;
      std::cout << "should be: 'NX_ARGS=\"--pes=4 --verbose\"'." << std::endl;
      std::cout << std::endl;
      std::cout << "All NX_ARGS and env vars are listed below." << std::endl;
      std::cout << std::endl;

      std::cout << Config::getNanosHelp();
   }

}
开发者ID:deniskin82,项目名称:chapel,代码行数:78,代码来源:nanox.cpp

示例7: fIOthread

// A thread function... for the interactive console.
void fIOthread(void * iodata)
{
    IODATA * iod = ((IODATA*) iodata);
    Core * core = iod->core;
    PluginManager * plug_mgr = ((IODATA*) iodata)->plug_mgr;
    CommandHistory main_history;
    main_history.load("dfhack.history");
    Console & con = core->con;
    if(plug_mgr == 0 || core == 0)
    {
        con.printerr("Something horrible happened in Core's constructor...\n");
        return;
    }
    con.print("DFHack is ready. Have a nice day!\n"
              "Type in '?' or 'help' for general help, 'ls' to see all commands.\n");
    int clueless_counter = 0;
    while (true)
    {
        string command = "";
        int ret = con.lineedit("[DFHack]# ",command, main_history);
        if(ret == -2)
        {
            cerr << "Console is shutting down properly." << endl;
            return;
        }
        else if(ret == -1)
        {
            cerr << "Console caught an unspecified error." << endl;
            continue;
        }
        else if(ret)
        {
            // a proper, non-empty command was entered
            main_history.add(command);
            main_history.save("dfhack.history");
        }
        // cut the input into parts
        vector <string> parts;
        cheap_tokenise(command,parts);
        if(parts.size() == 0)
        {
            clueless_counter ++;
            continue;
        }
        string first = parts[0];
        parts.erase(parts.begin());
        // let's see what we actually got
        if(first=="help" || first == "?")
        {
            if(!parts.size())
            {
                con.print("This is the DFHack console. You can type commands in and manage DFHack plugins from it.\n"
                          "Some basic editing capabilities are included (single-line text editing).\n"
                          "The console also has a command history - you can navigate it with Up and Down keys.\n"
                          "On Windows, you may have to resize your console window. The appropriate menu is accessible\n"
                          "by clicking on the program icon in the top bar of the window.\n\n"
                          "Basic commands:\n"
                          "  help|?                - This text.\n"
                          "  ls|dir [PLUGIN]           - List available commands. Optionally for single plugin.\n"
                          "  cls                   - Clear the console.\n"
                          "  fpause                - Force DF to pause.\n"
                          "  die                   - Force DF to close immediately\n"
                          "Plugin management (useful for developers):\n"
                          //"  belongs COMMAND       - Tell which plugin a command belongs to.\n"
                          "  plug [PLUGIN|v]       - List plugin state and description.\n"
                          "  load PLUGIN|all       - Load a plugin by name or load all possible plugins.\n"
                          "  unload PLUGIN|all     - Unload a plugin or all loaded plugins.\n"
                          "  reload PLUGIN|all     - Reload a plugin or all loaded plugins.\n"
                         );
            }
            else
            {
                con.printerr("not implemented yet\n");
            }
        }
        else if( first == "load" )
        {
            if(parts.size())
            {
                string & plugname = parts[0];
                if(plugname == "all")
                {
                    for(int i = 0; i < plug_mgr->size();i++)
                    {
                        Plugin * plug = (plug_mgr->operator[](i));
                        plug->load();
                    }
                }
                else
                {
                    Plugin * plug = plug_mgr->getPluginByName(plugname);
                    if(!plug) con.printerr("No such plugin\n");
                    plug->load();
                }
            }
        }
        else if( first == "reload" )
        {
            if(parts.size())
//.........这里部分代码省略.........
开发者ID:tmreeves,项目名称:dfhack,代码行数:101,代码来源:Core.cpp

示例8: SetVisible

// Sets the visibility of the debugger.
void SetVisible(bool visibility)
{
    Plugin* plugin = Plugin::GetInstance();
    if (plugin != NULL)
        plugin->SetVisible(visibility);
}
开发者ID:gabomdq,项目名称:libRocket,代码行数:7,代码来源:Debugger.cpp

示例9: Interval

bool basic_builder::BuildScene(string file_name, Camera &camera, Scene &scene) const {
    int line_num = 0;
    char input_line[512];
    Plugin *dat = NULL;  // A container for arbitrary data.
    Object *obj = NULL;  // The current object, which was the last object created.
    Shader *shd = NULL;  // The current shader.
    Aggregate *agg = NULL;  // Current aggregate object, to which all objects are now added.
    Envmap *env = NULL;  // Current environment map.
    Material *mat = NULL;  // Current material pointer.
    Material material;    // Current material.

    scene.object = NULL;
    scene.envmap = NULL;
    scene.rasterize = NULL;

    // Attempt to open the input file.

    file_name += ".sdf";
    std::ifstream fin;
    fin.open(file_name.c_str());
    if (fin.fail()) {
        cerr << "Error: Could not open file " << file_name << endl;
        return false;  // Report failure.
    }
    cout << "Reading " << file_name << "... ";
    cout.flush();

    // Set some defaults.

    material.diffuse = White;
    material.emission = Black;
    material.specular = White;
    material.ambient = Black;
    material.reflectivity = Black;
    material.translucency = Black;
    material.ref_index = 0.0;
    material.Phong_exp = 0.0;

    camera.x_res = default_image_width;
    camera.y_res = default_image_height;
    camera.x_win = Interval(-1.0, 1.0);
    camera.y_win = Interval(-1.0, 1.0);

    // Process lines until the end of file is reached.
    // Print a warning for all lines that are unrecognizable.

    while (fin.getline(input_line, 512)) {
        line_num++;
        if (Skip(input_line)) continue;

        // Ask each registered object if it recognizes the line.  If it does, it will
        // create a new instance of the object and return it as the function value.

        Plugin *plg = Instance_of_Plugin(input_line);

        if (plg != NULL) {
            switch (plg->PluginType()) {
                case data_plugin:
                    if (obj == NULL) cerr << "Error: data ignored.  Line " << line_num << endl;
                    else obj->AddData(obj);
                    break;

                case shader_plugin:
                    shd = (Shader *) plg;
                    break;

                case aggregate_plugin:
                    obj = (Object *) plg;
                    obj->shader = shd;
                    obj->envmap = env;
                    obj->material = Copy(mat, material);
                    obj->parent = agg;
                    if (Emitter(material)) {
                        cerr << "Error: An aggregate object cannot be an emitter.  Line "
                        << line_num << ": "
                        << input_line << endl;
                        return false;
                    }
                    if (agg != NULL) // If there is alrealy an agg obj, this one is a child.
                    {
                        // agg->AddChild( obj );
                        // Do not add aggregates as children until they are complete.
                        agg->material = Copy(mat, material);
                    }
                    else if (scene.object == NULL) scene.object = obj;
                    agg = (Aggregate *) obj;
                    break;

                case primitive_plugin:
                    obj = (Object *) plg;
                    obj->shader = shd;
                    obj->envmap = env;
                    obj->material = Copy(mat, material);
                    obj->parent = agg;
                    if (Emitter(material)) scene.lights.push_back(obj);
                    if (agg != NULL) {
                        agg->AddChild(obj);
                        agg->material = Copy(mat, material);
                    }
                    else if (scene.object == NULL) scene.object = obj;
//.........这里部分代码省略.........
开发者ID:xuhongxu96,项目名称:Computer-Graphics-Course,代码行数:101,代码来源:basic_builder.cpp

示例10: while

/*!
  Quick load a plugin, doing all phases {pre,,post}Load.
  \param server The server object to use.
  \param plugins comma separed list of plugins to load as:
  "name1:pluginfile1.so,name2:pluginfile2.so"
*/
int
PluginsManager::quickLoad (Server *server, const string &plugins)
{
  size_t start = 0;
  int ret = 0;
  while (1)
    {
      size_t commaPos = plugins.find (",", start);

      size_t sep = plugins.find (":", start);
      if (sep > commaPos || sep == string::npos)
        {
          server->log (MYSERVER_LOG_MSG_ERROR,
                       _("Invalid plugins data specified"));
          return -1;
        }

      string name = plugins.substr (start, sep - start);
      string file = plugins.substr (sep + 1, commaPos == string::npos
                                    ? string::npos
                                    : commaPos - sep - 1);

      string dir;
      string filename;
      FilesUtility::splitPath (file, dir, filename);

      string xmlDescriptor = dir + "/plugin.xml";
      PluginInfo *pinfo = loadInfo (server, name, xmlDescriptor);

      if (! pinfo)
        {
          server->log (MYSERVER_LOG_MSG_ERROR,
                       _("Cannot find the plugin data, please check "
                         "that the specified name and path are correct"));
          return -1;
        }

      auto_ptr<PluginInfo> pinfoAutoPtr (pinfo);

      ret |= loadFile (server, name, file, pinfo);

      pinfoAutoPtr.release ();

      Plugin *plugin = pinfo->getPlugin ();
      if (! plugin)
        {
          server->log (MYSERVER_LOG_MSG_ERROR,
                       _("Cannot load plugin %s"), file.c_str ());
          return -1;
        }

      ret |= plugin->load (server);
      ret |= plugin->postLoad (server);

      if (commaPos == string::npos)
        break;

      start = commaPos + 1;
    }

  return ret;
}
开发者ID:rupinder,项目名称:GNU-MyServer-GSoC,代码行数:68,代码来源:plugins_manager.cpp

示例11: initializePottsCC3D

void Simulator::initializeCC3D(){


	try{
		cerr<<"BEFORE initializePotts"<<endl;
		//initializePotts(ps.pottsParseData);
		initializePottsCC3D(ps.pottsCC3DXMLElement);
		


		//initializing parallel utils  - OpenMP
		pUtils->init(potts.getCellFieldG()->getDim());
        potts.setParallelUtils(pUtils); // by default Potts gets pUtls which can have multiple threads
        
        //initializing parallel utils  - OpenMP  - for single CPU runs of selecte modules
        pUtilsSingle->init(potts.getCellFieldG()->getDim());

        
        
		//after pUtils have been initialized we process metadata -  in this function potts may get pUtils limiting it to use single thread
		processMetadataCC3D(ps.metadataCC3DXMLElement);


		cerr<<"AFTER initializePotts"<<endl;
		std::set<std::string> initializedPlugins;
		std::set<std::string> initializedSteppables;

		for(size_t i=0; i <ps.pluginCC3DXMLElementVector.size(); ++i){

			std::string pluginName = ps.pluginCC3DXMLElementVector[i]->getAttribute("Name");
			bool pluginAlreadyRegisteredFlag=false;
			Plugin *plugin = pluginManager.get(pluginName,&pluginAlreadyRegisteredFlag);
			if(!pluginAlreadyRegisteredFlag){
				//Will only process first occurence of a given plugin
				cerr<<"INITIALIZING "<<pluginName<<endl;
				plugin->init(this, ps.pluginCC3DXMLElementVector[i]);
			}
		}

		for(size_t i=0; i <ps.steppableCC3DXMLElementVector.size(); ++i){
			std::string steppableName = ps.steppableCC3DXMLElementVector[i]->getAttribute("Type");
			bool steppableAlreadyRegisteredFlag=false;
			Steppable *steppable = steppableManager.get(steppableName,&steppableAlreadyRegisteredFlag);

			if(!steppableAlreadyRegisteredFlag){
				//Will only process first occurence of a given steppable
				cerr<<"INITIALIZING "<<steppableName<<endl;
				if(ps.steppableCC3DXMLElementVector[i]->findAttribute("Frequency"))
					steppable->frequency=ps.steppableCC3DXMLElementVector[i]->getAttributeAsUInt("Frequency");

				steppable->init(this, ps.steppableCC3DXMLElementVector[i]);
				classRegistry->addStepper(steppableName,steppable);

			} 
		}
		if(ppdCC3DPtr->cellTypeMotilityVector.size()){
			//for(int i =0 ; i < ppdCC3DPtr->cellTypeMotilityVector.size() ;++i ){
			//	cerr<<" GOT THIS CELL TYPE FOR MOTILITY"<<	ppdCC3DPtr->cellTypeMotilityVector[i].typeName<<endl;
			//}

			potts.initializeCellTypeMotility(ppdCC3DPtr->cellTypeMotilityVector);		
		}

	}catch (const BasicException &e) {
		cerr << "ERROR: " << e << endl;
		stringstream errorMessageStream;

		errorMessageStream<<"Exception during initialization/parsing :\n"<<e.getMessage()<<"\n"<<"Location \n"<<"FILE :"<<e.getLocation().getFilename()<<"\n"<<"LINE :"<<e.getLocation().getLine();
		recentErrorMessage=errorMessageStream.str(); 
		cerr<<"THIS IS recentErrorMessage="<<recentErrorMessage<<endl;
		if (!newPlayerFlag){
			throw e;
		}

	}
}
开发者ID:CompuCell3D,项目名称:CompuCell3D,代码行数:76,代码来源:Simulator.cpp

示例12: Q_ASSERT

/// TODO: This code can be simplified.  Make a PortContainer class.
/// Plugin and Patch can inherit from PortContainer.  We can have a
/// pseudo-PortContainer here to represent the input and output ports
/// Then, all adds/removals will be symetric
/// ^^^: Or, just wrap Plugin and BackendPorts with a class that acts this way
void FxLine::addPlugin(const PluginInfoPtr info, int pos)
{
    int idx = pos + 1;
    int pluginCnt = m_entries.length() - 2;

    // Check for proper position value. TODO: Report error, not fatal
    Q_ASSERT(pos <= pluginCnt);

    // Create the plugin. TODO: Report error, not fatal
    Plugin *plugin = info->createPlugin(48000);
    Q_ASSERT(plugin);

    plugin->activate(Engine::bufferProvider());
    m_parent.add(plugin);

    // Verify number of ports. TODO: Report error, not fatal
    Q_ASSERT(plugin->audioInputCount() == 2);
    Q_ASSERT(plugin->audioOutputCount() == 2);

    // Collect ports.
    Entry entry;
    entry.plugin = plugin;
    collectPorts(plugin, &entry.inputPorts, &entry.outputPorts);
    Q_ASSERT(entry.inputPorts.length() == 2);
    Q_ASSERT(entry.outputPorts.length() == 2);

    /*
    if (m_plugins.length() == 0) {
      // If there are no plugins, we disconnect the backend ports from each
      // other. Then, we connect the plugin in-between the backend ports

      // TODO: Bring back once backend ports have patch?
      // m_inPorts[0]->disconnect(m_outPorts[0]);
      // m_inPorts[1]->disconnect(m_outPorts[1]);

      m_inPorts[0]->connect(pluginIn.at(0));
      m_inPorts[1]->connect(pluginIn.at(1));

      m_outPorts[0]->connect(pluginOut.at(0));
      m_outPorts[1]->connect(pluginOut.at(1));
    }
    else if (pos < m_plugins.length()) {
    */
    // At this point, there is at least one plugin already in the line, and we
    // are trying to insert the new plugin before another one.
    Entry producer = m_entries.value(idx-1);
    Entry consumer = m_entries.value(idx);

    qWarning() << "FX LINE ADD producer port count:" << producer.outputPorts.count();
    for (int i=0; i<producer.outputPorts.count(); ++i) {
        Port *producerPort = producer.outputPorts.at(i);
        Port *consumerPort = consumer.inputPorts.at(i);

        // Work around:
        if (producerPort->parentPatch() == NULL && consumerPort->parentPatch() == NULL) {
            qWarning("Probably disconnecting two backend-ports. Ignoring");
        }
        else {
            producerPort->disconnect(consumerPort);
        }
        qWarning() << "FX: Connecting: " << producerPort->name() << " TO " << entry.inputPorts.at(i)->name();
        qWarning() << "FX: and Connecting: " << consumerPort->name() << " TO " << entry.outputPorts.at(i)->name();
        producerPort->connect(entry.inputPorts.at(i));
        consumerPort->connect(entry.outputPorts.at(i));
    }

    m_entries.insert(idx, entry);
}
开发者ID:apathadeus,项目名称:unison,代码行数:73,代码来源:FxLine.cpp

示例13: elektraPluginOpen

/**
 * Opens a plugin.
 *
 * The config will be used as is. So be sure to transfer ownership
 * of the config to it, with e.g. ksDup().
 * elektraPluginClose() will delete the config.
 *
 * @return a pointer to a new created plugin or 0 on error
 */
Plugin * elektraPluginOpen (const char * name, KeySet * modules, KeySet * config, Key * errorKey)
{
	Plugin * handle = 0;
	const char * n;

	elektraPluginFactory pluginFactory = 0;

	if (!name || name[0] == '\0')
	{
		ELEKTRA_ADD_WARNING (39, errorKey, "name is null or empty");
		goto err_clup;
	}

	n = name;
	while (*n != '\0')
	{
		if (*n == '/')
			++n;
		else
			break;
	}

	if (*n == '\0')
	{
		ELEKTRA_ADD_WARNING (39, errorKey, "name contained slashes only");
		goto err_clup;
	}

	pluginFactory = elektraModulesLoad (modules, name, errorKey);
	if (pluginFactory == 0)
	{
		/* warning already set by elektraModulesLoad */
		goto err_clup;
	}

	handle = pluginFactory ();
	if (handle == 0)
	{
		ELEKTRA_ADD_WARNING (6, errorKey, name);
		goto err_clup;
	}

	/* init reference counting */
	handle->refcounter = 1;
	handle->config = config;
	config = 0; // for err_clup case

	/* let the plugin initialize itself */
	if (handle->kdbOpen)
	{
		if ((handle->kdbOpen (handle, errorKey)) == -1)
		{
			ELEKTRA_ADD_WARNING (11, errorKey, name);
			elektraPluginClose (handle, errorKey);
			goto err_clup;
		}
	}

#if DEBUG && VERBOSE
	printf ("Finished loading plugin %s\n", name);
#endif
	return handle;

err_clup:
#if DEBUG
	printf ("Failed to load plugin %s\n", name);
#endif
	ksDel (config);
	return 0;
}
开发者ID:fberlakovich,项目名称:libelektra,代码行数:79,代码来源:plugin.c

示例14:

Plugin *VampEffectsModule::FindPlugin(const wxString & path,
                                      int & output,
                                      bool & hasParameters)
{
   PluginLoader::PluginKey key = path.BeforeLast(wxT('/')).ToUTF8().data();

   Plugin *vp = PluginLoader::getInstance()->loadPlugin(key, 48000); // rate doesn't matter here
   if (!vp)
   {
      return false;
   }

   // We limit the listed plugin outputs to those whose results can
   // readily be displayed in an Audacity label track.
   //
   // - Any output whose features have no values (time instants only),
   //   with or without duration, is fine
   //
   // - Any output whose features have more than one value, or an
   //   unknown or variable number of values, is right out
   //
   // - Any output whose features have exactly one value, with
   //   variable sample rate or with duration, should be OK --
   //   this implies a sparse feature, of which the time and/or
   //   duration are significant aspects worth displaying
   //
   // - An output whose features have exactly one value, with
   //   fixed sample rate and no duration, cannot be usefully
   //   displayed -- the value is the only significant piece of
   //   data there and we have no good value plot

   Plugin::OutputList outputs = vp->getOutputDescriptors();

   output = 0;

   hasParameters = !vp->getParameterDescriptors().empty();

   for (Plugin::OutputList::iterator j = outputs.begin(); j != outputs.end(); ++j)
   {
      if (j->sampleType == Plugin::OutputDescriptor::FixedSampleRate ||
            j->sampleType == Plugin::OutputDescriptor::OneSamplePerStep ||
            !j->hasFixedBinCount ||
            (j->hasFixedBinCount && j->binCount > 1))
      {
         // All of these qualities disqualify (see notes above)

         ++output;
         continue;
      }

      wxString name = wxString::FromUTF8(vp->getName().c_str());

      if (outputs.size() > 1)
      {
         // This is not the plugin's only output.
         // Use "plugin name: output name" as the effect name,
         // unless the output name is the same as the plugin name
         wxString outputName = wxString::FromUTF8(j->name.c_str());
         if (outputName != name)
         {
            name = wxString::Format(wxT("%s: %s"),
                                    name.c_str(), outputName.c_str());
         }
      }

      if (wxString::FromUTF8(key.c_str()) + wxT("/") + name == path)
      {
         return vp;
      }

      ++output;
   }

   delete vp;

   return NULL;
}
开发者ID:LBoggino,项目名称:audacity,代码行数:77,代码来源:LoadVamp.cpp

示例15: main

int main (int argc, char ** argv)
{
	if (argc < 4 || argc > 5 || (argc == 5 && elektraStrCmp (argv[4], "get") != 0))
	{
		fprintf (stderr, "Usage: %s <path> <parent> <plugin> [get]\n", argv[0]);
		return 1;
	}

	typedef enum
	{
		BOTH,
		GET,
		Default = BOTH
	} Direction;

	Direction direction;
	if (argc == 5) direction = GET;

	const char * path = argv[1];
	const char * parent = argv[2];
	const char * pluginname = argv[3];

	KeySet * ks = ksNew (0, KS_END);
	char * infile = elektraFormat ("%s/test.%s.in", path, pluginname);
	char * outfile = elektraFormat ("%s/test.%s.out", path, pluginname);

	{
		Key * getKey = keyNew (parent, KEY_VALUE, infile, KEY_END);

		KeySet * conf = ksNew (0, KS_END);
		KeySet * modules = ksNew (0, KS_END);
		elektraModulesInit (modules, 0);
		Key * errorKey = keyNew ("", KEY_END);
		Plugin * plugin = elektraPluginOpen (pluginname, modules, conf, errorKey);
		keyDel (errorKey);

		plugin->kdbGet (plugin, ks, getKey);

		keyDel (getKey);
		elektraPluginClose (plugin, 0);
		elektraModulesClose (modules, 0);
		ksDel (modules);
	}

	if (ksGetSize (ks) <= 0)
	{
		return 1;
	}

	if (direction == BOTH)
	{
		Key * setKey = keyNew (parent, KEY_VALUE, outfile, KEY_END);

		KeySet * conf = ksNew (0, KS_END);
		KeySet * modules = ksNew (0, KS_END);
		elektraModulesInit (modules, 0);
		Key * errorKey = keyNew ("", KEY_END);
		Plugin * plugin = elektraPluginOpen (pluginname, modules, conf, errorKey);
		keyDel (errorKey);
		plugin->kdbSet (plugin, ks, setKey);

		keyDel (setKey);
		elektraPluginClose (plugin, 0);
		elektraModulesClose (modules, 0);
		ksDel (modules);
	}

	elektraFree (infile);
	elektraFree (outfile);

	ksDel (ks);
	return 0;
}
开发者ID:ElektraInitiative,项目名称:libelektra,代码行数:73,代码来源:plugingetset.c


注:本文中的Plugin类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。