StubDriver(const char *name, bool verbose = true) { settings.setPluginName(name); settings.setVerboseMode(verbose); YarpPluginSelector selector; selector.scan(); if (!settings.setSelector(selector)) return; init(); }
void init() { YarpPluginSelector selector; selector.scan(); settings.setSelector(selector); if (plugin.open(settings)) { car.open(*plugin.getFactory()); settings.setLibraryMethodName(plugin.getFactory()->getName(), settings.getMethodName()); } }
std::string toString() { std::string s; Property done; for (unsigned int i=0; i<delegates.size(); i++) { if (delegates[i]==nullptr) continue; std::string name = delegates[i]->getName(); done.put(name,1); std::string wrapper = delegates[i]->getWrapper(); s += "Device \""; s += delegates[i]->getName(); s += "\""; s += ","; s += " C++ class "; s += delegates[i]->getCode(); s += ", "; if (wrapper=="") { s += "has no network wrapper"; } else if (wrapper!=name) { s += "wrapped by \""; s += delegates[i]->getWrapper(); s += "\""; } else { s += "is a network wrapper."; } s += "\n"; } scan(); Bottle lst = getSelectedPlugins(); for (size_t i=0; i<lst.size(); i++) { Value& prop = lst.get(i); std::string name = prop.check("name",Value("untitled")).asString(); if (done.check(name)) continue; SharedLibraryFactory lib; YarpPluginSettings settings; settings.setSelector(*this); settings.readFromSearchable(prop,name); settings.open(lib); std::string location = lib.getName().c_str(); if (location=="") { // A wrong library name ends up with empty location yWarning("Wrong library name for plugin %s", name.c_str()); continue; } std::string cxx = prop.check("cxx",Value("unknown")).asString(); std::string wrapper = prop.check("wrapper",Value("unknown")).asString(); s += "Device \""; s += name; s += "\""; s += ","; s += " available on request (found in "; s += location; s += " library)"; if (cxx!="unknown") { s += ", C++ class "; s += cxx; s += " "; } if (wrapper=="") { s += "no network wrapper known"; // will never come here since the prop.check fallback is set to unknown few lines above!!! } else if (wrapper=="unknown") { //s += "network wrapper unknown"; } else if (wrapper!=name) { s += ", wrapped by \""; s += wrapper.c_str(); s += "\""; } else { s += ", is a network wrapper"; } s += ".\n"; } return s; }
ConstString toString() { ConstString s; Property done; for (unsigned int i=0; i<delegates.size(); i++) { if (delegates[i]==NULL) continue; ConstString name = delegates[i]->getName(); done.put(name,1); ConstString wrapper = delegates[i]->getWrapper(); s += "Device \""; s += delegates[i]->getName(); s += "\""; s += ","; s += " C++ class "; s += delegates[i]->getCode(); s += ", "; if (wrapper=="") { s += "has no network wrapper"; } else if (wrapper!=name) { s += "wrapped by \""; s += delegates[i]->getWrapper(); s += "\""; } else { s += "is a network wrapper."; } s += "\n"; } scan(); Bottle lst = getSelectedPlugins(); for (int i=0; i<lst.size(); i++) { Value& prop = lst.get(i); ConstString name = prop.check("name",Value("untitled")).asString(); if (done.check(name)) continue; SharedLibraryFactory lib; YarpPluginSettings settings; settings.setSelector(*this); settings.readFromSearchable(prop,name); settings.open(lib); ConstString location = lib.getName().c_str(); if (location=="") continue; ConstString cxx = prop.check("cxx",Value("unknown")).asString(); ConstString wrapper = prop.check("wrapper",Value("unknown")).asString(); s += "Device \""; s += name; s += "\""; s += ","; s += " available on request (found in "; s += location; s += " library)"; if (cxx!="unknown") { s += ", C++ class "; s += cxx; s += " "; } if (wrapper=="") { s += "no network wrapper known"; } else if (wrapper=="unknown") { //s += "network wrapper unknown"; } else if (wrapper!=name) { s += "wrapped by \""; s += delegates[i]->getWrapper(); s += "\""; } else { s += "is a network wrapper."; } s += "\n"; } return s; }