24 return options.
check(
"type",
Value(
"none")).asString() ==
"RFModule";
53 RFPlugin::RFPlugin() :
65 return mPriv->command;
70 return mPriv->module->getThreadKey();
75 mPriv->module->stopModule();
80 return !mPriv->module->isStopping();
93 char* p2 = strtok(str,
" ");
94 while ((p2 !=
nullptr) && argc < kMaxArgs - 1) {
96 p2 = strtok(
nullptr,
" ");
99 return make_pair(argc, argv);
105 string name = inCommand.substr(0, inCommand.find(
' '));
107 char* str =
new char[inCommand.size() + 1];
108 memcpy(str, inCommand.c_str(), inCommand.size());
109 str[inCommand.size()] =
'\0';
111 mPriv->command = inCommand;
118 if (staticmodule !=
nullptr) {
120 if (!staticmodule->configure(rf)) {
124 mPriv->module = staticmodule;
138 if (!settings.
setSelector(mPriv->shared->selector)) {
141 if (!mPriv->shared->yarpPlugin.open(settings)) {
145 mPriv->shared->sharedLibClass.open(*mPriv->shared->yarpPlugin.getFactory());
147 if (!mPriv->shared->sharedLibClass.isValid()) {
152 settings.
setClassInfo(mPriv->shared->yarpPlugin.getFactory()->getClassName(), mPriv->shared->yarpPlugin.getFactory()->getBaseClassName());
156 ret = mPriv->shared->sharedLibClass.getContent().configure(rf);
162 mPriv->shared->sharedLibClass->runModuleThreaded();
164 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