OutPortConsumer abstract class. More...
#include <OutPortConsumer.h>
Classes | |
struct | subscribe |
Functor to subscribe the interface. More... | |
struct | unsubscribe |
Functor to unsubscribe the interface. More... | |
Public Member Functions | |
virtual ReturnCode | get (cdrMemoryStream &data)=0 |
Receive data. More... | |
virtual void | init (coil::Properties &prop)=0 |
Initializing configuration. More... | |
virtual void | setBuffer (CdrBufferBase *buffer)=0 |
Setting outside buffer's pointer. More... | |
virtual void | setListener (ConnectorInfo &info, ConnectorListeners *listeners)=0 |
Set the listener. More... | |
virtual bool | subscribeInterface (const SDOPackage::NVList &properties)=0 |
Subscribe the data receive notification. More... | |
virtual void | unsubscribeInterface (const SDOPackage::NVList &properties)=0 |
Unsubscribe the data receive notification. More... | |
virtual DATAPORTSTATUS_ENUM | ~OutPortConsumer (void) |
Destructor. More... | |
Protected Attributes | |
Logger | rtclog |
Logger stream. More... | |
Additional Inherited Members | |
Public Types inherited from RTC::DataPortStatus | |
enum | Enum { PORT_OK = 0, PORT_ERROR, BUFFER_ERROR, BUFFER_FULL, BUFFER_EMPTY, BUFFER_TIMEOUT, SEND_FULL, SEND_TIMEOUT, RECV_EMPTY, RECV_TIMEOUT, INVALID_ARGS, PRECONDITION_NOT_MET, CONNECTION_LOST, UNKNOWN_ERROR } |
DataPortStatus return codes. More... | |
Static Public Member Functions inherited from RTC::DataPortStatus | |
static const char * | toString (DataPortStatus::Enum status) |
Convert DataPortStatus into the string. More... | |
OutPortConsumer abstract class.
The virtual class for OutPort's PROVIDED interface implementation. New interface for OutPort have to inherit this class, and have to implement the following functions.
Furthermore, connecting or disconnecting processes, such as obtaining some information from ConnectorProfile or releasing some resources, should be implemented in the following virtual functions.
InPort inquires available OutPortConsumers to the factory class of OutPortConsumer, and publishes available interfaces to others. Therefore, sub-classes of OutPortConsumer that provides PROVIDED interface to OutPort should register its factory to OutPortConsumerFactory.
RTC::OutPortConsumerFactory::instance().addFactory() would be called with the following arguments.
1st arg: The name of provider. ex. "corba_cdr" 2nd arg: Factory function. coil::Creator<B, T> 3rd arg: Destruction function. coil::Destructor<B, T>
The following example shows how to register factory function. And it is also declared as a initialization function.
extern "C" { void OutPortCorbaCdrConsumerInit(void) { RTC::OutPortConsumerFactory& factory(RTC::OutPortConsumerFactory::instance()); factory.addFactory("corba_cdr", coil::Creator<RTC::OutPortConsumer, RTC::OutPortCorbaCdrConsumer>, coil::Destructor<RTC::OutPortConsumer, RTC::OutPortCorbaCdrConsumer>); } };
It is recommended that the registration process is declared as a initialization function with "extern C" to be accessed from the outside of module. If the OutPortConsumers are compiled as a shared object or DLL for dynamic loading, new OutPortConsumer types can be added dynamically.
Definition at line 171 of file OutPortConsumer.h.
|
inlinevirtual |
|
pure virtual |
Receive data.
Pure virtual function to receive data.
Implemented in InPortBase::OutPortCorbaCdrConsumerMock, InPort::OutPortCorbaCdrConsumerMock, InPortPullConnector::OutPortCorbaCdrConsumerMock, and RTC::OutPortCorbaCdrConsumer.
|
pure virtual |
Initializing configuration.
This operation would be called to configure in initialization. In the concrete class, configuration should be performed getting appropriate information from the given Properties data. This function might be called right after instantiation and connection sequence respectivly. Therefore, this function should be implemented assuming multiple call.
prop | Configuration information |
Implemented in InPortBase::OutPortCorbaCdrConsumerMock, InPort::OutPortCorbaCdrConsumerMock, InPortPullConnector::OutPortCorbaCdrConsumerMock, and RTC::OutPortCorbaCdrConsumer.
|
pure virtual |
Setting outside buffer's pointer.
A pointer to a buffer from which OutPortProvider retrieve data. If already buffer is set, previous buffer's pointer will be overwritten by the given pointer to a buffer. Since OutPortProvider does not assume ownership of the buffer pointer, destructor of the buffer should be done by user.
buffer | A pointer to a data buffer to be used by OutPortProvider |
Implemented in InPortBase::OutPortCorbaCdrConsumerMock, InPort::OutPortCorbaCdrConsumerMock, InPortPullConnector::OutPortCorbaCdrConsumerMock, and RTC::OutPortCorbaCdrConsumer.
|
pure virtual |
Set the listener.
OutPort provides callback functionality that calls specific listener objects according to the events in the data publishing process. For details, see documentation of ConnectorDataListener class and ConnectorListener class in ConnectorListener.h. In the sub-classes of OutPortProvider, the given listeners should be called in the proper timing. However, it is not necessary to call all the listeners.
info | Connector information |
listeners | Listener objects |
Implemented in InPortBase::OutPortCorbaCdrConsumerMock, InPortPullConnector::OutPortCorbaCdrConsumerMock, InPort::OutPortCorbaCdrConsumerMock, and RTC::OutPortCorbaCdrConsumer.
|
pure virtual |
Subscribe the data receive notification.
Pure virtual function to subscribe the data receive notification based on specified property information.
properties | Properties for subscription |
Implemented in InPortBase::OutPortCorbaCdrConsumerMock, InPort::OutPortCorbaCdrConsumerMock, InPortPullConnector::OutPortCorbaCdrConsumerMock, and RTC::OutPortCorbaCdrConsumer.
|
pure virtual |
Unsubscribe the data receive notification.
Pure virtual function to unsubscribe the data receive notification.
properties | Properties for unsubscription |
Implemented in InPortBase::OutPortCorbaCdrConsumerMock, InPort::OutPortCorbaCdrConsumerMock, InPortPullConnector::OutPortCorbaCdrConsumerMock, and RTC::OutPortCorbaCdrConsumer.
|
mutableprotected |
Logger stream.
Definition at line 370 of file OutPortConsumer.h.