Ejemplo n.º 1
0
bool DataPool::Connection::addPort(RTT::base::PortInterface *port) {
  RTT::base::InputPortInterface *inputPort   = dynamic_cast<RTT::base::InputPortInterface *>(port);
  RTT::base::OutputPortInterface *outputPort = dynamic_cast<RTT::base::OutputPortInterface *>(port);

  if (inputPort) {
    if (readers.count(inputPort)) {
      RTT::log(RTT::Error) << "InputPort " << inputPort->getName() << " is already a member of this connection" << RTT::endlog();
      return false;
    }
    readers.insert(inputPort);
    this->internalOutputPort->connectTo(inputPort);
    for(std::set<RTT::base::OutputPortInterface *>::iterator it = writers.begin(); it != writers.end(); ++it) (*it)->connectTo(inputPort);
    return true;
  }

  if (outputPort) {
    if (writers.count(outputPort)) {
      RTT::log(RTT::Error) << "OutputPort " << outputPort->getName() << " is already a member of this connection" << RTT::endlog();
      return false;
    }
    writers.insert(outputPort);
    outputPort->connectTo(this->internalInputPort);
    for(std::set<RTT::base::InputPortInterface *>::iterator it = readers.begin(); it != readers.end(); ++it) outputPort->connectTo(*it);
    return true;
  }

  return false;
}
Ejemplo n.º 2
0
 bool connectTo(InputProxyPort<T> &inputPort)
 {
     return port->connectTo(inputPort.port);
 };