00001 // -*- C++ -*- 00020 #ifndef RTC_OUTPORTCONSUMER_H 00021 #define RTC_OUTPORTCONSUMER_H 00022 00023 #include <coil/Factory.h> 00024 #include <rtm/DataPortStatus.h> 00025 #include <rtm/CdrBufferBase.h> 00026 00027 // Why RtORB does not allow the following foward declaration? 00028 #ifndef ORB_IS_RTORB 00029 namespace SDOPackage 00030 { 00031 class NVList; 00032 }; 00033 #endif // ORB_IS_RTORB 00034 00035 namespace coil 00036 { 00037 class Properties; 00038 }; 00039 00040 namespace RTC 00041 { 00042 class ConnectorListeners; 00043 class ConnectorInfo; 00044 00171 class OutPortConsumer 00172 : public DataPortStatus 00173 { 00174 public: 00175 DATAPORTSTATUS_ENUM 00176 00191 virtual ~OutPortConsumer(void){}; 00192 00220 virtual void init(coil::Properties& prop) = 0; 00221 00247 virtual void setBuffer(CdrBufferBase* buffer) = 0; 00248 00279 virtual void setListener(ConnectorInfo& info, 00280 ConnectorListeners* listeners) = 0; 00281 00308 virtual ReturnCode get(cdrMemoryStream& data) = 0; 00309 00335 virtual bool subscribeInterface(const SDOPackage::NVList& properties) = 0; 00336 00360 virtual void unsubscribeInterface(const SDOPackage::NVList& properties) = 0; 00361 00362 protected: 00370 mutable Logger rtclog; 00371 00379 struct subscribe 00380 { 00381 subscribe(const SDOPackage::NVList& prop) : m_prop(prop) {} 00382 void operator()(OutPortConsumer* consumer) 00383 { 00384 consumer->subscribeInterface(m_prop); 00385 } 00386 const SDOPackage::NVList& m_prop; 00387 }; 00388 00396 struct unsubscribe 00397 { 00398 unsubscribe(const SDOPackage::NVList& prop) : m_prop(prop) {} 00399 void operator()(OutPortConsumer* consumer) 00400 { 00401 consumer->unsubscribeInterface(m_prop); 00402 } 00403 const SDOPackage::NVList& m_prop; 00404 }; 00405 }; 00406 00414 typedef ::coil::GlobalFactory<OutPortConsumer> OutPortConsumerFactory; 00415 00416 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) 00417 EXTERN template class DLL_PLUGIN ::coil::GlobalFactory<OutPortConsumer>; 00418 #endif 00419 }; // namespace RTC 00420 #endif // RTC_OUTPORTCONSUMER_H 00421