31 #define HELPER(x) (*((DeviceGroupHelper*)(x)))
37 std::vector<PolyDriver *> drivers;
38 std::vector<std::string> names;
39 std::vector<bool> needDrive;
42 bool needDriveSummary{
false};
47 std::vector<PolyDriver *>& lst = drivers;
48 for (
unsigned int i=0; i<lst.size(); i++) {
49 yCInfo(DEVICEGROUP,
"*** Removing %s",names[i].c_str());
50 Drivers::factory().remove(names[i].c_str());
51 yCTrace(DEVICEGROUP,
"*** removed %s",names[i].c_str());
53 yCTrace(DEVICEGROUP,
"*** deleted %s",names[i].c_str());
63 std::vector<PolyDriver *>& lst = drivers;
64 for (
unsigned int i=0; i<lst.size(); i++) {
67 lst[i]->view(service);
68 if (service!=
nullptr) {
78 yCTrace(DEVICEGROUP,
"*** Device group closing");
80 yCTrace(DEVICEGROUP,
"*** Device group closed");
94 bool result = pd->open(config);
99 drivers.push_back(pd);
100 names.push_back(name);
103 bool backgrounded =
true;
104 if (service!=
nullptr) {
109 yCInfo(DEVICEGROUP,
"group: service backgrounded");
113 needDrive.push_back(!backgrounded);
114 needDriveSummary = needDriveSummary || (!backgrounded);
130 yCError(DEVICEGROUP,
"Out of memory");
134 if (config.
check(
"part",
"a list of section names, with each section containing a device")) {
137 for (
size_t i=0; i<bot.
size(); i++) {
139 yCInfo(DEVICEGROUP,
" %s -> %s", name.c_str(),
158 if (config.
check(key,name,comment)) {
162 p.setMonitor(config.getMonitor(),
166 p.
unput(
"subdevice");
171 poly.
open(subdevice);
178 yCError(DEVICEGROUP,
"\"--%s <name>\" not set", key);
185 bool DeviceGroup::closeMain()
187 yCInfo(DEVICEGROUP,
"Devices closing");
RandScalar * implementation(void *t)
bool add(const std::string &name, yarp::os::Searchable &config)
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
bool updateService() override
Give the service the chance to run for a while.
bool startService() override
Initiate the service, whatever it is.
A factory for creating links to a driver that has already been created.
Common interface for devices that act like services (by which we mean they do something for remote us...
virtual bool startService()
Initiate the service, whatever it is.
virtual bool updateService()
Give the service the chance to run for a while.
A container for a device driver.
bool isValid() const
Check if device is valid.
bool open(const std::string &txt)
Construct and configure a device by its common name.
A simple collection of objects that can be described and transmitted in a portable way.
size_type size() const
Gets the number of elements in the bottle.
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
Bottle tail() const
Get all but the first element of a bottle.
std::string toString() const override
Gives a human-readable textual representation of the bottle.
A class for storing options and configuration information.
void fromString(const std::string &txt, bool wipe=true)
Interprets a string as a list of properties.
void put(const std::string &key, const std::string &value)
Associate the given key with the given string.
void unput(const std::string &key)
Remove the association from the given key to a value, if present.
A base class for nested structures that can be searched.
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
virtual std::string toString() const =0
Return a standard text representation of the content of the object.
virtual Bottle & findGroup(const std::string &key) const =0
Gets a list corresponding to a given keyword.
A single value (typically within a Bottle).
virtual bool isString() const
Checks if value is a string.
std::string toString() const override
Return a standard text representation of the content of the object.
virtual std::string asString() const
Get string value.
#define yCInfo(component,...)
#define yCError(component,...)
#define yCAssert(component, x)
#define yCTrace(component,...)
#define YARP_LOG_COMPONENT(name,...)
An interface for the device drivers.
An interface to the operating system, including Port based communication.