没有合适的资源?快使用搜索试试~ 我知道了~
首页poco capsule ioc框架
Inversion of control,缩写为IoC),也叫做依赖注入(Dependency Injection,简称DI),是面向对象编程中的一种设计原则,可以用来减低计算机代码之间的耦合度。用户仅需要将这个XML描述以文件或字符串形式交给PocoCapsule/C++ IoC容器(既以文件名或XML字符串为参量调用PocoCapsule/C++ IoC库函数,见main.C ),让其自动组装部署所描述de应用。
资源详情
资源评论
资源推荐
P
P
o
o
c
c
o
o
C
C
a
a
p
p
s
s
u
u
l
l
e
e
™
™
I
I
o
o
C
C
&
&
D
D
S
S
M
M
f
f
r
r
a
a
m
m
e
e
w
w
o
o
r
r
k
k
f
f
o
o
r
r
C
C
+
+
+
+
D
D
e
e
v
v
e
e
l
l
o
o
p
p
e
e
r
r
G
G
u
u
i
i
d
d
e
e
R
R
e
e
l
l
e
e
a
a
s
s
e
e
1
1
.
.
0
0
O
O
c
c
t
t
o
o
b
b
e
e
r
r
1
1
7
7
,
,
2
2
0
0
0
0
7
7
P
P
o
o
c
c
o
o
m
m
a
a
t
t
i
i
c
c
S
S
o
o
f
f
t
t
w
w
a
a
r
r
e
e
L
L
L
L
C
C
F
F
o
o
s
s
t
t
e
e
r
r
C
C
i
i
t
t
y
y
,
,
C
C
A
A
.
.
U
U
S
S
A
A
PocoCapsule/C++ Developer Guide Pocomatic Software
1
PocoCapsule™ IoC & DSM framework for C++,
Developer Guide
Release 1.0
October 17, 2007
Foster City, CA. USA
Copyright© 2007 by Pocomatic Software LLC.
All rights reserved. No part of this publication may be reproduced,
stored in a retrieval system, or transmitted, in any form, or by any
means, electronic, mechanical, photocopying, recording, or
otherwise, without the prior consent of Pocomatic Software LLC.
This document is available at:
http://www.pocomatic.com/docs/pococpp-iocdsm-dev-guide.pdf
Examples used in this document are available at:
http://www.pocomatic.com/docs/cpp-examples
The installation packages of PocoCapsule/C++ IoC&DSM framework
for Linux/Unix, Windows, and VxWorks are either downloadable at:
http://www.pocomatic.com or available by sending request to
prod@pocomatic.com
PocoCapsule/C++ Developer Guide Pocomatic Software
2
T
T
a
a
b
b
l
l
e
e
o
o
f
f
C
C
o
o
n
n
t
t
e
e
n
n
t
t
T
T
a
a
b
b
l
l
e
e
o
o
f
f
C
C
o
o
n
n
t
t
e
e
n
n
t
t..................................................................................................................... 2
C
C
h
h
a
a
p
p
t
t
e
e
r
r
1
1
I
I
n
n
t
t
r
r
o
o
d
d
u
u
c
c
t
t
i
i
o
o
n
n ............................................................................................................ 6
1.1 Why and What of IoC .................................................................................................... 6
1.1.1 Neutral to component programming models.............................................................. 8
1.1.2 Hollywood Principle, Container Agnostic, and Dependency Injection........................... 8
1.1.3 Non-invasive to components ................................................................................... 9
1.1.4 Straightforwardness, lightweight, and zero overhead............................................... 10
1.2 Why and What of DSM/DSL......................................................................................... 10
1.2.1 Building DSM/DSL declaratively and portably ......................................................... 11
1.2.2 IoC + DSM: A paradigm shift ................................................................................. 11
1.2.3 IoC + DSM: A framework of frameworks................................................................. 12
1.3 About this document ................................................................................................... 13
C
C
h
h
a
a
p
p
t
t
e
e
r
r
2
2
G
G
e
e
t
t
t
t
i
i
n
n
g
g
S
S
t
t
a
a
r
r
t
t
e
e
d
d ..................................................................................................... 14
2.1 A Hello Example ......................................................................................................... 14
2.1.1 A simple POCO bean class................................................................................... 14
2.1.2 Creating the deployment description ...................................................................... 15
2.1.3 Generating dynamic invocation proxies .................................................................. 16
2.1.4 A mini container ................................................................................................... 17
2.1.5 Deploying the application ...................................................................................... 18
2.1.6 Calling stdio printf() and << operator on std::cout .................................................... 19
2.1.7 Tracing IoC invocations ........................................................................................ 21
2.2 GPS Example – Dependency Injection.......................................................................... 21
2.2.1 The GPS instrument and its component devices ..................................................... 21
2.2.2 The deployment description .................................................................................. 22
2.2.3 Generating dynamic invocation proxies .................................................................. 24
2.2.4 Running the example............................................................................................ 25
2.3 Use encoded and/or in memory descriptions ................................................................. 25
2.3.1 Encoding the description....................................................................................... 25
2.3.2 Descriptions as buffer or literal strings.................................................................... 26
C
C
h
h
a
a
p
p
t
t
e
e
r
r
3
3
T
T
h
h
e
e
C
C
o
o
r
r
e
e
S
S
c
c
h
h
e
e
m
m
a
a................................................................................................. 28
3.1 The <poco-application-context> element....................................................................... 28
3.2 The <bean> element ................................................................................................... 29
3.2.1 The class attribute................................................................................................ 30
3.2.2 The singleton attribute .......................................................................................... 31
3.2.3 The lazy-init attribute ............................................................................................ 32
3.2.4 The factory-method and factory-bean attribute........................................................ 32
3.2.5 The dup-method and self-dup-method attributes ..................................................... 33
3.2.6 The destroy-method, self-destroy-method and destroy-bean attributes...................... 34
3.2.7 The id attribute..................................................................................................... 35
3.2.8 The depends-on attribute ...................................................................................... 36
3.2.9 The abstract attribute............................................................................................ 36
3.2.10 The label attribute............................................................................................... 36
PocoCapsule/C++ Developer Guide Pocomatic Software
3
3.3 The <ioc> and <property> element ............................................................................... 36
3.4 The <method-arg> element.......................................................................................... 38
3.4.1 The type attribute ................................................................................................. 40
3.4.2 The value attribute ............................................................................................... 41
3.4.3 The ref attribute and <ref> element........................................................................ 41
3.4.4 The pass attribute ................................................................................................ 41
3.4.5 The class attribute................................................................................................ 42
3.4.6 The env-var attribute ............................................................................................ 42
3.5 The <array> and <item> elements................................................................................ 43
3.5.1 Array argument passing convention ....................................................................... 44
3.5.2 The env-var attribute of <array> ............................................................................ 45
3.5.3 The name, value, ref, and env-var attributes of the <item>....................................... 45
3.6 The <map>, <set> and <list> elements ......................................................................... 46
3.7 Bean instantiation management ................................................................................... 46
3.8 Bean ref-count and lifecycle control .............................................................................. 47
3.9 The <import> element ................................................................................................. 48
3.10 The <load> element .................................................................................................. 49
C
C
h
h
a
a
p
p
t
t
e
e
r
r
4
4
U
U
s
s
e
e
r
r
D
D
e
e
f
f
i
i
n
n
e
e
d
d
S
S
c
c
h
h
e
e
m
m
a
a
s
s
a
a
n
n
d
d
D
D
o
o
m
m
a
a
i
i
n
n
S
S
p
p
e
e
c
c
i
i
f
f
i
i
c
c
M
M
o
o
d
d
e
e
l
l
i
i
n
n
g
g............................................. 52
4.1 Why DSM/DSL in IoC frameworks ................................................................................ 52
4.2 Facilitating DSM/DSL in IoC frameworks....................................................................... 55
4.3 GPS in a user defined DSM schema............................................................................. 57
4.3.1 Define the DSM schema ....................................................................................... 57
4.3.2 Declare schema transform templates ..................................................................... 58
4.3.3 Using the user defined DSM/DSL schema.............................................................. 59
4.3 A framework of frameworks ......................................................................................... 60
C
C
h
h
a
a
p
p
t
t
e
e
r
r
5
5
P
P
o
o
c
c
o
o
C
C
a
a
p
p
s
s
u
u
l
l
e
e
/
/
C
C
+
+
+
+
A
A
P
P
I
I........................................................................................... 64
5.1 The POCO_ApplicationContext class............................................................................ 64
5.1.1 The create () method ............................................................................................ 65
5.1.2 The initSingletons() and terminate() methods.......................................................... 65
5.1.3 The getBean() and getBeanPtrTypeId() methods .................................................... 65
5.1.4 The setDefaultAppEnv(), getDefaultAppEnv(), initDefaultAppEnv() methods.............. 67
5.1.5 The destroy() method ........................................................................................... 68
5.2 The POCO_AppEnv class ........................................................................................... 68
5.2.1 The reset() method............................................................................................... 69
5.2.2 The get_message() method .................................................................................. 69
5.2.3 The warning() method........................................................................................... 70
5.2.4 The has_error() method ........................................................................................ 70
5.2.5 The get_message() method .................................................................................. 70
5.2.6 The setValue() and getValue() methods ................................................................. 70
5.2.7 The setArray() and getArray() methods .................................................................. 71
C
C
h
h
a
a
p
p
t
t
e
e
r
r
6
6
U
U
t
t
i
i
l
l
i
i
t
t
i
i
e
e
s
s
,
,
L
L
i
i
b
b
r
r
a
a
r
r
i
i
e
e
s
s
,
,
S
S
c
c
h
h
e
e
m
m
a
a
s
s
,
,
a
a
n
n
d
d
S
S
t
t
y
y
l
l
e
e
s
s
h
h
e
e
e
e
t
t
s
s.......................................................... 74
6.1 pxtransform ................................................................................................................ 74
6.2 pxgenproxy ................................................................................................................ 75
6.3 pxencode ................................................................................................................... 77
6.4 libraries...................................................................................................................... 79
6.4.1 libpococapsule.so (pococapsule.dll)....................................................................... 79
PocoCapsule/C++ Developer Guide Pocomatic Software
4
6.4.2 libpocoxsl.so/libpocoxml.so (pocoxsl.dll/pocoxml.dll) ............................................... 79
6.4.2 libpoco2*.so (poco2*.dll) ....................................................................................... 79
6.5 Schemas and transformation stylesheets ...................................................................... 79
6.5.1 DTD of schemas .................................................................................................. 80
6.5.2 Schema transformation stylesheets ....................................................................... 80
A
A
p
p
p
p
e
e
n
n
d
d
i
i
x
x
A
A
.
.
W
W
e
e
b
b
S
S
e
e
r
r
v
v
i
i
c
c
e
e
s
s
a
a
n
n
d
d
t
t
h
h
e
e
O
O
A
A
S
S
I
I
S
S
O
O
p
p
e
e
n
n
C
C
S
S
A
A.............................................................. 82
A.1 Web Services containers............................................................................................. 82
A.2 The SCA (OASIS CSA) model ..................................................................................... 82
A.3 The PocoCapsule for Web Services ............................................................................. 84
A.4 The bigbank example in PocoCapsule.......................................................................... 85
A.5 SCA via IoC and DSM................................................................................................. 87
A
A
p
p
p
p
e
e
n
n
d
d
i
i
x
x
B
B
.
.
R
R
o
o
b
b
o
o
t
t
i
i
c
c
C
C
o
o
m
m
p
p
o
o
n
n
e
e
n
n
t
t ........................................................................................... 92
A
A
p
p
p
p
e
e
n
n
d
d
i
i
x
x
C
C
.
.
S
S
o
o
f
f
t
t
w
w
a
a
r
r
e
e
D
D
e
e
f
f
i
i
n
n
e
e
d
d
R
R
a
a
d
d
i
i
o
o
a
a
n
n
d
d
t
t
h
h
e
e
J
J
T
T
R
R
S
S
-
-
S
S
C
C
A
A......................................................... 96
A
A
p
p
p
p
e
e
n
n
d
d
i
i
x
x
D
D
.
.
C
C
o
o
m
m
p
p
o
o
n
n
e
e
n
n
t
t
-
-
B
B
a
a
s
s
e
e
d
d
C
C
O
O
R
R
B
B
A
A
a
a
p
p
p
p
l
l
i
i
c
c
a
a
t
t
i
i
o
o
n
n
s
s............................................................ 102
D.1 The need for a component framework ........................................................................ 102
D.2 CCM: More trouble than worth................................................................................... 103
D.3 PocoCapsule: Simple is better................................................................................... 104
剩余105页未读,继续阅读
klibo
- 粉丝: 1
- 资源: 22
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- RTL8188FU-Linux-v5.7.4.2-36687.20200602.tar(20765).gz
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
- SPC统计方法基础知识.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0