00001 // -*- C++ -*- 00020 #ifndef RTC_INPORTCONSUMER_H 00021 #define RTC_INPORTCONSUMER_H 00022 00023 #include <coil/Factory.h> 00024 #include <rtm/DataPortStatus.h> 00025 00026 namespace coil 00027 { 00028 class Properties; 00029 }; 00030 00031 // Why RtORB does not allow forward declaration? 00032 #ifndef ORB_IS_RTORB 00033 namespace SDOPackage 00034 { 00035 class NVList; 00036 }; 00037 #endif // ORB_IS_RTORB 00038 00039 class cdrMemoryStream; 00040 00041 namespace RTC 00042 { 00076 class InPortConsumer 00077 : public DataPortStatus 00078 { 00079 public: 00080 DATAPORTSTATUS_ENUM 00081 00095 virtual ~InPortConsumer(void){}; 00096 00111 virtual void init(coil::Properties& prop) = 0; 00112 00147 virtual ReturnCode put(const cdrMemoryStream& data) = 0; 00148 00172 virtual void publishInterfaceProfile(SDOPackage::NVList& properties) = 0; 00173 00197 virtual bool subscribeInterface(const SDOPackage::NVList& properties) = 0; 00198 00216 virtual void unsubscribeInterface(const SDOPackage::NVList& properties) = 0; 00217 00225 struct publishInterfaceProfileFunc 00226 { 00227 publishInterfaceProfileFunc(SDOPackage::NVList& prop) : m_prop(prop) {} 00228 void operator()(InPortConsumer* consumer) 00229 { 00230 consumer->publishInterfaceProfile(m_prop); 00231 } 00232 SDOPackage::NVList& m_prop; 00233 }; 00234 00242 struct subscribeInterfaceFunc 00243 { 00244 subscribeInterfaceFunc(SDOPackage::NVList& prop) : m_prop(prop) {} 00245 bool operator()(InPortConsumer* consumer) 00246 { 00247 return consumer->subscribeInterface(m_prop); 00248 } 00249 SDOPackage::NVList& m_prop; 00250 }; 00251 00252 00253 }; 00254 00255 typedef ::coil::GlobalFactory<InPortConsumer> InPortConsumerFactory; 00256 }; // namespace RTC 00257 00258 #endif // RTC_INPORTCONSUMER_H