ForwardingCarrier(SharedLibraryClassFactory<Carrier> *factory, Carrier *owner) : factory(factory), owner(owner) { factory->addRef(); car.open(*factory); }
virtual ~ForwardingCarrier() { car.close(); if (!factory) return; factory->removeRef(); if (factory->getReferenceCount()<=0) { delete factory; } factory = YARP_NULLPTR; }
void init() { if (plugin.open(settings)) { dev.open(*plugin.getFactory()); settings.setLibraryMethodName(plugin.getFactory()->getName(), settings.getMethodName()); settings.setClassInfo(plugin.getFactory()->getClassName(), plugin.getFactory()->getBaseClassName()); } }
void init() { YarpPluginSelector selector; selector.scan(); settings.setSelector(selector); if (plugin.open(settings)) { dev.open(*plugin.getFactory()); settings.setLibraryMethodName(plugin.getFactory()->getName(), settings.getMethodName()); } }
bool isValid() { return car.isValid(); }
virtual Carrier& getContent() { return car.getContent(); }
DeviceDriver *getImplementation() override { return &dev.getContent(); }
virtual bool close() override { if (!isValid()) return false; return dev.getContent().close(); }
virtual bool open(yarp::os::Searchable& config) override { if (!isValid()) return false; return dev.getContent().open(config); }
bool isValid() const { return dev.isValid(); }
bool isValid() { return dev.isValid(); }