Classes | Public Member Functions | Protected Attributes
RTC::OutPortConsumer Class Reference

OutPortConsumer abstract class. More...

#include <OutPortConsumer.h>

Inheritance diagram for RTC::OutPortConsumer:
Inheritance graph
[legend]

List of all members.

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.
virtual void init (coil::Properties &prop)=0
 Initializing configuration.
virtual void setBuffer (CdrBufferBase *buffer)=0
 Setting outside buffer's pointer.
virtual void setListener (ConnectorInfo &info, ConnectorListeners *listeners)=0
 Set the listener.
virtual bool subscribeInterface (const SDOPackage::NVList &properties)=0
 Subscribe the data receive notification.
virtual void unsubscribeInterface (const SDOPackage::NVList &properties)=0
 Unsubscribe the data receive notification.
virtual DATAPORTSTATUS_ENUM ~OutPortConsumer (void)
 Destructor.

Protected Attributes

Logger rtclog
 Logger stream.

Detailed Description

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.

Since:
0.4.0

Definition at line 171 of file OutPortConsumer.h.


Constructor & Destructor Documentation

virtual DATAPORTSTATUS_ENUM RTC::OutPortConsumer::~OutPortConsumer ( void  ) [inline, virtual]

Destructor.

Virtual destructor

Definition at line 191 of file OutPortConsumer.h.


Member Function Documentation

virtual ReturnCode RTC::OutPortConsumer::get ( cdrMemoryStream &  data) [pure virtual]
virtual void RTC::OutPortConsumer::init ( coil::Properties prop) [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.

Parameters:
propConfiguration information

Implemented in InPortBase::OutPortCorbaCdrConsumerMock, InPort::OutPortCorbaCdrConsumerMock, InPortPullConnector::OutPortCorbaCdrConsumerMock, and RTC::OutPortCorbaCdrConsumer.

virtual void RTC::OutPortConsumer::setBuffer ( CdrBufferBase buffer) [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.

Parameters:
bufferA pointer to a data buffer to be used by OutPortProvider

Implemented in RTC::OutPortCorbaCdrConsumer.

virtual void RTC::OutPortConsumer::setListener ( ConnectorInfo info,
ConnectorListeners listeners 
) [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.

Parameters:
infoConnector information
listenersListener objects

Implemented in InPortBase::OutPortCorbaCdrConsumerMock, InPortPullConnector::OutPortCorbaCdrConsumerMock, InPort::OutPortCorbaCdrConsumerMock, and RTC::OutPortCorbaCdrConsumer.

virtual bool RTC::OutPortConsumer::subscribeInterface ( const SDOPackage::NVList &  properties) [pure virtual]

Subscribe the data receive notification.

Pure virtual function to subscribe the data receive notification based on specified property information.

Parameters:
propertiesProperties for subscription
Returns:
Subscription result (Successful:true, Failed:false)

Implemented in InPortBase::OutPortCorbaCdrConsumerMock, InPort::OutPortCorbaCdrConsumerMock, InPortPullConnector::OutPortCorbaCdrConsumerMock, and RTC::OutPortCorbaCdrConsumer.

virtual void RTC::OutPortConsumer::unsubscribeInterface ( const SDOPackage::NVList &  properties) [pure virtual]

Unsubscribe the data receive notification.

Pure virtual function to unsubscribe the data receive notification.

Parameters:
propertiesProperties for unsubscription
Returns:
Unsubscription result (Successful:true, Failed:false)

Implemented in InPortBase::OutPortCorbaCdrConsumerMock, InPort::OutPortCorbaCdrConsumerMock, InPortPullConnector::OutPortCorbaCdrConsumerMock, and RTC::OutPortCorbaCdrConsumer.


Member Data Documentation

Logger RTC::OutPortConsumer::rtclog [mutable, protected]

Logger stream.

Definition at line 370 of file OutPortConsumer.h.


The documentation for this class was generated from the following file:


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Sun Mar 26 2017 03:37:20