OpenRTM-aist 2.1.0
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
RTC::OutPortConsumer Class Referenceabstract

OutPortConsumer abstract class. More...

#include <OutPortConsumer.h>

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

Classes

struct  subscribe
 Functor to subscribe the interface . More...
 
struct  unsubscribe
 Functor to unsubscribe the interface . More...
 

Public Member Functions

virtual ~OutPortConsumer ()=default
 Destructor.
 
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, ConnectorListenersBase *listeners)=0
 Set the listener.
 
virtual DataPortStatus get (ByteData &data)=0
 Receive data.
 
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.
 

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

Constructor & Destructor Documentation

◆ ~OutPortConsumer()

virtual RTC::OutPortConsumer::~OutPortConsumer ( )
virtualdefault

Destructor.

Member Function Documentation

◆ get()

virtual DataPortStatus RTC::OutPortConsumer::get ( ByteData data)
pure virtual

Receive data.

Pure virtual function to receive data.

Implemented in RTC::OutPortCorbaCdrConsumer, RTC::OutPortDirectConsumer, RTC::OutPortDSConsumer, and RTC::OutPortSHMConsumer.

◆ init()

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 RTC::OutPortCorbaCdrConsumer, RTC::OutPortDirectConsumer, RTC::OutPortDSConsumer, and RTC::OutPortSHMConsumer.

◆ setBuffer()

virtual void RTC::OutPortConsumer::setBuffer ( CdrBufferBase buffer)
pure virtual

◆ setListener()

virtual void RTC::OutPortConsumer::setListener ( ConnectorInfo info,
ConnectorListenersBase listeners 
)
pure virtual

◆ subscribeInterface()

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 RTC::OutPortCorbaCdrConsumer, RTC::OutPortDirectConsumer, RTC::OutPortDSConsumer, and RTC::OutPortSHMConsumer.

Referenced by RTC::OutPortConsumer::subscribe::operator()().

◆ unsubscribeInterface()

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 RTC::OutPortCorbaCdrConsumer, RTC::OutPortDirectConsumer, RTC::OutPortDSConsumer, and RTC::OutPortSHMConsumer.

Referenced by RTC::OutPortConsumer::unsubscribe::operator()().


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