Ejemplo n.º 1
0
 /**
  * Create accessor Object for this Port, for addition to a
  * TaskContext Object interface.
  */
 virtual Service* createPortObject()
 {
     Service* object = base::InputPortInterface::createPortObject();
     // Force resolution on the overloaded write method
     typedef FlowStatus (InputPort<T>::*ReadSample)(typename base::ChannelElement<T>::reference_t);
     ReadSample read_m = &InputPort<T>::read;
     object->addSynchronousOperation("read", read_m, this).doc("Reads a sample from the port.").arg("sample", "");
     object->addSynchronousOperation("clear", &InputPortInterface::clear, this).doc("Clears any remaining data in this port. After a clear, a read() will return NoData if no writes happened in between.");
     return object;
 }
Ejemplo n.º 2
0
 /**
  * Create accessor Object for this Port, for addition to a
  * TaskContext Object interface.
  */
 virtual Service* createPortObject()
 {
     Service* object = base::OutputPortInterface::createPortObject();
     // Force resolution on the overloaded write method
     typedef void (OutputPort<T>::*WriteSample)(T const&);
     WriteSample write_m = &OutputPort::write;
     typedef T (OutputPort<T>::*LastSample)() const;
     LastSample last_m = &OutputPort::getLastWrittenValue;
     object->addSynchronousOperation("write", write_m, this).doc("Writes a sample on the port.").arg("sample", "");
     object->addSynchronousOperation("last", last_m, this).doc("Returns last written value to this port.");
     return object;
 }
Ejemplo n.º 3
0
Service* PortInterface::createPortObject()
{
#ifndef ORO_EMBEDDED
    Service* to = new Service( this->getName(), iface->getOwner() );
    to->addSynchronousOperation( "name",&PortInterface::getName, this).doc(
            "Returns the port name.");
    to->addSynchronousOperation("connected", &PortInterface::connected, this).doc("Check if this port is connected and ready for use.");

    typedef void (PortInterface::*disconnect_all)();
    to->addSynchronousOperation("disconnect", static_cast<disconnect_all>(&PortInterface::disconnect), this).doc("Disconnects this port from any connection it is part of.");
    return to;
#else
    return 0;
#endif
}