|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
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");
A simple collection of objects that can be described and transmitted in a portable way.
std::string toString() const override
Gives a human-readable textual representation of the bottle.
void put(const std::string &key, const std::string &value)
Associate the given key with the given string.
A base class for nested structures that can be searched.
virtual bool startService()
Initiate the service, whatever it is.
size_type size() const
Gets the number of elements in the bottle.
bool updateService() override
Give the service the chance to run for a while.
virtual Bottle & findGroup(const std::string &key) const =0
Gets a list corresponding to a given keyword.
virtual std::string toString() const =0
Return a standard text representation of the content of the object.
void fromString(const std::string &txt, bool wipe=true)
Interprets a string as a list of properties.
bool isValid() const
Check if device is valid.
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
#define YARP_LOG_COMPONENT(name,...)
virtual bool updateService()
Give the service the chance to run for a while.
bool startService() override
Initiate the service, whatever it is.
bool open(const std::string &txt)
Construct and configure a device by its common name.
bool add(const std::string &name, yarp::os::Searchable &config)
An interface for the device drivers.
virtual bool isString() const
Checks if value is a string.
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
virtual std::string asString() const
Get string value.
A container for a device driver.
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
Common interface for devices that act like services (by which we mean they do something for remote us...
#define yCAssert(component, x)
Bottle tail() const
Get all but the first element of a bottle.
#define yCError(component,...)
#define yCInfo(component,...)
An interface to the operating system, including Port based communication.
A factory for creating links to a driver that has already been created.
RandScalar * implementation(void *t)
#define yCTrace(component,...)
std::string toString() const override
Return a standard text representation of the content of the object.
A single value (typically within a Bottle).
void unput(const std::string &key)
Remove the association from the given key to a value, if present.
A class for storing options and configuration information.