Go to the documentation of this file.00001
00020 #ifndef RTC_INPORTCORBACDRPROVIDER_H
00021 #define RTC_INPORTCORBACDRPROVIDER_H
00022
00023 #include <rtm/idl/DataPortSkel.h>
00024 #include <rtm/BufferBase.h>
00025 #include <rtm/InPortProvider.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 InPortCorbaCdrProvider
00062 : public InPortProvider,
00063 public virtual POA_OpenRTM::InPortCdr,
00064 public virtual PortableServer::RefCountServantBase
00065 {
00066 public:
00080 InPortCorbaCdrProvider(void);
00081
00095 virtual ~InPortCorbaCdrProvider(void);
00096
00124 virtual void init(coil::Properties& prop);
00125
00151 virtual void setBuffer(BufferBase<cdrMemoryStream>* buffer);
00152
00201 virtual void setListener(ConnectorInfo& info,
00202 ConnectorListeners* listeners);
00203
00228 virtual void setConnector(InPortConnector* connector);
00229
00247 virtual ::OpenRTM::PortStatus put(const ::OpenRTM::CdrData& data)
00248 throw (CORBA::SystemException);
00249
00250 private:
00258 ::OpenRTM::PortStatus
00259 convertReturn(BufferStatus::Enum status,
00260 const cdrMemoryStream& data);
00261
00262
00272 inline void onBufferWrite(const cdrMemoryStream& data)
00273 {
00274 m_listeners->
00275 connectorData_[ON_BUFFER_WRITE].notify(m_profile, data);
00276 }
00277
00287 inline void onBufferFull(const cdrMemoryStream& data)
00288 {
00289 m_listeners->
00290 connectorData_[ON_BUFFER_FULL].notify(m_profile, data);
00291 }
00292
00302 inline void onBufferWriteTimeout(const cdrMemoryStream& data)
00303 {
00304 m_listeners->
00305 connectorData_[ON_BUFFER_WRITE_TIMEOUT].notify(m_profile, data);
00306 }
00307
00317 inline void onBufferWriteOverwrite(const cdrMemoryStream& data)
00318 {
00319 m_listeners->
00320 connectorData_[ON_BUFFER_OVERWRITE].notify(m_profile, data);
00321 }
00322
00332 inline void onReceived(const cdrMemoryStream& data)
00333 {
00334 m_listeners->
00335 connectorData_[ON_RECEIVED].notify(m_profile, data);
00336 }
00337
00347 inline void onReceiverFull(const cdrMemoryStream& data)
00348 {
00349 m_listeners->
00350 connectorData_[ON_RECEIVER_FULL].notify(m_profile, data);
00351 }
00352
00360 inline void onReceiverTimeout(const cdrMemoryStream& data)
00361 {
00362 m_listeners->
00363 connectorData_[ON_RECEIVER_TIMEOUT].notify(m_profile, data);
00364 }
00365
00373 inline void onReceiverError(const cdrMemoryStream& data)
00374 {
00375 m_listeners->
00376 connectorData_[ON_RECEIVER_ERROR].notify(m_profile, data);
00377 }
00378
00379 private:
00380 CdrBufferBase* m_buffer;
00381 ::OpenRTM::InPortCdr_var m_objref;
00382 ConnectorListeners* m_listeners;
00383 ConnectorInfo m_profile;
00384 InPortConnector* m_connector;
00385
00386 };
00387 };
00388
00389 extern "C"
00390 {
00404 void InPortCorbaCdrProviderInit(void);
00405 };
00406
00407 #ifdef WIN32
00408 #pragma warning( default : 4290 )
00409 #endif
00410
00411 #endif // RTC_INPORTCORBACDRPROVIDER_H
00412