YARP
Yet Another Robot Platform
PolyDriver.h
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 #ifndef YARP_DEV_POLYDRIVER_H
8 #define YARP_DEV_POLYDRIVER_H
9 
10 #include <yarp/dev/api.h>
11 #include <yarp/dev/Drivers.h>
12 
13 namespace yarp::dev {
14 
15 
22  public DeviceDriver
23 {
24 public:
25  using DeviceDriver::open;
26 
30  PolyDriver();
31 
36  PolyDriver(const std::string& txt);
37 
47 
51  virtual ~PolyDriver();
52 
53  PolyDriver(const PolyDriver& alt) = delete;
54  const PolyDriver& operator=(const PolyDriver& alt) = delete;
55 
61  bool open(const std::string& txt);
62 
72  bool open(yarp::os::Searchable& config) override;
73 
81  bool link(PolyDriver& alt);
82 
83 
89  DeviceDriver *take();
90 
98  bool give(DeviceDriver *dd, bool own);
99 
100  bool close() override;
101 
106  bool isValid() const;
107 
114  yarp::os::Bottle getOptions();
115 
122  std::string getComment(const char *option);
123 
130  yarp::os::Value getDefaultValue(const char *option);
131 
138  yarp::os::Value getValue(const char *option);
139 
140  DeviceDriver *getImplementation() override;
141 
142 private:
143  DeviceDriver *dd;
144 
145  bool coreOpen(yarp::os::Searchable& config);
146 
147 #ifndef DOXYGEN_SHOULD_SKIP_THIS
148  class Private;
149  Private* mPriv;
150 #endif
151 };
152 
153 } // namespace yarp::dev
154 
155 #endif // YARP_DEV_POLYDRIVER_H
Interface implemented by all device drivers.
Definition: DeviceDriver.h:30
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
Definition: DeviceDriver.h:53
A container for a device driver.
Definition: PolyDriver.h:23
const PolyDriver & operator=(const PolyDriver &alt)=delete
PolyDriver(const PolyDriver &alt)=delete
A simple collection of objects that can be described and transmitted in a portable way.
Definition: Bottle.h:73
A base class for nested structures that can be searched.
Definition: Searchable.h:63
A single value (typically within a Bottle).
Definition: Value.h:43
For streams capable of holding different kinds of content, check what they actually have.
bool isValid()
Check if time is valid (non-zero).
Definition: Time.cpp:314
#define YARP_dev_API
Definition: api.h:18