YARP
Yet Another Robot Platform
PolyDriver.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * Copyright (C) 2006-2010 RobotCub Consortium
4  * All rights reserved.
5  *
6  * This software may be modified and distributed under the terms of the
7  * BSD-3-Clause license. See the accompanying LICENSE file for details.
8  */
9 
10 #ifndef YARP_DEV_POLYDRIVER_H
11 #define YARP_DEV_POLYDRIVER_H
12 
13 #include <yarp/dev/api.h>
14 #include <yarp/dev/Drivers.h>
15 
16 namespace yarp {
17 namespace dev {
18 
19 
26  public DeviceDriver
27 {
28 public:
29  using DeviceDriver::open;
30 
34  PolyDriver();
35 
40  PolyDriver(const std::string& txt);
41 
51 
55  virtual ~PolyDriver();
56 
57  PolyDriver(const PolyDriver& alt) = delete;
58  const PolyDriver& operator=(const PolyDriver& alt) = delete;
59 
65  bool open(const std::string& txt);
66 
76  bool open(yarp::os::Searchable& config) override;
77 
85  bool link(PolyDriver& alt);
86 
87 
93  DeviceDriver *take();
94 
102  bool give(DeviceDriver *dd, bool own);
103 
104  bool close() override;
105 
110  bool isValid() const;
111 
118  yarp::os::Bottle getOptions();
119 
126  std::string getComment(const char *option);
127 
134  yarp::os::Value getDefaultValue(const char *option);
135 
142  yarp::os::Value getValue(const char *option);
143 
144  DeviceDriver *getImplementation() override;
145 
146 private:
147  DeviceDriver *dd;
148 
149  bool coreOpen(yarp::os::Searchable& config);
150 
151 #ifndef DOXYGEN_SHOULD_SKIP_THIS
152  class Private;
153  Private* mPriv;
154 #endif
155 };
156 
157 } // namespace dev
158 } // namespace yarp
159 
160 #endif // YARP_DEV_POLYDRIVER_H
yarp::os::Bottle
A simple collection of objects that can be described and transmitted in a portable way.
Definition: Bottle.h:73
yarp::os::Searchable
A base class for nested structures that can be searched.
Definition: Searchable.h:69
Drivers.h
yarp::dev::DeviceDriver::open
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
Definition: DeviceDriver.h:58
yarp::os::Time::isValid
bool isValid()
Check if time is valid (non-zero).
Definition: Time.cpp:317
yarp::dev::DeviceDriver
Interface implemented by all device drivers.
Definition: DeviceDriver.h:38
yarp::dev::PolyDriver::operator=
const PolyDriver & operator=(const PolyDriver &alt)=delete
yarp::dev::PolyDriver
A container for a device driver.
Definition: PolyDriver.h:27
yarp::dev::PolyDriver::PolyDriver
PolyDriver(const PolyDriver &alt)=delete
YARP_dev_API
#define YARP_dev_API
Definition: api.h:19
yarp::dev::PolyDriver::Private
Definition: PolyDriver.cpp:25
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::os::Value
A single value (typically within a Bottle).
Definition: Value.h:47
api.h