OpenRTM-aist
2.1.0
Toggle main menu visibility
Loading...
Searching...
No Matches
Factory.h
Go to the documentation of this file.
1
// -*- C++ -*-
19
20
#ifndef RTC_FACTORY_H
21
#define RTC_FACTORY_H
22
23
#include <coil/Properties.h>
24
#include <
rtm/NumberingPolicyBase.h
>
25
#include <
rtm/NumberingPolicy.h
>
26
27
28
namespace
RTC
29
{
30
class
RTObject_impl
;
31
class
Manager
;
32
33
using
RtcNewFunc
=
RTObject_impl
* (*)(
Manager
*);
34
using
RtcDeleteFunc
= void (*)(
RTObject_impl
*);
35
64
template
<
class
T_New>
65
RTObject_impl
*
Create
(
Manager
* manager)
66
{
67
return
new
T_New(manager);
68
}
69
86
void
deleteRTObject
(
RTObject_impl
* rtc);
87
109
template
<
class
T_Delete>
110
void
Delete
(
RTObject_impl
* rtc)
111
{
112
deleteRTObject
(rtc);
113
}
114
115
137
class
FactoryBase
138
{
139
public
:
159
explicit
FactoryBase
(
const
coil::Properties&
profile
);
160
174
virtual
~FactoryBase
();
175
199
virtual
RTObject_impl
*
create
(
Manager
* mgr) = 0;
200
220
virtual
void
destroy
(
RTObject_impl
* comp) = 0;
221
241
virtual
coil::Properties&
profile
();
242
262
virtual
int
number
();
263
264
protected
:
272
coil::Properties
m_Profile
;
273
281
int
m_Number
;
282
};
283
305
class
FactoryCXX
306
:
public
FactoryBase
307
{
308
public
:
342
FactoryCXX
(
const
coil::Properties&
profile
,
343
RtcNewFunc
new_func,
344
RtcDeleteFunc
delete_func,
345
RTM::NumberingPolicyBase
* policy =
new
RTM::ProcessUniquePolicy
());
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
:
406
RtcNewFunc
m_New
;
407
415
RtcDeleteFunc
m_Delete
;
416
424
RTM::NumberingPolicyBase
*
m_policy
;
425
};
426
}
// namespace RTC
427
#endif
// RTC_FACTORY_H
NumberingPolicyBase.h
Object numbering policy base class.
NumberingPolicy.h
RTC::FactoryBase::FactoryBase
FactoryBase(const coil::Properties &profile)
Constructor.
RTC::FactoryBase::m_Profile
coil::Properties m_Profile
Component profile .
Definition
Factory.h:272
RTC::FactoryBase::destroy
virtual void destroy(RTObject_impl *comp)=0
Destroy components.
RTC::FactoryBase::number
virtual int number()
Get the number of current instances.
RTC::FactoryBase::create
virtual RTObject_impl * create(Manager *mgr)=0
Create components.
RTC::FactoryBase::m_Number
int m_Number
Number of current RT-Component's instances. .
Definition
Factory.h:281
RTC::FactoryBase::profile
virtual coil::Properties & profile()
Get the component profile.
RTC::FactoryBase::~FactoryBase
virtual ~FactoryBase()
Destructor.
RTC::FactoryCXX::create
RTObject_impl * create(Manager *mgr) override
Create RT-Components.
RTC::FactoryCXX::m_New
RtcNewFunc m_New
The pointer to component object create function .
Definition
Factory.h:406
RTC::FactoryCXX::destroy
void destroy(RTObject_impl *comp) override
Destroy RT-Components.
RTC::FactoryCXX::m_policy
RTM::NumberingPolicyBase * m_policy
The naming policy on creating the components .
Definition
Factory.h:424
RTC::FactoryCXX::m_Delete
RtcDeleteFunc m_Delete
The pointer to component object destroy function .
Definition
Factory.h:415
RTC::FactoryCXX::FactoryCXX
FactoryCXX(const coil::Properties &profile, RtcNewFunc new_func, RtcDeleteFunc delete_func, RTM::NumberingPolicyBase *policy=new RTM::ProcessUniquePolicy())
Constructor.
RTC::FactoryCXX::~FactoryCXX
~FactoryCXX() override
Definition
Factory.h:347
RTC::Manager
Manager class.
Definition
Manager.h:91
RTC::RTObject_impl
RT-Component class.
Definition
RTObject.h:93
RTM::NumberingPolicyBase
Definition
NumberingPolicyBase.h:56
RTM::ProcessUniquePolicy
Class for naming policy management when creating objects.
Definition
NumberingPolicy.h:54
RTC
RT-Component.
RTC::Delete
void Delete(RTObject_impl *rtc)
Template function to destroy RT-Components.
Definition
Factory.h:110
RTC::RtcDeleteFunc
void(*)(RTObject_impl *) RtcDeleteFunc
Definition
Factory.h:34
RTC::deleteRTObject
void deleteRTObject(RTObject_impl *rtc)
RTC::Create
RTObject_impl * Create(Manager *manager)
Template function to create RT-Components.
Definition
Factory.h:65
RTC::RtcNewFunc
RTObject_impl *(*)(Manager *) RtcNewFunc
Definition
Factory.h:33
Generated by
1.17.0