00001
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 {
00062 class OutPortCorbaCdrProvider
00063 : public OutPortProvider,
00064 public virtual ::POA_OpenRTM::OutPortCdr,
00065 public virtual PortableServer::RefCountServantBase
00066 {
00067 public:
00085 OutPortCorbaCdrProvider(void);
00086
00100 virtual ~OutPortCorbaCdrProvider(void);
00101
00129 virtual void init(coil::Properties& prop);
00130
00156 virtual void setBuffer(CdrBufferBase* buffer);
00164 virtual void setListener(ConnectorInfo& info,
00165 ConnectorListeners* listeners);
00173 virtual void setConnector(OutPortConnector* connector);
00174
00192 virtual ::OpenRTM::PortStatus get(::OpenRTM::CdrData_out data)
00193 throw (CORBA::SystemException);
00194
00195
00196 private:
00204 ::OpenRTM::PortStatus convertReturn(BufferStatus::Enum status,
00205 const cdrMemoryStream& data);
00206
00207
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235 inline void onBufferRead(const cdrMemoryStream& data)
00236 {
00237 m_listeners->
00238 connectorData_[ON_BUFFER_READ].notify(m_profile, data);
00239 }
00240
00241 inline void onSend(const cdrMemoryStream& data)
00242 {
00243 m_listeners->
00244 connectorData_[ON_SEND].notify(m_profile, data);
00245 }
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00274 inline void onBufferEmpty()
00275 {
00276 m_listeners->
00277 connector_[ON_BUFFER_EMPTY].notify(m_profile);
00278 }
00279
00280 inline void onBufferReadTimeout()
00281 {
00282 m_listeners->
00283 connector_[ON_BUFFER_READ_TIMEOUT].notify(m_profile);
00284 }
00285
00286 inline void onSenderEmpty()
00287 {
00288 m_listeners->
00289 connector_[ON_SENDER_EMPTY].notify(m_profile);
00290 }
00291
00292 inline void onSenderTimeout()
00293 {
00294 m_listeners->
00295 connector_[ON_SENDER_TIMEOUT].notify(m_profile);
00296 }
00297
00298 inline void onSenderError()
00299 {
00300 m_listeners->
00301 connector_[ON_SENDER_ERROR].notify(m_profile);
00302 }
00303
00304 private:
00305 CdrBufferBase* m_buffer;
00306 ::OpenRTM::OutPortCdr_var m_objref;
00307 ConnectorListeners* m_listeners;
00308 ConnectorInfo m_profile;
00309 OutPortConnector* m_connector;
00310
00311 };
00312 };
00313
00314 extern "C"
00315 {
00316 void OutPortCorbaCdrProviderInit(void);
00317 };
00318
00319 #ifdef WIN32
00320 #pragma warning( default : 4290 )
00321 #endif
00322
00323 #endif // RTC_OUTPORTCORBACDRPROVIDER_H