YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
Drivers.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <yarp/dev/Drivers.h>
8
9#include <yarp/conf/string.h>
10
11#include <yarp/os/Log.h>
13#include <yarp/os/Os.h>
14#include <yarp/os/Property.h>
16#include <yarp/os/Time.h>
17#include <yarp/os/Network.h>
18#include <yarp/os/Terminator.h>
19#include <yarp/os/YarpPlugin.h>
20#include <yarp/dev/PolyDriver.h>
23
24#include <map>
25#include <vector>
26#include <sstream>
27#include <iterator>
28#include <csignal>
29
30using namespace yarp::os;
31using namespace yarp::dev;
32
33namespace {
34YARP_LOG_COMPONENT(DRIVERS, "yarp.dev.Drivers")
35}
36
38public:
39 std::vector<DriverCreator *> delegates;
40
41 // Maps a deprecated alias name to the canonical (official) device name.
42 std::map<std::string, std::string> deprecatedAliases;
43
44 ~Private() override {
45 for (auto& delegate : delegates) {
46 if (delegate==nullptr) {
47 continue;
48 }
49 delete delegate;
50 }
51 delegates.clear();
52 }
53
54 bool select(Searchable& options) override {
55 return options.check("type",Value("none")).asString() == "device";
56 }
57
58 std::string toString() {
59 std::string s;
60 Property done;
61 for (auto& delegate : delegates) {
62 if (delegate==nullptr) {
63 continue;
64 }
65 std::string name = delegate->getName();
66 done.put(name,1);
67 std::string wrapper = delegate->getWrapper();
68 s += "Device \"";
69 s += delegate->getName();
70 s += "\"";
71 s += ",";
72 s += " C++ class ";
73 s += delegate->getCode();
74 s += ", ";
75 if (wrapper.empty()) {
76 s += "has no network wrapper";
77 } else if (wrapper!=name) {
78 s += "wrapped by \"";
79 s += delegate->getWrapper();
80 s += "\"";
81 } else {
82 s += "is a network wrapper.";
83 }
84 s += "\n";
85 }
86
87 scan();
89 for (size_t i=0; i<lst.size(); i++) {
90 Value& prop = lst.get(i);
91 std::string name = prop.check("name",Value("untitled")).asString();
92 if (done.check(name)) {
93 continue;
94 }
95
97 YarpPluginSettings settings;
98 settings.setSelector(*this);
99 settings.readFromSearchable(prop,name);
100 settings.open(lib);
101 std::string location = lib.getName();
102 if (location.empty()) {
103 // A wrong library name ends up with empty location
104 yCWarning(DRIVERS, "Wrong library name for plugin %s", name.c_str());
105 continue;
106 }
107
108 std::string cxx = prop.check("cxx",Value("unknown")).asString();
109 std::string wrapper = prop.check("wrapper",Value("unknown")).asString();
110 s += "Device \"";
111 s += name;
112 s += "\"";
113 s += ",";
114 s += " available on request (found in ";
115 s += location;
116 s += " library)";
117 if (cxx!="unknown") {
118 s += ", C++ class ";
119 s += cxx;
120 s += " ";
121 }
122
123 if (wrapper.empty()) {
124 s += "no network wrapper known"; // will never come here since the prop.check fallback is set to unknown few lines above!!!
125 } else if (wrapper=="unknown") {
126 //s += "network wrapper unknown";
127 } else if (wrapper!=name) {
128 s += ", wrapped by \"";
129 s += wrapper;
130 s += "\"";
131 } else {
132 s += ", is a network wrapper";
133 }
134 s += ".\n";
135 }
136
137 return s;
138 }
139
141 if (creator!=nullptr) {
142 delegates.push_back(creator);
143 }
144 }
145
146 DriverCreator *load(const std::string& name);
147
148 DriverCreator *find(const std::string& name) {
149 // Check if the requested name is a deprecated alias.
150 auto aliasIt = deprecatedAliases.find(std::string(name));
151 if (aliasIt != deprecatedAliases.end()) {
152 const std::string& canonical = aliasIt->second;
154 "Device name '%s' is deprecated. The official name is '%s'. "
155 "The program will continue without any issue, but please update your configuration as soon as possible.",
156 name.c_str(),
157 canonical.c_str());
158 return find(canonical.c_str());
159 }
160
161 for (auto& delegate : delegates) {
162 if (delegate == nullptr) {
163 continue;
164 }
165 std::string s = delegate->toString();
166 if (s==name) {
167 return delegate;
168 }
169 }
170 return load(name);
171 }
172
173 bool remove(const std::string& name) {
174 for (auto& delegate : delegates) {
175 if (delegate == nullptr) {
176 continue;
177 }
178 std::string s = delegate->toString();
179 if (s==name) {
180 delete delegate;
181 delegate = nullptr;
182 }
183 }
184 return false;
185 }
186};
187
188class StubDriver : public DeviceDriver {
189private:
190 YarpPluginSettings settings;
193public:
194 StubDriver(const std::string& dll_name, const std::string& fn_name) {
195 settings.setLibraryMethodName(dll_name,fn_name);
196 init();
197 }
198
199 StubDriver(const std::string& name) {
200 settings.setPluginName(name);
201 YarpPluginSelector selector;
202 selector.scan();
203 if (!settings.setSelector(selector)) {
204 return;
205 }
206 init();
207 }
208
209 virtual ~StubDriver() = default;
210
211 void init() {
212 if (plugin.open(settings)) {
213 dev.open(*plugin.getFactory());
214 settings.setLibraryMethodName(plugin.getFactory()->getName(),
215 settings.getMethodName());
216 settings.setClassInfo(plugin.getFactory()->getClassName(),
217 plugin.getFactory()->getBaseClassName());
218 }
219 }
220
221 bool isValid() const {
222 return dev.isValid();
223 }
224
225 bool open(yarp::os::Searchable& config) override {
226 if (!isValid()) {
227 return false;
228 }
229 return dev.getContent().open(config);
230 }
231
232 bool close() override {
233 if (!isValid()) {
234 return false;
235 }
236 return dev.getContent().close();
237 }
238
239 void setId(const std::string& id) override
240 {
241 if (!isValid()) {
242 return;
243 }
244 dev.getContent().setId(id);
245 }
246
247 std::string id() const override
248 {
249 if (!isValid()) {
250 return "StubDriver";
251 }
252 return dev.getContent().id();
253 }
254
256 return &dev.getContent();
257 }
258
259 std::string getDllName() const {
260 return settings.getLibraryName();
261 }
262
263 std::string getFnName() const {
264 return settings.getMethodName();
265 }
266
267 std::string getwrapName() const {
268 return settings.getWrapperName();
269 }
270
271 std::string getPluginName() const {
272 return settings.getPluginName();
273 }
274
275 std::string getClassName() const {
276 return settings.getClassName();
277 }
278
279 std::string getBaseClassName() const {
280 return settings.getBaseClassName();
281 }
282};
283
285{
286 static Drivers instance;
287 return instance;
288}
289
290Drivers::Drivers() :
291 mPriv(new Private)
292{
293}
294
296 delete mPriv;
297}
298
299std::string Drivers::toString() const {
300 return mPriv->toString();
301}
302
304 mPriv->add(creator);
305}
306
307
308DriverCreator *Drivers::find(const std::string& name) {
309 return mPriv->find(name);
310}
311
312bool Drivers::remove(const std::string& name) {
313 return mPriv->remove(name);
314}
315
316void Drivers::addDeprecatedAlias(const std::string& alias, const std::string& canonical)
317{
318 mPriv->deprecatedAliases[alias] = canonical;
319}
320
321
323 PolyDriver poly;
324 bool result = poly.open(prop);
325 if (!result) {
326 return nullptr;
327 }
328 return poly.take();
329}
330
331DriverCreator* Drivers::Private::load(const std::string& name) {
332 // Before attempting a direct plugin lookup, check if "name" is a
333 // deprecated alias registered in any .ini file (via "deprecated_alias" field).
334 YarpPluginSelector selector;
335 selector.scan();
336 auto staticAliases = selector.getDeprecatedAliases();
337 auto it = staticAliases.find(name);
338 if (it != staticAliases.end()) {
339 const std::string& canonical = it->second;
341 "Device name '%s' is a deprecated alias. The official name is '%s'. "
342 "The program will continue, but please update your configuration.",
343 name.c_str(),
344 canonical.c_str());
345 return load(canonical);
346 }
347
348 auto* result = new StubDriver(name);
349 if (!result->isValid()) {
350 delete result;
351 result = nullptr;
352 return nullptr;
353 }
354 DriverCreator *creator = new StubDriverCreator(result->getPluginName().c_str(),
355 result->getwrapName().c_str(),
356 result->getClassName().c_str(),
357 result->getDllName().c_str(),
358 result->getFnName().c_str());
359 add(creator);
360 delete result;
361 return creator;
362}
363
364static std::string terminatorKey;
365static bool terminated = false;
366static void handler (int)
367{
369 static double handleTime = -100;
370 static int ct = 0;
371 double now = Time::now();
372 if (now-handleTime<1) {
373 return;
374 }
375 handleTime = now;
376 ct++;
377 if (ct>3) {
378 yCInfo(DRIVERS, "Aborting...");
379 std::exit(1);
380 }
381 if (!terminatorKey.empty()) {
382 yCInfo(DRIVERS, "[try %d of 3] Trying to shut down %s", ct, terminatorKey.c_str());
383 terminated = true;
385 } else {
386 yCInfo(DRIVERS, "Aborting...");
387 std::exit(1);
388 }
389}
390
391int levenshteinDistance(const std::string& s1, const std::string& s2)
392{
393 int len1 = s1.size();
394 int len2 = s2.size();
395 std::vector<std::vector<int>> dp(len1 + 1, std::vector<int>(len2 + 1));
396
397 for (int i = 0; i <= len1; ++i)
398 dp[i][0] = i;
399 for (int j = 0; j <= len2; ++j)
400 dp[0][j] = j;
401
402 for (int i = 1; i <= len1; ++i) {
403 for (int j = 1; j <= len2; ++j) {
404 if (s1[i - 1] == s2[j - 1])
405 dp[i][j] = dp[i - 1][j - 1];
406 else
407 dp[i][j] = 1 + std::min({dp[i - 1][j], dp[i][j - 1], dp[i - 1][j - 1]});
408 }
409 }
410 return dp[len1][len2];
411}
412
413std::string toLowerCase(const std::string& str)
414{
415 std::string lowerStr = str;
416 std::transform(lowerStr.begin(), lowerStr.end(), lowerStr.begin(), ::tolower);
417 return lowerStr;
418}
419
420int Drivers::yarpdev(int argc, char *argv[]) {
421
422 std::signal(SIGINT, handler);
423 std::signal(SIGTERM, handler);
424
425 // get command line options
427 rf.configure(argc, argv); // this will process --from FILE if present
428 Property options;
429
430 // yarpdev will by default try to pass its thread on to the device.
431 // this is because some libraries need configuration and all
432 // access methods done in the same thread.
433 options.put("single_threaded", 1);
434
435 // interpret command line options as a set of flags
436 //options.fromCommand(argc,argv,true,false);
437 options.fromString(rf.toString(), false);
438
439 // check if we're being asked to read the options from file
440 Value *val;
441 if (options.check("file",val)) {
442 yCError(DRIVERS, "*** yarpdev --file is deprecated, please use --from");
443 return 0;
444 }
445
446 // print the full list of devices, if requested
447 if (options.check("list")) {
448 yCInfo(DRIVERS, "Here are devices listed for your system:");
449 for (const auto& s : yarp::conf::string::split(Drivers::factory().toString(), '\n')) {
450 yCInfo(DRIVERS, "%s", s.c_str());
451 }
452 return 0;
453 }
454
455 // check if we want to use nested options (less ambiguous)
456 if (options.check("nested", val) || options.check("lispy", val)) {
457 std::string lispy = val->toString();
458 yCDebug(DRIVERS, "yarpdev: working with config %s", lispy.c_str());
459 options.fromString(lispy);
460 }
461
462 // no device mentioned, neither in the option, nor in configuration file - maybe user needs help
463 if (!options.check("device") && !options.check("from"))
464 {
465 yCInfo(DRIVERS, "Welcome to yarpdev, a program to create YARP devices");
466 yCInfo(DRIVERS, "To see the devices available, try:");
467 yCInfo(DRIVERS, " yarpdev --list");
468 yCInfo(DRIVERS, "To create a device whose name you know, call yarpdev like this:");
469 yCInfo(DRIVERS, " yarpdev --device DEVICENAME --OPTION VALUE ...");
470 yCInfo(DRIVERS, " For example:");
471 yCInfo(DRIVERS, " yarpdev --device fakeFrameGrabber --width 32 --height 16 --name /grabber");
472 yCInfo(DRIVERS, "If the device supports it, you can check its configuration parameters using the --help option");
473 yCInfo(DRIVERS, "You can always move options to a configuration file:");
474 yCInfo(DRIVERS, " yarpdev [--device DEVICENAME] --from CONFIG_FILENAME");
475 yCError(DRIVERS,"Device name not specified");
476 return 0;
477 }
478
479 //The following syntax is deprecated: generate an error!
480 if (options.check("device") && options.check("subdevice"))
481 {
482 std::string dev_name = options.find("device").asString();
483 std::string subdev_name = options.find("subdevice").asString();
484 yCError(DRIVERS, "The syntax:");
485 yCError(DRIVERS, "yarpdev --device %s --subdevice %s", dev_name.c_str(), subdev_name.c_str());
486 yCError(DRIVERS, "has been deprecated.");
487 yCError(DRIVERS, "Use the following command line instead:");
488 yCError(DRIVERS, "yarpdev --device deviceBundler --wrapper_device %s --attached_device %s", dev_name.c_str(), subdev_name.c_str());
489 return 0;
490 }
491
492 //yarpdev enables the wrapping mechanism, which is not enabled by default if,
493 //for example a device is opened from the code, using PolyDriver.open()
494 //When enabled, it asks for a wrapped, remotable device rather than raw device
495 options.put("wrapping_enabled","1");
496
497 //YarpDevMonitor monitor;
498 if (options.check("verbose")) {
499 yCWarning(DRIVERS, "The verbose option is deprecated.");
500 }
501
502 // we now need network
503 bool ret=Network::checkNetwork();
504 if (!ret) {
505 yCError(DRIVERS, "YARP network not available, check if yarp server is reachable");
506 return -1;
507 }
508
509 //
510 // yarpdev initializes the clock only before starting to do real thing.
511 // This way yarpdev --lish/help will not be affected by network clock.
512 //
513 // Shall other devices be affected by network clock ??
514 // Hereafter the device may need to use the SystemClock or the NetworkClock
515 // depending by the device, a real or a fake / simulated one.
516 // Using the YARP_CLOCK_DEFAULT the behaviour will be determined by the
517 // environment variable.
518 //
520
521 // Finally open the device driver
522 PolyDriver dd(options);
523 std::string id = dd.id();
524
525 //if the device.open() failed...
526 if (!dd.isValid())
527 {
528 yCIError(DRIVERS, id, "yarpdev: ***ERROR*** device not available.");
529 yCIInfo(DRIVERS, id, "+ Suggestions:");
530 //The following code print suggestions, i.e. devices with similar names
532 yps.scan();
533 yarp::os::Bottle b = yps.getSelectedPlugins();
534 std::string dev_name = options.find("device").asString();
535 for (size_t i = 0; i < b.size(); i++)
536 {
537 Value& plugv = b.get(i);
538 std::string similar_name = plugv.check("name", Value("untitled")).asString();
540 if (distance < 5)
541 {
542 yCIInfo(DRIVERS, id, "%s", similar_name.c_str());
543 }
544 else
545 {
546 std::string lowerStr = toLowerCase(similar_name);
547 std::string lowerSub = toLowerCase(dev_name);
548 if (lowerStr.find(lowerSub) != std::string::npos)
549 {
550 yCIInfo(DRIVERS, id, "%s", similar_name.c_str());
551 }
552 }
553 }
554 yCIInfo(DRIVERS, id, "+ Do \"yarpdev --list\" to see list of supported devices.");
555 return 1;
556 }
557
558 Terminee *terminee = nullptr;
559 if (dd.isValid())
560 {
561 Value *v;
562 std::string name;
563 if (options.check("name", v))
564 {
565 name = v->toString();
566 }
567 if (name.empty() && options.check("device", v))
568 {
569 //get the name of the device from the polydriver
570 //TO BE IMPLEMENTED. FOR REFERENCE ONLY:
571 //name = dd.getDefaultValue((device_name + ".name").c_str()).toString();
572 }
573 if (name.empty())
574 {
575 name = "/yarpdev";
576 }
577 std::string s = name + "/quit";
578
579 if (s.find('=') == std::string::npos &&
580 s.find('@') == std::string::npos) {
581 terminee = new Terminee(s.c_str());
582 terminatorKey = s;
583 if (terminee == nullptr) {
584 yCIError(DRIVERS, id, "Can't allocate terminator port");
585 terminatorKey = "";
586 dd.close();
587 return 1;
588 }
589 if (!terminee->isOk()) {
590 yCIError(DRIVERS, id, "Failed to create terminator port");
591 terminatorKey = "";
592 delete terminee;
593 terminee = nullptr;
594 dd.close();
595 return 1;
596 }
597 }
598 }
599
600 double dnow = 3;
601 double startTime = Time::now()-dnow;
602 IService *service = nullptr;
603 dd.view(service);
604 if (service!=nullptr) {
605 bool backgrounded = service->startService();
606 if (backgrounded) {
607 // we don't need to poll this, so forget about the
608 // service interface
609 yCIDebug(DRIVERS, id, "yarpdev: service backgrounded");
610 service = nullptr;
611 }
612 }
613 while (dd.isValid() && !(terminated||(terminee&&terminee->mustQuit()))) {
614 if (service!=nullptr) {
615 double now = Time::now();
616 if (now-startTime>dnow) {
617 yCIInfo(DRIVERS, id, "device active...");
618 startTime += dnow;
619 }
620 // we requested single threading, so need to
621 // give the device its chance
622 if(!service->updateService()) {
623 if(!service->stopService()) {
624 yCIWarning(DRIVERS, id, "Error while stopping device");
625 }
626 terminated = true;
627 }
628 } else {
629 // we don't need to do anything
630 yCIInfo(DRIVERS, id, "device active in background...");
632 }
633 }
634
635 if (terminee) {
636 delete terminee;
637 terminee = nullptr;
638 }
639 dd.close();
640
641 yCIInfo(DRIVERS, id, "yarpdev is finished.");
642
643 return 0;
644}
645
647 yCTrace(DRIVERS, "Creating %s from %s", desc.c_str(), libname.c_str());
648 auto* result = new StubDriver(libname.c_str(),fnname.c_str());
649 if (result==nullptr) {
650 return result;
651 }
652 if (!result->isValid()) {
653 delete result;
654 result = nullptr;
655 return nullptr;
656 }
657 yCTrace(DRIVERS, "Created %s from %s", desc.c_str(), libname.c_str());
658 return result;
659}
static std::string terminatorKey
Definition Drivers.cpp:364
int levenshteinDistance(const std::string &s1, const std::string &s2)
Definition Drivers.cpp:391
static bool terminated
Definition Drivers.cpp:365
std::string toLowerCase(const std::string &str)
Definition Drivers.cpp:413
static void handler(int sig)
Definition RFModule.cpp:241
classes to handle graceful process termination.
bool remove(const std::string &name)
Definition Drivers.cpp:173
void add(DriverCreator *creator)
Definition Drivers.cpp:140
DriverCreator * load(const std::string &name)
Definition Drivers.cpp:331
DriverCreator * find(const std::string &name)
Definition Drivers.cpp:148
std::map< std::string, std::string > deprecatedAliases
Definition Drivers.cpp:42
std::vector< DriverCreator * > delegates
Definition Drivers.cpp:39
bool select(Searchable &options) override
Determine whether a plugin is of interest.
Definition Drivers.cpp:54
std::string getPluginName() const
Definition Drivers.cpp:271
virtual ~StubDriver()=default
std::string getFnName() const
Definition Drivers.cpp:263
void setId(const std::string &id) override
Set the id for this device.
Definition Drivers.cpp:239
std::string getClassName() const
Definition Drivers.cpp:275
std::string getDllName() const
Definition Drivers.cpp:259
std::string getBaseClassName() const
Definition Drivers.cpp:279
std::string getwrapName() const
Definition Drivers.cpp:267
DeviceDriver * getImplementation() override
Some drivers are bureaucrats, pointing at others.
Definition Drivers.cpp:255
void init()
Definition Drivers.cpp:211
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
Definition Drivers.cpp:225
std::string id() const override
Return the id assigned to the PolyDriver.
Definition Drivers.cpp:247
StubDriver(const std::string &dll_name, const std::string &fn_name)
Definition Drivers.cpp:194
bool close() override
Close the DeviceDriver.
Definition Drivers.cpp:232
bool isValid() const
Definition Drivers.cpp:221
StubDriver(const std::string &name)
Definition Drivers.cpp:199
Interface implemented by all device drivers.
virtual std::string id() const
Return the id assigned to the PolyDriver.
bool view(T *&x)
Get an interface to the device driver.
A base class for factories that create driver objects.
Definition Drivers.h:27
Global factory for devices.
Definition Drivers.h:171
static int yarpdev(int argc, char *argv[])
Body of the yarpdev program for starting device wrappers.
Definition Drivers.cpp:420
void addDeprecatedAlias(const std::string &alias, const std::string &canonical)
Register a deprecated alias for a device name.
Definition Drivers.cpp:316
DriverCreator * find(const std::string &name)
Find the factory for a named device.
Definition Drivers.cpp:308
virtual ~Drivers()
Destructor.
Definition Drivers.cpp:295
bool remove(const std::string &name)
Remove a factory for a named device.
Definition Drivers.cpp:312
static Drivers & factory()
Get the global factory for devices.
Definition Drivers.cpp:284
void add(DriverCreator *creator)
Add a factory for creating a particular device.
Definition Drivers.cpp:303
virtual std::string toString() const
A description of the available devices.
Definition Drivers.cpp:299
DeviceDriver * open(const std::string &device)
Create and configure a device, by name.
Definition Drivers.h:189
Common interface for devices that act like services (by which we mean they do something for remote us...
virtual bool startService()
Initiate the service, whatever it is.
virtual bool stopService()
Shut down the service, whatever it is.
virtual bool updateService()
Give the service the chance to run for a while.
A container for a device driver.
Definition PolyDriver.h:23
DeviceDriver * take()
Gets the device this object manages.
bool close() override
Close the DeviceDriver.
bool isValid() const
Check if device is valid.
bool open(const std::string &txt)
Construct and configure a device by its common name.
A factory for creating driver objects from DLLs / shared libraries.
Definition Drivers.h:129
DeviceDriver * create() const override
Create a device.
Definition Drivers.cpp:646
A simple collection of objects that can be described and transmitted in a portable way.
Definition Bottle.h:64
size_type size() const
Gets the number of elements in the bottle.
Definition Bottle.cpp:252
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
Definition Bottle.cpp:247
A mini-server for performing network communication in the background.
std::string getName() const override
Get name of port.
void close() override
Stop port activity.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
static void yarpClockInit(yarp::os::yarpClockType clockType, Clock *custom=nullptr)
This function specifically initialize the clock In case clockType is one of the valid cases: YARP_CLO...
Definition Network.cpp:1046
A class for storing options and configuration information.
Definition Property.h:32
Value & find(const std::string &key) const override
Gets a value corresponding to a given keyword.
void fromString(const std::string &txt, bool wipe=true)
Interprets a string as a list of properties.
void put(const std::string &key, const std::string &value)
Associate the given key with the given string.
Definition Property.cpp:980
bool check(const std::string &key) const override
Check if there exists a property of the given name.
Helper class for finding config files and other external resources.
bool configure(int argc, char *argv[], bool skipFirstArgument=true)
Sets up the ResourceFinder.
std::string toString() const override
Return a standard text representation of the content of the object.
A base class for nested structures that can be searched.
Definition Searchable.h:31
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
A wrapper for a named factory method in a named shared library.
std::string getName() const
Get the name associated with this factory.
static void delaySystem(double seconds)
static bool terminateByName(const char *name)
Send a quit message to a specific socket port.
A class that can be polled to see whether the process has been asked to quit gracefully.
Definition Terminator.h:47
A single value (typically within a Bottle).
Definition Value.h:44
std::string toString() const override
Return a standard text representation of the content of the object.
Definition Value.cpp:347
bool check(const std::string &key) const override
Check if there exists a property of the given name.
Definition Value.cpp:312
virtual std::string asString() const
Get string value.
Definition Value.cpp:240
Pick out a set of relevant plugins.
void scan()
Find plugin configuration files, and run [plugin] sections through the select method.
std::map< std::string, std::string > getDeprecatedAliases() const
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.
bool open(SharedLibraryFactory &factory)
Initialize a factory object based on the hints available.
bool readFromSearchable(Searchable &options, const std::string &name)
Configure settings from a configuration file or other searchable object.
void setPluginName(const std::string &name)
Set the name of the plugin to load.
std::string getBaseClassName() 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.
#define yCInfo(component,...)
#define yCError(component,...)
#define yCTrace(component,...)
#define yCWarning(component,...)
#define yCIError(component, id,...)
#define yCDebug(component,...)
#define YARP_LOG_COMPONENT(name,...)
#define yCIInfo(component, id,...)
#define yCIDebug(component, id,...)
#define yCIWarning(component, id,...)
ContainerT split(const typename ContainerT::value_type &s, std::basic_regex< typename ContainerT::value_type::value_type > regex)
Utility to split a string by a separator, into a vector of strings.
Definition string.h:26
For streams capable of holding different kinds of content, check what they actually have.
void useSystemClock()
Configure YARP to use system time (this is the default).
Definition Time.cpp:137
double now()
Return the current time in seconds, relative to an arbitrary starting point.
Definition Time.cpp:121
An interface to the operating system, including Port based communication.
@ YARP_CLOCK_DEFAULT
Definition Time.h:27