AppenderFactory
返回的指針是
SharedAppenderPtr
class
?
NullAppenderFactory
:
public
?
AppenderFactory
{
???
??????????
public
:
???????
SharedAppenderPtr
?
createObject
(
const
?
Properties
&
props
)
?????
??{
???????????
return
?
SharedAppenderPtr
(
new
?
log4cplus
::
NullAppender
(
props
));
??????? }
???????
tstring
?
getTypeName
() {
???????????
return
?
LOG4CPLUS_TEXT
(
"log4cplus::NullAppender"
);
??????? }
};
LayoutFactory
中返回的是
std::auto_ptr
指針
?
class
?
TTCCLayoutFactory
:
public
?
LayoutFactory
{
???
public
:
???????
std
::
auto_ptr
<
Layout
>
createObject
(
const
?
Properties
&
props
)
??????? {
???????????
std
::
auto_ptr
<
Layout
>
tmp
(
new
?
log4cplus
::
TTCCLayout
(
props
));
???????????
return
?
tmp
;
??????? }
???????
tstring
?
getTypeName
() {
???????????
return
?
LOG4CPLUS_TEXT
(
"log4cplus::TTCCLayout"
);
??????? }
??? };
這兩者之間有什么樣的區別聯系
?
通過
auto_ptr
可以知道對象實例在返回之后
,
需要將對象的生命周期交給外部的使用者
,
由使用者負責堆對象實例的析構工作
.
分析成果
配置文件的定義實現
,
包含的基本類
,
以及這些類的實現
.
對于實現的動態配置的考慮
:
1.??????
通過生成
RegistryFactory
完成所有需要加載的對象的工廠方法的初始化
,
2.??????
分析配置文件來實現不同方法的調用的實現
3.??????
加載完成
Configure
文件之后
,
既實現的基本的數據的獲取和采集功能
.