OpenRTM-aist  1.2.2
Factory.h
Go to the documentation of this file.
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 
33  typedef RTObject_impl* (*RtcNewFunc)(Manager* manager);
34  typedef void (*RtcDeleteFunc)(RTObject_impl* rtc);
35 
64  template <class _New>
66  {
67  return new _New(manager);
68  }
69 
91  template <class _Delete>
92  void Delete(RTObject_impl* rtc)
93  {
94  delete rtc;
95  }
96 
119  {
120  public:
141 
155  virtual ~FactoryBase(void);
156 
180  virtual RTObject_impl* create(Manager* mgr) = 0;
181 
201  virtual void destroy(RTObject_impl* comp) = 0;
202 
222  virtual coil::Properties& profile();
223 
243  virtual int number();
244 
245  protected:
254 
262  int m_Number;
263  };
264 
287  : public FactoryBase
288  {
289  public:
324  RtcNewFunc new_func,
325  RtcDeleteFunc delete_func,
327 
328  virtual ~FactoryCXX()
329  {
330  delete m_policy;
331  }
332 
356  virtual RTObject_impl* create(Manager* mgr);
357 
377  virtual void destroy(RTObject_impl* comp);
378 
379  protected:
388 
397 
406  };
407 };
408 #endif // RTC_FACTORY_H
RTC::RtcDeleteFunc
void(* RtcDeleteFunc)(RTObject_impl *rtc)
Definition: Factory.h:34
RTC::FactoryCXX::destroy
virtual void destroy(RTObject_impl *comp)
Destroy RT-Components.
RTC::FactoryBase::~FactoryBase
virtual ~FactoryBase(void)
Destructor.
RTC::FactoryCXX::~FactoryCXX
virtual ~FactoryCXX()
Definition: Factory.h:328
RTC::FactoryCXX::m_Delete
RtcDeleteFunc m_Delete
The pointer to component object destroy function.
Definition: Factory.h:396
RTC::FactoryCXX::m_policy
RTM::NumberingPolicyBase * m_policy
The naming policy on creating the components.
Definition: Factory.h:405
RTC::FactoryBase::m_Profile
coil::Properties m_Profile
Component profile.
Definition: Factory.h:253
RTC::FactoryCXX::FactoryCXX
FactoryCXX(const coil::Properties &profile, RtcNewFunc new_func, RtcDeleteFunc delete_func, RTM::NumberingPolicyBase *policy=new RTM::ProcessUniquePolicy())
Constructor.
Properties.h
Property list class (derived from Java Properties)
RTC::FactoryBase::m_Number
int m_Number
Number of current RT-Component's instances.
Definition: Factory.h:262
RTC::RTObject_impl
RT-Component class.
Definition: RTObject.h:89
RTC::Delete
void Delete(RTObject_impl *rtc)
Template function to destroy RT-Components.
Definition: Factory.h:92
RTM::NumberingPolicyBase
Definition: NumberingPolicyBase.h:55
RTC::RtcNewFunc
RTObject_impl *(* RtcNewFunc)(Manager *manager)
Definition: Factory.h:33
RTC::FactoryCXX::m_New
RtcNewFunc m_New
The pointer to component object create function.
Definition: Factory.h:387
RTC::FactoryBase::create
virtual RTObject_impl * create(Manager *mgr)=0
Create components.
RTC::FactoryCXX::create
virtual RTObject_impl * create(Manager *mgr)
Create RT-Components.
RTC::FactoryCXX
FactoryCXX class.
Definition: Factory.h:286
RTM::ProcessUniquePolicy
Class for naming policy management when creating objects.
Definition: NumberingPolicy.h:52
RTC::FactoryBase
FactoryBase base class.
Definition: Factory.h:118
RTC::Create
RTObject_impl * Create(Manager *manager)
Template function to create RT-Components.
Definition: Factory.h:65
coil::Properties
Class represents a set of properties.
Definition: Properties.h:101
RTC::FactoryBase::number
virtual int number()
Get the number of current instances.
RTC::FactoryBase::profile
virtual coil::Properties & profile()
Get the component profile.
RTC::FactoryBase::FactoryBase
FactoryBase(const coil::Properties &profile)
Constructor.
NumberingPolicyBase.h
Object numbering policy base class.
RTC::Manager
Manager class.
Definition: Manager.h:81
RTC
RT-Component.
NumberingPolicy.h
RTC::FactoryBase::destroy
virtual void destroy(RTObject_impl *comp)=0
Destroy components.