OutPortCorbaCdrProvider.h
Go to the documentation of this file.
00001 // -*- C++ -*-
00020 #ifndef RTC_OUTPORTCORBACDRPROVIDER_H
00021 #define RTC_OUTPORTCORBACDRPROVIDER_H
00022 
00023 #include <rtm/idl/DataPortSkel.h>
00024 #include <rtm/BufferBase.h>
00025 #include <rtm/OutPortProvider.h>
00026 #include <rtm/CORBA_SeqUtil.h>
00027 #include <rtm/Manager.h>
00028 #include <rtm/ConnectorListener.h>
00029 #include <rtm/ConnectorBase.h>
00030 
00031 #ifdef WIN32
00032 #pragma warning( disable : 4290 )
00033 #endif
00034 
00035 namespace RTC
00036 {
00061   class OutPortCorbaCdrProvider
00062     : public OutPortProvider,
00063       public virtual ::POA_OpenRTM::OutPortCdr,
00064       public virtual PortableServer::RefCountServantBase
00065   {
00066   public:
00080     OutPortCorbaCdrProvider(void);
00081 
00095     virtual ~OutPortCorbaCdrProvider(void);
00096 
00124     virtual void init(coil::Properties& prop);
00125 
00151     virtual void setBuffer(CdrBufferBase* buffer);
00152 
00197     virtual void setListener(ConnectorInfo& info,
00198                              ConnectorListeners* listeners);
00199 
00224     virtual void setConnector(OutPortConnector* connector);
00225 
00243     virtual ::OpenRTM::PortStatus get(::OpenRTM::CdrData_out data)
00244       throw (CORBA::SystemException);
00245 
00246     
00247   private:
00255     ::OpenRTM::PortStatus convertReturn(BufferStatus::Enum status,
00256                                         const cdrMemoryStream& data);
00257 
00258 
00268     inline void onBufferRead(const cdrMemoryStream& data)
00269     {
00270       m_listeners->
00271         connectorData_[ON_BUFFER_READ].notify(m_profile, data);
00272     }
00273 
00283     inline void onSend(const cdrMemoryStream& data)
00284     {
00285       m_listeners->
00286         connectorData_[ON_SEND].notify(m_profile, data);
00287     }
00288 
00296     inline void onBufferEmpty()
00297     {
00298       m_listeners->
00299         connector_[ON_BUFFER_EMPTY].notify(m_profile);
00300     }
00301 
00309     inline void onBufferReadTimeout()
00310     {
00311       m_listeners->
00312         connector_[ON_BUFFER_READ_TIMEOUT].notify(m_profile);
00313     }
00314 
00322     inline void onSenderEmpty()
00323     {
00324       m_listeners->
00325         connector_[ON_SENDER_EMPTY].notify(m_profile);
00326     }
00327 
00335     inline void onSenderTimeout()
00336     {
00337       m_listeners->
00338         connector_[ON_SENDER_TIMEOUT].notify(m_profile);
00339     }
00340 
00348     inline void onSenderError()
00349     {
00350       m_listeners->
00351         connector_[ON_SENDER_ERROR].notify(m_profile);
00352     }
00353     
00354   private:
00355     CdrBufferBase* m_buffer;
00356     ::OpenRTM::OutPortCdr_var m_objref;
00357     ConnectorListeners* m_listeners;
00358     ConnectorInfo m_profile;
00359     OutPortConnector* m_connector;
00360   };  // class OutPortCorbaCdrProvider
00361 };     // namespace RTC
00362 
00363 extern "C"
00364 {
00378   void OutPortCorbaCdrProviderInit(void);
00379 };
00380 
00381 #ifdef WIN32
00382 #pragma warning( default : 4290 )
00383 #endif
00384 
00385 #endif // RTC_OUTPORTCORBACDRPROVIDER_H


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