YARP
Yet Another Robot Platform
WrapperMultiple.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 
8 #include <yarp/os/LogComponent.h>
9 
10 namespace {
11 YARP_LOG_COMPONENT(WRAPPERSINGLE, "yarp.dev.WrapperMultiple")
12 } // namespace
13 
14 
16 
17 
19 {
20  if (!driver || !driver->isValid()) {
21  yCError(WRAPPERSINGLE, "Could not attach an invalid device");
22  return false;
23  }
24 
26  drivers.push(driver, "...");
27 
28  return attachAll(drivers);
29 }
30 
31 
33 {
34  return detachAll();
35 }
virtual bool attachAll(const PolyDriverList &drivers)=0
Attach to a list of objects.
void push(PolyDriver *p, const char *k)
A container for a device driver.
Definition: PolyDriver.h:24
bool isValid() const
Check if device is valid.
Definition: PolyDriver.cpp:196
bool attach(PolyDriver *driver) final
Attach to another object.
bool detach() final
Detach the object (you must have first called attach).
~WrapperMultiple() override
Destructor.
#define yCError(component,...)
Definition: LogComponent.h:154
#define YARP_LOG_COMPONENT(name,...)
Definition: LogComponent.h:77