20 return options.
check(
"type",
Value(
"none")).asString() ==
"RFModule";
62 return mPriv->command;
67 return mPriv->module->getThreadKey();
72 mPriv->module->stopModule();
77 return !mPriv->module->isStopping();
90 char* p2 = strtok(str,
" ");
91 while ((p2 !=
nullptr) && argc < kMaxArgs - 1) {
93 p2 = strtok(
nullptr,
" ");
96 return std::make_pair(argc, argv);
102 std::string name = inCommand.substr(0, inCommand.find(
' '));
104 char* str =
new char[inCommand.size() + 1];
105 memcpy(str, inCommand.c_str(), inCommand.size());
106 str[inCommand.size()] =
'\0';
108 mPriv->command = inCommand;
115 if (staticmodule !=
nullptr) {
117 if (!staticmodule->configure(rf)) {
121 mPriv->module = staticmodule;
135 if (!settings.
setSelector(mPriv->shared->selector)) {
138 if (!mPriv->shared->yarpPlugin.open(settings)) {
142 mPriv->shared->sharedLibClass.open(*mPriv->shared->yarpPlugin.getFactory());
144 if (!mPriv->shared->sharedLibClass.isValid()) {
149 settings.
setClassInfo(mPriv->shared->yarpPlugin.getFactory()->getClassName(), mPriv->shared->yarpPlugin.getFactory()->getBaseClassName());
153 ret = mPriv->shared->sharedLibClass.getContent().configure(rf);
159 mPriv->shared->sharedLibClass->runModuleThreaded();
161 mPriv->module = &(mPriv->shared->sharedLibClass.getContent());
std::pair< int, char ** > str2ArgcArgv(char *str)
static RFModuleFactory & GetInstance()
RFModule * GetModule(const std::string &name)
A base-class for standard YARP modules that supports ResourceFinder.
virtual int runModuleThreaded()
Calls updateModule() on a separate thread until that returns false.
virtual bool open(const std::string &command)
opens the plugin
virtual bool isRunning()
check if the plugin is running
virtual std::string getCmd()
get the command line used to open the plugin
virtual int getThreadKey()
get the thread id
virtual void close()
closes the plugin
Helper class for finding config files and other external resources.
bool configure(int argc, char *argv[], bool skipFirstArgument=true)
Sets up the ResourceFinder.
A base class for nested structures that can be searched.
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
A single value (typically within a Bottle).
Pick out a set of relevant plugins.
void scan()
Find plugin configuration files, and run [plugin] sections through the select method.
Collect hints for finding a particular plugin.
bool setSelector(YarpPluginSelector &selector)
Use a selector to find a plugin or plugins.
void setLibraryMethodName(const std::string &dll_name, const std::string &fn_name)
Set the name of the library to load and the method name to use as a factory.
void setPluginName(const std::string &name)
Set the name of the plugin to load.
std::string getMethodName() const
void setClassInfo(const std::string &class_name, const std::string &baseclass_name)
Set the information about the class and the base class constructed by this plugin.
An interface to the operating system, including Port based communication.
RFModuleSelector selector
YarpPlugin< RFModule > yarpPlugin
SharedLibraryClass< RFModule > sharedLibClass