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 {
14 namespace dev {
15 
16 
23  public DeviceDriver
24 {
25 public:
26  using DeviceDriver::open;
27 
31  PolyDriver();
32 
37  PolyDriver(const std::string& txt);
38 
48 
52  virtual ~PolyDriver();
53 
54  PolyDriver(const PolyDriver& alt) = delete;
55  const PolyDriver& operator=(const PolyDriver& alt) = delete;
56 
62  bool open(const std::string& txt);
63 
73  bool open(yarp::os::Searchable& config) override;
74 
82  bool link(PolyDriver& alt);
83 
84 
90  DeviceDriver *take();
91 
99  bool give(DeviceDriver *dd, bool own);
100 
101  bool close() override;
102 
107  bool isValid() const;
108 
115  yarp::os::Bottle getOptions();
116 
123  std::string getComment(const char *option);
124 
131  yarp::os::Value getDefaultValue(const char *option);
132 
139  yarp::os::Value getValue(const char *option);
140 
141  DeviceDriver *getImplementation() override;
142 
143 private:
144  DeviceDriver *dd;
145 
146  bool coreOpen(yarp::os::Searchable& config);
147 
148 #ifndef DOXYGEN_SHOULD_SKIP_THIS
149  class Private;
150  Private* mPriv;
151 #endif
152 };
153 
154 } // namespace dev
155 } // namespace yarp
156 
157 #endif // YARP_DEV_POLYDRIVER_H
Interface implemented by all device drivers.
Definition: DeviceDriver.h:35
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
Definition: DeviceDriver.h:55
A container for a device driver.
Definition: PolyDriver.h:24
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:74
A base class for nested structures that can be searched.
Definition: Searchable.h:66
A single value (typically within a Bottle).
Definition: Value.h:45
bool isValid()
Check if time is valid (non-zero).
Definition: Time.cpp:314
The main, catch-all namespace for YARP.
Definition: dirs.h:16
#define YARP_dev_API
Definition: api.h:18