InPortProvider.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00020 #ifndef InPortProvider_h
00021 #define InPortProvider_h
00022 
00023 #include <string>
00024 
00025 #include <coil/Factory.h>
00026 
00027 #include <rtm/BufferBase.h>
00028 #include <rtm/NVUtil.h>
00029 #include <rtm/SystemLogger.h>
00030 #include <rtm/DataPortStatus.h>
00031 
00032 namespace RTC
00033 {
00053   class InPortProvider
00054     : public DataPortStatus
00055   {
00056   public:
00057     DATAPORTSTATUS_ENUM
00071     InPortProvider();
00072     
00086     virtual ~InPortProvider(void);
00087 
00102     virtual void init(coil::Properties& prop) = 0;
00103 
00119     virtual void setBuffer(BufferBase<cdrMemoryStream>* buffer) = 0;
00120     
00138     virtual void publishInterfaceProfile(SDOPackage::NVList& properties);
00139     
00157     virtual bool publishInterface(SDOPackage::NVList& properties);
00158     
00159   protected:
00177     void setInterfaceType(const char* interface_type);
00178     
00196     void setDataFlowType(const char* dataflow_type);
00197     
00215     void setSubscriptionType(const char* subs_type);
00216 
00217 
00218   protected:
00226     SDOPackage::NVList m_properties;
00227     mutable Logger rtclog;
00228 
00229   private:
00230     std::string m_interfaceType;
00231     std::string m_dataflowType;
00232     std::string m_subscriptionType;
00233 
00234   public:
00235     // functors
00243     struct publishInterfaceProfileFunc
00244     {
00245       publishInterfaceProfileFunc(SDOPackage::NVList& prop) : m_prop(prop) {}
00246       void operator()(InPortProvider* provider)
00247       {
00248         provider->publishInterfaceProfile(m_prop);
00249       }
00250       SDOPackage::NVList& m_prop;
00251     };
00252 
00260     struct publishInterfaceFunc
00261     {
00262       publishInterfaceFunc(SDOPackage::NVList& prop)
00263         : m_prop(prop), provider_(0) {}
00264       void operator()(InPortProvider* provider)
00265       {
00266         if (provider->publishInterface(m_prop))
00267           {
00268             provider_ = provider;
00269           }
00270       }
00271       SDOPackage::NVList& m_prop;
00272       InPortProvider* provider_;
00273     };
00274 
00275 
00276   };
00277 
00278   typedef ::coil::GlobalFactory<InPortProvider> InPortProviderFactory;
00279 
00280 };     // namespace RTC
00281 #endif // InPortProvider_h

Generated on Sun May 24 14:08:45 2009 for OpenRTM by  doxygen 1.5.3