OpenRTM-aist  2.1.0
Factory.h
[詳解]
1 // -*- C++ -*-
20 #ifndef RTC_FACTORY_H
21 #define RTC_FACTORY_H
22 
23 #include <coil/Properties.h>
25 #include <rtm/NumberingPolicy.h>
26 
27 
28 namespace RTC
29 {
30  class RTObject_impl;
31  class Manager;
32 
34  using RtcDeleteFunc = void (*)(RTObject_impl*);
35 
64  template <class T_New>
66  {
67  return new T_New(manager);
68  }
69 
87 
109  template <class T_Delete>
111  {
112  deleteRTObject(rtc);
113  }
114 
115 
138  {
139  public:
160 
174  virtual ~FactoryBase();
175 
199  virtual RTObject_impl* create(Manager* mgr) = 0;
200 
220  virtual void destroy(RTObject_impl* comp) = 0;
221 
242 
262  virtual int number();
263 
264  protected:
273 
281  int m_Number;
282  };
283 
306  : public FactoryBase
307  {
308  public:
343  RtcNewFunc new_func,
344  RtcDeleteFunc delete_func,
346 
347  ~FactoryCXX() override
348  {
349  delete m_policy;
350  }
351 
375  RTObject_impl* create(Manager* mgr) override;
376 
396  void destroy(RTObject_impl* comp) override;
397 
398  protected:
407 
416 
425  };
426 } // namespace RTC
427 #endif // RTC_FACTORY_H
Object numbering policy base class
FactoryBase 基底クラス
Definition: Factory.h:138
virtual RTObject_impl * create(Manager *mgr)=0
コンポーネントの生成
FactoryBase(const coil::Properties &profile)
コンストラクタ
virtual coil::Properties & profile()
コンポーネントプロファイルの取得
coil::Properties m_Profile
コンポーネントのプロファイル
Definition: Factory.h:272
virtual void destroy(RTObject_impl *comp)=0
コンポーネントの破棄
virtual int number()
現在のインスタンス数の取得
int m_Number
現在のインスタンス数
Definition: Factory.h:281
virtual ~FactoryBase()
デストラクタ
FactoryCXX クラス
Definition: Factory.h:307
RtcNewFunc m_New
コンポーネントオブジェクト生成関数へのポインタ
Definition: Factory.h:406
RTObject_impl * create(Manager *mgr) override
コンポーネントの生成
void destroy(RTObject_impl *comp) override
コンポーネントの破棄
RTM::NumberingPolicyBase * m_policy
コンポーネント生成時の命名ポリシー
Definition: Factory.h:424
RtcDeleteFunc m_Delete
コンポーネントオブジェクト破棄関数へのポインタ
Definition: Factory.h:415
FactoryCXX(const coil::Properties &profile, RtcNewFunc new_func, RtcDeleteFunc delete_func, RTM::NumberingPolicyBase *policy=new RTM::ProcessUniquePolicy())
コンストラクタ
~FactoryCXX() override
Definition: Factory.h:347
Manager クラス
Definition: Manager.h:91
RTコンポーネントクラス
Definition: RTObject.h:93
オブジェクト生成時ネーミング・ポリシー(命名規則)管理用抽象クラス
Definition: NumberingPolicyBase.h:56
オブジェクト生成時ネーミング・ポリシー(命名規則)管理用クラス
Definition: NumberingPolicy.h:54
RTコンポーネント
void Delete(RTObject_impl *rtc)
RTコンポーネント破棄用テンプレート関数
Definition: Factory.h:110
void deleteRTObject(RTObject_impl *rtc)
RTコンポーネント破棄用関数
RTObject_impl * Create(Manager *manager)
RTコンポーネント生成用テンプレート関数
Definition: Factory.h:65
void(*)(RTObject_impl *) RtcDeleteFunc
Definition: Factory.h:34
coil::Properties Properties
Definition: RTC.h:72
RTObject_impl *(*)(Manager *) RtcNewFunc
Definition: Factory.h:33