00001 // -*- C++ -*- 00022 #ifndef __RtcFactory_h__ 00023 #define __RtcFactory_h__ 00024 00025 #include "rtm/RtcModuleProfile.h" 00026 00027 00028 namespace RTM 00029 { 00030 class RtcBase; 00031 class RtcManager; 00051 class RtcFactoryBase 00052 { 00053 public: 00073 RtcFactoryBase(RtcModuleProfile profile) 00074 : m_Profile(profile), m_Number(-1) {}; 00075 00097 virtual RtcBase* create(RtcManager* mgr) = 0; 00098 00120 virtual void destroy(RtcBase* comp) = 0; 00121 00137 virtual RtcModuleProfile& profile() {return m_Profile;}; 00138 00154 virtual int& number() {return m_Number;}; 00155 00156 protected: 00164 RtcModuleProfile m_Profile; 00172 int m_Number; 00173 }; 00174 00175 00176 00196 class RtcFactoryCXX 00197 : public RtcFactoryBase 00198 { 00199 public: 00228 RtcFactoryCXX(RtcModuleProfile profile, 00229 RtcNewFunc new_func, 00230 RtcDeleteFunc delete_func); 00231 00251 virtual RtcBase* create(RtcManager* mgr); 00252 00272 virtual void destroy(RtcBase* comp); 00273 00274 protected: 00282 RtcNewFunc m_New; 00283 00291 RtcDeleteFunc m_Delete; 00292 }; 00293 }; 00294 00295 00296 #endif // end of __RtcFactory_h__