22#include <yarp/os/Network.h>
27namespace learningmachine {
30 if(
this == &other)
return *
this;
32 this->IEventListener::operator=(other);
39 std::ostringstream buffer;
40 if(portName.empty()) {
46 }
while(yarp::os::Network::queryName(buffer.str().c_str()).isValid());
47 portName = buffer.str();
51 if(yarp::os::Network::queryName(portName.c_str()).isValid()) {
52 throw std::runtime_error(std::string(
"port already registered"));
54 this->
port.interrupt();
56 if(
port.open(portName.c_str()) !=
true) {
57 throw std::runtime_error(std::string(
"could not register port"));
66 if(!config.findGroup(
"verbose").isNull()) {
72 if(!config.findGroup(
"silent").isNull()) {
78 if(!config.findGroup(
"port").isNull()) {
79 this->
resetPort(config.findGroup(
"port").get(1).asString().c_str());
virtual bool configure(yarp::os::Searchable &config)
The abstract base class for EventListeners that output to a port.
yarp::os::Port port
The outgoing port for the events.
bool verbose
Verbosity controls whether events are printed to standard output.
std::string portPrefix
A prefix path for the ports that will be registered.
virtual IPortEventListener & operator=(const IPortEventListener &other)
Assignment operator.
virtual bool configure(yarp::os::Searchable &config)
void resetPort(std::string portName)
Resets the port and opens it at the specified name.
This file contains the definition of unique IDs for the body parts and the skin parts of the robot.