YARP
Yet Another Robot Platform
DriverLinkCreator.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_DRIVERLINKCREATOR_H
8#define YARP_DEV_DRIVERLINKCREATOR_H
9
10#include <yarp/dev/PolyDriver.h>
11#include <yarp/dev/Drivers.h>
12
13namespace yarp::dev {
14
20 public DriverCreator
21{
22private:
24 PolyDriver holding;
25
26public:
27 DriverLinkCreator(const std::string& name, PolyDriver& source);
28 virtual ~DriverLinkCreator() override;
29
30 std::string toString() const override
31 {
32 return name;
33 }
34
35 DeviceDriver *create() const override
36 {
37 DeviceDriver *internal;
38 const_cast<PolyDriver&>(holding).view(internal);
39 return internal;
40 }
41
42 std::string getName() const override
43 {
44 return name;
45 }
46
47 std::string getWrapper() const override
48 {
49 return "(link)";
50 }
51
52 std::string getCode() const override
53 {
54 return "DriverLinkCreator";
55 }
56
57 PolyDriver *owner() override
58 {
59 return &holding;
60 }
61
62 void close()
63 {
64 holding.close();
65 }
66};
67
68} // namespace yarp::dev
69
70#endif // YARP_DEV_DRIVERLINKCREATOR_H
Interface implemented by all device drivers.
Definition: DeviceDriver.h:30
A base class for factories that create driver objects.
Definition: Drivers.h:27
A factory for creating links to a driver that has already been created.
DeviceDriver * create() const override
Create a device.
std::string getCode() const override
Get the name of the C++ class associated with this device.
std::string getWrapper() const override
Get the common name of a device that can wrap this one.
std::string toString() const override
Returns a simple description of devices the factory can make.
PolyDriver * owner() override
For "links" to other devices.
std::string getName() const override
Get the common name of the device.
A container for a device driver.
Definition: PolyDriver.h:23
bool close() override
Close the DeviceDriver.
Definition: PolyDriver.cpp:173
For streams capable of holding different kinds of content, check what they actually have.
#define YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(x)
Suppress MSVC C4251 warning for the declaration.
Definition: system.h:338
#define YARP_dev_API
Definition: api.h:18