InPortPullConnector class. More...
#include <InPortPullConnector.h>
Public Member Functions | |
DATAPORTSTATUS_ENUM | InPortPullConnector (ConnectorInfo info, OutPortConsumer *consumer, ConnectorListeners &listeners, CdrBufferBase *buffer=0) |
Constructor. | |
virtual | ~InPortPullConnector () |
Destructor. | |
virtual ReturnCode | read (cdrMemoryStream &data) |
Destructor. | |
virtual ReturnCode | disconnect () |
Disconnect connection. | |
virtual void | activate () |
Connector activation. | |
virtual void | deactivate () |
Connector deactivation. | |
Protected Member Functions | |
CdrBufferBase * | createBuffer (ConnectorInfo &info) |
create buffer | |
void | onConnect () |
Invoke callback when connection is established. | |
void | onDisconnect () |
Invoke callback when connection is destroied. |
InPortPullConnector class.
Connector class of InPort for pull type dataflow. When "pull" is specified as dataflow_type at the time of establishing connection, this object is generated and owned by the InPort. This connector and InPortPullConnector make a pair and realize pull type dataflow of data ports. One connector corresponds to one connection which provides a data stream. Connector is distinguished by ID of the UUID that is generated at establishing connection.
InPortPullConnector owns and manages the following objects.
Data written into the OutPort is passed to the OutPortPullConnector::write(), and is written into the buffer. Consequently, InPort::read() and InPortPullConnector::read() call OutPortConsumer::get(), and it reads data from the buffer of OutPortPullConnector. Finally data would be written into the InPortPullConnector's buffer.
DATAPORTSTATUS_ENUM RTC::InPortPullConnector::InPortPullConnector | ( | ConnectorInfo | info, | |
OutPortConsumer * | consumer, | |||
ConnectorListeners & | listeners, | |||
CdrBufferBase * | buffer = 0 | |||
) |
Constructor.
InPortPullConnector's constructor is given the following arguments. According to ConnectorInfo which includes connection information, a buffer is created. It is also given a pointer to the consumer object for the OutPort interface. The owner-ship of the pointer is owned by this OutPortPullConnector, it has responsibility to destruct the OutPortConsumer. OutPortPullConnector also has ConnectorListeners to provide event callback mechanisms, and they would be called at the proper timing. If data buffer is given by OutPortBase, the pointer to the buffer is also given as arguments.
info | ConnectorInfo | |
consumer | OutPortConsumer | |
listeners | ConnectorListeners type lsitener object list | |
buffer | CdrBufferBase type buffer |
virtual RTC::InPortPullConnector::~InPortPullConnector | ( | ) | [virtual] |
Destructor.
This operation calls disconnect(), which destructs and deletes the consumer, the publisher and the buffer.
virtual void RTC::InPortPullConnector::activate | ( | ) | [inline, virtual] |
CdrBufferBase* RTC::InPortPullConnector::createBuffer | ( | ConnectorInfo & | info | ) | [protected] |
create buffer
This function creates a buffer based on given information.
info | Connector information |
virtual void RTC::InPortPullConnector::deactivate | ( | ) | [inline, virtual] |
virtual ReturnCode RTC::InPortPullConnector::disconnect | ( | ) | [virtual] |
void RTC::InPortPullConnector::onConnect | ( | ) | [protected] |
Invoke callback when connection is established.
void RTC::InPortPullConnector::onDisconnect | ( | ) | [protected] |
Invoke callback when connection is destroied.
virtual ReturnCode RTC::InPortPullConnector::read | ( | cdrMemoryStream & | data | ) | [virtual] |
Destructor.
This function get data from OutPortConsumer. If data is read properly, this function will return PORT_OK return code. Except normal return, BUFFER_EMPTY, TIMEOUT, PRECONDITION_NOT_MET and PORT_ERROR will be returned as error codes.
Implements RTC::InPortConnector.