OutPortCorbaCdrConsumer.h
Go to the documentation of this file.
00001 // -*- C++ -*-
00020 #ifndef RTC_OUTPORTCORBACDRCONSUMER_H
00021 #define RTC_OUTPORTCORBACDRCONSUMER_H
00022 
00023 #include <rtm/idl/DataPortSkel.h>
00024 #include <rtm/CorbaConsumer.h>
00025 #include <rtm/OutPortConsumer.h>
00026 #include <rtm/ConnectorListener.h>
00027 #include <rtm/ConnectorBase.h>
00028 
00029 namespace RTC
00030 {
00055   class OutPortCorbaCdrConsumer
00056     : public OutPortConsumer,
00057       public CorbaConsumer< ::OpenRTM::OutPortCdr >
00058   {
00059   public:
00060     DATAPORTSTATUS_ENUM
00061 
00075     OutPortCorbaCdrConsumer();
00076 
00090     virtual ~OutPortCorbaCdrConsumer(void); 
00091 
00119     virtual void init(coil::Properties& prop);
00120 
00146     virtual void setBuffer(CdrBufferBase* buffer);
00147 
00192     virtual void setListener(ConnectorInfo& info,
00193                              ConnectorListeners* listeners);
00194 
00216     virtual ReturnCode get(cdrMemoryStream& data);
00217 
00240     virtual bool subscribeInterface(const SDOPackage::NVList& properties);
00241     
00259     virtual void unsubscribeInterface(const SDOPackage::NVList& properties);
00260     
00261   private:
00269     OutPortConsumer::ReturnCode convertReturn(::OpenRTM::PortStatus status,
00270                                               const cdrMemoryStream& data);
00271 
00281     inline void onBufferWrite(const cdrMemoryStream& data)
00282     {
00283       m_listeners->
00284         connectorData_[ON_BUFFER_WRITE].notify(m_profile, data);
00285     }
00286 
00296     inline void onBufferFull(const cdrMemoryStream& data)
00297     {
00298       m_listeners->
00299         connectorData_[ON_BUFFER_FULL].notify(m_profile, data);
00300     }
00301 
00311     inline void onReceived(const cdrMemoryStream& data)
00312     {
00313       m_listeners->
00314         connectorData_[ON_RECEIVED].notify(m_profile, data);
00315     }
00316 
00326     inline void onReceiverFull(const cdrMemoryStream& data)
00327     {
00328       m_listeners->
00329         connectorData_[ON_RECEIVER_FULL].notify(m_profile, data);
00330     }
00331 
00339     inline void onSenderEmpty()
00340     {
00341       m_listeners->
00342         connector_[ON_SENDER_EMPTY].notify(m_profile);
00343     }
00344 
00352     inline void onSenderTimeout()
00353     {
00354       m_listeners->
00355         connector_[ON_SENDER_TIMEOUT].notify(m_profile);
00356     }
00357 
00365     inline void onSenderError()
00366     {
00367       m_listeners->
00368         connector_[ON_SENDER_ERROR].notify(m_profile);
00369     }
00370 
00371     //    RTC::OutPortCdr_var m_outport;
00372     CdrBufferBase* m_buffer;
00373     ConnectorListeners* m_listeners;
00374     ConnectorInfo m_profile;
00375   };
00376 };     // namespace RTC
00377 
00378 extern "C"
00379 {
00393   void OutPortCorbaCdrConsumerInit(void);
00394 };
00395 
00396 #endif // RTC_OUTPORTCORBACDRCONSUMER_H


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