OpenRTM-aist 2.0.2
Loading...
Searching...
No Matches
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
26namespace RTC
27{
28
31
51 template <class T_New>
53 {
54 return new T_New();
55 }
56
76 template <class T_Delete>
78 {
79 delete ec;
80 }
81
116 {
117 public:
133 virtual ~ECFactoryBase() = default;
134
156 virtual const char* name() = 0;
157
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() override;
268
288 const char* name() override;
289
310
330 void destroy(ExecutionContextBase* ec) override;
331
332 protected:
340 std::string m_name;
341
350
359 };
360} // namespace RTC
361#endif // RTC_ECFACTORY_H
ExecutionContext base class.
ECFactoryBase abstract class.
Definition ECFactory.h:116
virtual const char * name()=0
Pure virtual function to get names of creation target ExecutionContext.
virtual ~ECFactoryBase()=default
Virtual destructor.
virtual ExecutionContextBase * create()=0
Pure virtual function to create ExecutionContext.
virtual void destroy(ExecutionContextBase *comp)=0
Pure virtual function to destroy ExecutionContext.
ECFactoryCXX class.
Definition ECFactory.h:223
ECNewFunc m_New
Function to create the target ExecutionContext .
Definition ECFactory.h:349
ExecutionContextBase * create() override
Create the target ExecutionContext's instances.
void destroy(ExecutionContextBase *ec) override
Destroy the target ExecutionContext's instances.
ECFactoryCXX(const char *name, ECNewFunc new_func, ECDeleteFunc delete_func)
Constructor.
ECDeleteFunc m_Delete
Function to destroy the target ExecutionContext .
Definition ECFactory.h:358
const char * name() override
Get names of the target ExecutionContext for creation.
std::string m_name
Names of the target ExecutionContext for creation .
Definition ECFactory.h:340
~ECFactoryCXX() override
Virtual destructor.
A base class for ExecutionContext.
Definition ExecutionContextBase.h:366
RT-Component.
ExecutionContextBase *(*)() ECNewFunc
Definition ECFactory.h:29
void(*)(ExecutionContextBase *) ECDeleteFunc
Definition ECFactory.h:30
void ECDelete(ExecutionContextBase *ec)
Template function to destroy ExecutionContext.
Definition ECFactory.h:77
ExecutionContextBase * ECCreate()
Template function to create ExecutionContext.
Definition ECFactory.h:52