YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
WrapperSingle.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
7
9
10namespace {
11YARP_LOG_COMPONENT(WRAPPERSINGLE, "yarp.dev.WrapperSingle")
12} // namespace
13
14
16
17
19{
20 if (drivers.size() != 1) {
21 yCError(WRAPPERSINGLE, "Expected only one device to be attached");
22 return false;
23 }
24
25 if (!drivers[0]->poly || !drivers[0]->poly->isValid()) {
26 yCError(WRAPPERSINGLE, "Could not attach an invalid device");
27 return false;
28 }
29
30 return attach(drivers[0]->poly);
31}
32
33
35{
36 return detach();
37}
virtual bool attach(PolyDriver *driver)=0
Attach to another object.
~WrapperSingle() override
Destructor.
bool attachAll(const yarp::dev::PolyDriverList &drivers) final
Attach to a list of objects.
bool detachAll() final
Detach the object (you must have first called attach).
#define yCError(component,...)
#define YARP_LOG_COMPONENT(name,...)