OpenRTM-aist  1.2.2
ECFactory.h
Go to the documentation of this file.
1 // -*- C++ -*-
20 #ifndef RTC_ECFACTORY_H
21 #define RTC_ECFACTORY_H
22 
24 #include <string>
25 
26 namespace RTC
27 {
28 
29  typedef ExecutionContextBase* (*ECNewFunc)();
30  typedef void (*ECDeleteFunc)(ExecutionContextBase* ec);
31 
51  template <class _New>
53  {
54  return new _New();
55  }
56 
76  template <class _Delete>
78  {
79  delete ec;
80  }
81 
116  {
117  public:
133  virtual ~ECFactoryBase(void){};
134 
156  virtual const char* name() = 0;
157 
177  virtual ExecutionContextBase* create() = 0;
178 
198  virtual void destroy(ExecutionContextBase* comp) = 0;
199  protected:
200  };
201 
222  : public ECFactoryBase
223  {
224  public:
248  ECFactoryCXX(const char* name,
249  ECNewFunc new_func,
250  ECDeleteFunc delete_func);
251 
267  ~ECFactoryCXX(void);
268 
288  virtual const char* name();
289 
309  virtual ExecutionContextBase* create();
310 
330  virtual void destroy(ExecutionContextBase* comp);
331 
332  protected:
340  std::string m_name;
341 
350 
359  };
360 };
361 #endif // RTC_ECFACTORY_H
RTC::ECFactoryBase::create
virtual ExecutionContextBase * create()=0
Pure virtual function to create ExecutionContext.
RTC::ECDelete
void ECDelete(ExecutionContextBase *ec)
Template function to destroy ExecutionContext.
Definition: ECFactory.h:77
RTC::ECFactoryCXX::destroy
virtual void destroy(ExecutionContextBase *comp)
Destroy the target ExecutionContext's instances.
RTC::ECFactoryBase
ECFactoryBase abstract class.
Definition: ECFactory.h:115
RTC::ECFactoryCXX::~ECFactoryCXX
~ECFactoryCXX(void)
Virtual destructor.
RTC::ECFactoryCXX::name
virtual const char * name()
Get names of the target ExecutionContext for creation.
RTC::ExecutionContextBase
A base class for ExecutionContext.
Definition: ExecutionContextBase.h:369
RTC::ECFactoryBase::name
virtual const char * name()=0
Pure virtual function to get names of creation target ExecutionContext.
RTC::ECFactoryCXX::create
virtual ExecutionContextBase * create()
Create the target ExecutionContext's instances.
RTC::ECFactoryBase::~ECFactoryBase
virtual ~ECFactoryBase(void)
Virtual destructor.
Definition: ECFactory.h:133
RTC::ECDeleteFunc
void(* ECDeleteFunc)(ExecutionContextBase *ec)
Definition: ECFactory.h:30
ExecutionContextBase.h
ExecutionContext base class.
RTC::ECNewFunc
ExecutionContextBase *(* ECNewFunc)()
Definition: ECFactory.h:29
RTC::ECFactoryCXX::m_name
std::string m_name
Names of the target ExecutionContext for creation.
Definition: ECFactory.h:340
RTC::ECCreate
ExecutionContextBase * ECCreate()
Template function to create ExecutionContext.
Definition: ECFactory.h:52
RTC
RT-Component.
RTC::ECFactoryCXX::ECFactoryCXX
ECFactoryCXX(const char *name, ECNewFunc new_func, ECDeleteFunc delete_func)
Constructor.
RTC::ECFactoryBase::destroy
virtual void destroy(ExecutionContextBase *comp)=0
Pure virtual function to destroy ExecutionContext.
RTC::ECFactoryCXX::m_New
ECNewFunc m_New
Function to create the target ExecutionContext.
Definition: ECFactory.h:349
RTC::ECFactoryCXX::m_Delete
ECDeleteFunc m_Delete
Function to destroy the target ExecutionContext.
Definition: ECFactory.h:358
RTC::ECFactoryCXX
ECFactoryCXX class.
Definition: ECFactory.h:221