rtm/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>
24 //#include <rtm/RTObject.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,
326  NumberingPolicy* policy = new DefaultNumberingPolicy());
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
virtual ~FactoryCXX()
Definition: rtm/Factory.h:328
RTObject_impl *(* RtcNewFunc)(Manager *manager)
Definition: rtm/Factory.h:33
virtual RTObject_impl * create(Manager *mgr)=0
Create components.
int m_Number
Number of current RT-Component&#39;s instances.
Definition: rtm/Factory.h:262
RT-Component.
virtual coil::Properties & profile()
Get the component profile.
Definition: Factory.cpp:55
NumberingPolicy * m_policy
The naming policy on creating the components.
Definition: rtm/Factory.h:405
virtual int number()
Get the number of current instances.
Definition: Factory.cpp:67
RT-Component class.
Definition: RTObject.h:89
Manager class.
Definition: Manager.h:80
coil::Properties m_Profile
Component profile.
Definition: rtm/Factory.h:253
void Delete(RTObject_impl *rtc)
Template function to destroy RT-Components.
Definition: rtm/Factory.h:92
RTObject_impl * Create(Manager *manager)
Template function to create RT-Components.
Definition: rtm/Factory.h:65
virtual void destroy(RTObject_impl *comp)=0
Destroy components.
Abstruct class for naming policy management when creating objects.
FactoryBase(const coil::Properties &profile)
Constructor.
Definition: Factory.cpp:32
RtcNewFunc m_New
The pointer to component object create function.
Definition: rtm/Factory.h:387
Object numbering policy class.
Class represents a set of properties.
Definition: Properties.h:101
virtual ~FactoryBase(void)
Destructor.
Definition: Factory.cpp:44
FactoryBase base class.
Definition: rtm/Factory.h:118
void(* RtcDeleteFunc)(RTObject_impl *rtc)
Definition: rtm/Factory.h:34
FactoryCXX class.
Definition: rtm/Factory.h:286
Class for naming policy management when creating objects.
RtcDeleteFunc m_Delete
The pointer to component object destroy function.
Definition: rtm/Factory.h:396


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Thu Jun 6 2019 19:25:58