[boost-doc-zh commit] r271 - Signals2设计原理中与Signal相同部份翻译, 同时更新Signal相关内容

  • From: codesite-noreply@xxxxxxxxxx
  • To: boost-doc-zh-notify@xxxxxxxxxxxxx
  • Date: Thu, 18 Jun 2009 07:17:29 +0000

Author: jinq0123@xxxxxxx
Date: Wed Jun 17 23:42:47 2009
New Revision: 271

Modified:
   trunk/doc/html/signals/s06.html
   trunk/doc/html/signals2.html
   trunk/doc/html/signals2/rationale.html
   trunk/doc/html/signals2/tutorial.html

Log:
Signals2设计原理中与Signal相同部份翻译, 同时更新Signal相关内容

Modified: trunk/doc/html/signals/s06.html
==============================================================================
--- trunk/doc/html/signals/s06.html     (original)
+++ trunk/doc/html/signals/s06.html     Wed Jun 17 23:42:47 2009
@@ -181,7 +181,9 @@
 possibly more error-prone for several reasons:</p>
 <p><span class="bold"><strong>断开时传递一个标记</strong></span>:
这个方法用一个容易比较的标记来标识插槽(例如用字符串), 插槽可以是任意的函 数对象。 虽然这个方法本质上等效于 Boost.Signals
-所采用的方法, 但它可能容易出错,因为以下原因: </p>
+所采用的方法,
+但是因为以下几个原因,它更容易出错:
+</p>
 <div class="itemizedlist">
 <ul type="circle">
 <li>
@@ -243,10 +245,10 @@
 not reusable (either in other signals &amp; slots libraries or
 within other generic algorithms), and the learning curve is steepened
 slightly to learn the specific combiner interface.</p>
-<p> 合并器(Combiner)接口模仿了对C++标准库算法的调用。 对熟练的C++程序员来 说,合并器接口是感觉最自然的, -因为它把插槽调用的结果看作仅仅是一系列通过输入迭代器访问的值, 与之匹敌的接 口设计一般要求合并器构造成符合一定的接口, -使之可以为信号库定制(及受制于信号库)。 虽然这些接口通常使信号插槽库的实现 更简单, -但可惜合并器不是可重用的(在其他信号插槽库或在其他通用算法中), 并且学习特 殊的合并器接口的学习曲线有点陡。 </p> +<p> 合并器(Combiner)接口模仿了对C++标准库算法的调用。 对熟练的C++程序员来 说,合并器是感觉最自然的接口, +因为它把插槽调用的结果看作仅仅是一系列通过输入迭代器访问的值。 与之匹敌的接 口设计一般要求合并器构造成符合一定的接口, +使之可以为信号库定制(并局限于库)。 虽然这些接口通常使信号插槽库的实现更简 单, +但可惜这种合并器不可重用(在其他信号插槽库或在其他通用算法中), 并且学习特 殊的合并器接口的学习曲线有点陡。 </p>
 <p> The Signals formulation of combiners is based on the combiner
 using the "pull" mode of communication, instead of the more complex
 "push" mechanism. With a "pull" mechanism, the combiner's state can be
@@ -259,10 +261,13 @@
 called. Compare, for example, a combiner that returns the maximum
 element from calling the slots. If the maximum element ever exceeds
 100, no more slots are to be called.</p>
-<p> Signals 库对合并器的配方设计基于使用"拉(pull)"模式通讯的合并器, 而不 是更复杂的"推(push)"机制。 +<p> Signals 库的合并器设计方案基于使用"拉(pull)"模式通讯的合并器, 而不是 更复杂的"推(push)"机制。 用"拉"机制,合并器的状态可以保存在栈上,并保持程序计数器寄存器, 因为无论何 时需要新数据时(即调用下一插槽来提取其返回值), 有一个简单的接口来立即提取那个数据, 而不必从合并器的代码中返回。 "推"机制 与此相反,它的合并器必须在类成员中保存所有的状态, -因为每次调用信号都会引起合并器函数的调用。 例如,比较一下以两种模式实现一个 从插槽调用返回最大元素的合并器。 如果最大元素超过 100,就不再调用以后的插 槽。 </p>
+因为每次调用信号都会引起合并器函数的调用。
+比较下例合并器的两种实现,
+该合并器返回插槽调用的最大元素。
+如果最大元素超过 100,就不再调用以后的插槽。 </p>
 <div class="informaltable">
 <table class="table">
 <colgroup><col><col></colgroup>
@@ -297,7 +302,7 @@
 shorter and more reusable and will often be construed as easier to
 write and understand, even outside the context of a signals &amp;
 slots library.</p>
-<p>这些例子中要注意几点。 "拉"的版本是个可重用的函数对象, 基于 <code class="computeroutput">value_type</code> 为整数的输入迭代器序列, +<p>该例中要注意几点。 "拉"的版本是个可重用的函数对象, 基于 <code class="computeroutput">value_type</code> 为整数的输入迭代器序列, 并且设计上非常简单。 另一方面,"推"的版本依赖于调用者专有的接口,一般不是可 重用的。 它同时要求额外的状态值,例如,是否已经接收过元素。 尽管代码质量和易用性是主观性的, "拉"模式明显更短并且重用性更好,并且往往更 容易编写和理解, 即使是脱离信号插槽库的上下文。 </p>
 <p> The cost of the "pull" combiner interface is paid in the

Modified: trunk/doc/html/signals2.html
==============================================================================
--- trunk/doc/html/signals2.html        (original)
+++ trunk/doc/html/signals2.html        Wed Jun 17 23:42:47 2009
@@ -160,7 +160,7 @@
<dt><span class="section"><a href="signals2/rationale.html#id3386287">默认 合并器为 optional_last_value</a></span></dt> <dt><span class="section"><a href="signals2/rationale.html#id3386348">合并 器接口</a></span></dt> <dt><span class="section"><a href="signals2/rationale.html#id3386428">连接 的接口:+= 运算符</a></span></dt> -<dt><span class="section"><a href="signals2/rationale.html#id3386600">Signals2 互斥体类</a></span></dt> +<dt><span class="section"><a href="signals2/rationale.html#id3386600">Signals2 互斥类</a></span></dt> <dt><span class="section"><a href="signals2/rationale.html#id3386712">与其 他信号/插槽实现的比较</a></span></dt>
 </dl></dd>
<dt><span class="section"><a href="signals2/porting.html">从 Boost.Signals 向 Boost.Signals2 移植</a></span></dt>

Modified: trunk/doc/html/signals2/rationale.html
==============================================================================
--- trunk/doc/html/signals2/rationale.html      (original)
+++ trunk/doc/html/signals2/rationale.html      Wed Jun 17 23:42:47 2009
@@ -1,11 +1,11 @@
 <html>
 <head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 <title>Design Rationale</title>
 <link rel="stylesheet" href="../boostbook.css" type="text/css">
 <meta name="generator" content="DocBook XSL Stylesheets V1.74.3">
<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
-<link rel="up" href="../signals2.html" title="Chapter 17. Boost.Signals2">
+<link rel="up" href="../signals2.html" title="Chapter 17. Boost.Signals2">
 <link rel="prev" href="faq.html" title="Frequently Asked Questions">
<link rel="next" href="porting.html" title="Porting from Boost.Signals to Boost.Signals2">
 </head>
@@ -25,6 +25,10 @@
 <div class="section" lang="en">
 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
 <a name="signals2.rationale"></a>Design Rationale</h2></div></div></div>
+
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="signals2.rationale"></a>设计原理</h2></div></div></div>
+
 <div class="toc"><dl>
<dt><span class="section"><a href="rationale.html#id3385960">User-level Connection Management</a></span></dt> <dt><span class="section"><a href="rationale.html#id3386133">Automatic Connection Management</a></span></dt>
@@ -34,9 +38,24 @@
<dt><span class="section"><a href="rationale.html#id3386600">Signals2 Mutex Classes</a></span></dt> <dt><span class="section"><a href="rationale.html#id3386712">Comparison with other Signal/Slot implementations</a></span></dt>
 </dl></div>
+
+<div class="toc"><dl>
+<dt><span class="section"><a href="rationale.html#id3385960">用户层连接管理 </a></span></dt> +<dt><span class="section"><a href="rationale.html#id3386133">自动连接管理 </a></span></dt> +<dt><span class="section"><a href="rationale.html#id3386287">默认合并器为 optional_last_value</a></span></dt> +<dt><span class="section"><a href="rationale.html#id3386348">合并器接口 </a></span></dt> +<dt><span class="section"><a href="rationale.html#id3386428">连接的接 口:+= 运算符</a></span></dt> +<dt><span class="section"><a href="rationale.html#id3386600">Signals2 互斥 类</a></span></dt> +<dt><span class="section"><a href="rationale.html#id3386712">与其他信号/插 槽实现的比较</a></span></dt>
+</dl></div>
+
 <div class="section" lang="en">
 <div class="titlepage"><div><div><h3 class="title">
<a name="id3385960"></a>User-level Connection Management</h3></div></div></div>
+
+<div class="titlepage"><div><div><h3 class="title">
+<a name="id3385960"></a>用户层连接管理</h3></div></div></div>
+
 <p> Users need to have fine control over the connection of
     signals to slots and their eventual disconnection. The primary approach
     taken by Boost.Signals2 is to return a
@@ -45,6 +64,21 @@
automatic disconnection on destruction mode (<code class="computeroutput"><a class="link" href="../boost/signals2/scoped_connection.html" title="Class scoped_connection">scoped_connection</a></code>).
     In addition, two other interfaces are supported by the
<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1242363-bb">signal::disconnect</a></code> overloaded method:</p>
+
+<p> 用户需要精确控制信号到插槽的连接和它们最后的断开。
+
+    Boost.Signals2 所采用的主要方法是,
+    返回一个
+ <code class="computeroutput"><a class="link" href="../boost/signals2/connection.html" title="Class connection">connection</a></code>
+    对象,让人能够进行已连接/已断开查询、手工断开,
+    及在析构模式
+ (<code class="computeroutput"><a class="link" href="../boost/signals2/scoped_connection.html" title="Class scoped_connection">scoped_connection</a></code>)
+    下自动断开。
+
+    另外,
+ <code class="computeroutput"><a class="link" href="../boost/signalN.html#id1242363-bb">signal::disconnect</a></code>
+    重载方法还支持其他两个接口:</p>
+
 <div class="itemizedlist"><ul type="disc">
 <li><p><span class="bold"><strong>Pass slot to
         disconnect</strong></span>: in this interface model, the
@@ -55,7 +89,22 @@
         a linear search using slot comparison is performed and the
         slot, if found, is removed from the list. Unfortunately,
         querying connectedness ends up as a
-        linear-time operation.</p></li>
+        linear-time operation.</p>
+
+        <p><span class="bold"><strong>断开时传递插槽</strong></span>:
+        在这个接口模型下,
+        通过
+ <code class="computeroutput">sig.<a class="link" href="../boost/signals2/signalN.html#id1284885-bb">connect</a>(typeof(sig)::slot_type(slot_func))</code>
+        连接的插槽,
+        断开时是通过
+ <code class="computeroutput">sig.<a class="link" href="../boost/signals2/signalN.html#id1280164-bb">disconnect</a>(slot_func)</code>
+        进行的。
+
+ 在内部,将利用插槽比较,执行一个线性搜索, 如果找到该插槽,就从链表 中删除。
+
+        不幸的是,连接查询是线性时间的操作。
+        </p>
+        </li>
 <li>
 <p><span class="bold"><strong>Pass a token to
         disconnect</strong></span>: this approach identifies slots with a
@@ -63,6 +112,16 @@
         slots to be arbitrary function objects. While this approach is
essentially equivalent to the connection approach taken by Boost.Signals2,
         it is possibly more error-prone for several reasons:</p>
+
+<p><span class="bold"><strong>断开时传递一个标记</strong></span>:
+        这个方法用一个容易比较的标记来标识插槽(例如用字符串),
+        插槽可以是任意的函数对象。
+
+        虽然这个方法本质上等效于 Boost.Signals2
+        所采用的方法,
+        但是因为以下几个原因,它更容易出错:
+        </p>
+
 <div class="itemizedlist"><ul type="circle">
 <li><p>Connections and disconnections must be paired, so
             the problem becomes similar to the problems incurred when
@@ -70,23 +129,53 @@
             dynamic memory allocation. While errors of this sort would
             not be catastrophic for a signals and slots
             implementation, their detection is generally
-            nontrivial.</p></li>
+            nontrivial.</p>
+
+            <p>连接与断开必须配对,
+            因此问题变得类似于动态内存分配中的
+            <code class="computeroutput">new</code>
+            和 <code class="computeroutput">delete</code>
+            配对时所产生的问题。
+
+            虽然这种错误对于信号插槽库实现来说并不是灾难性的,
+            但是要检测它们通常并不简单。
+            </p>
+            </li>
 <li><p>If tokens are not unique, two slots may have
             the same name and be indistinguishable. In
             environments where many connections will be made
             dynamically, name generation becomes an additional task
-            for the user.</p></li>
+            for the user.</p>
+
+            <p>如果标记不唯一,
+            两个插槽可能会具有相同的名字而不可区分。
+
+            在动态产生许多连接的环境下,名字生成将成为用户的额外负担。
+            </p>
+            </li>
 </ul></div>
 <p> This type of interface is supported in Boost.Signals2
         via the slot grouping mechanism, and the overload of
<code class="computeroutput"><a class="link" href="../boost/signalN.html#id1242363-bb">signal::disconnect</a></code> which takes an argument of the signal's <code class="computeroutput">Group</code> type.</p>
+
+<p>Boost.Signals2 支持此类接口是通过插槽编组机制,
+        以及以信号的 <code class="computeroutput">Group</code>
+        类型为参数的
+ <code class="computeroutput"><a class="link" href="../boost/signalN.html#id1242363-bb">signal::disconnect</a></code>
+        重载。
+        </p>
+
 </li>
 </ul></div>
 </div>
 <div class="section" lang="en">
 <div class="titlepage"><div><div><h3 class="title">
<a name="id3386133"></a>Automatic Connection Management</h3></div></div></div>
+
+<div class="titlepage"><div><div><h3 class="title">
+<a name="id3386133"></a>自动连接管理</h3></div></div></div>
+
 <p>Automatic connection management in Signals2
depends on the use of <code class="computeroutput">boost::shared_ptr</code> to
       manage the lifetimes of tracked objects.  This is differs from
@@ -129,6 +218,10 @@
 <div class="section" lang="en">
 <div class="titlepage"><div><div><h3 class="title">
<a name="id3386287"></a><code class="computeroutput">optional_last_value</code> as the Default Combiner</h3></div></div></div>
+
+<div class="titlepage"><div><div><h3 class="title">
+<a name="id3386287"></a>默认合并器为 <code class="computeroutput">optional_last_value</code></h3></div></div></div>
+
 <p>
The default combiner for Boost.Signals2 has changed from the <code class="computeroutput">last_value</code>
       combiner used by default in the original Boost.Signals library.
@@ -145,6 +238,10 @@
 <div class="section" lang="en">
 <div class="titlepage"><div><div><h3 class="title">
 <a name="id3386348"></a>Combiner Interface</h3></div></div></div>
+
+<div class="titlepage"><div><div><h3 class="title">
+<a name="id3386348"></a>合并器接口</h3></div></div></div>
+
 <p> The Combiner interface was chosen to mimic a call to an
     algorithm in the C++ standard library. It is felt that by viewing
     slot call results as merely a sequence of values accessed by input
@@ -158,6 +255,12 @@
     other signals &amp; slots libraries or within other generic
     algorithms), and the learning curve is steepened slightly to learn
     the specific combiner interface.</p>
+
+<p> 合并器(Combiner)接口模仿了对C++标准库算法的调用。 对熟练的C++程序员来 说,合并器是感觉最自然的接口, +因为它把插槽调用的结果看作仅仅是一系列通过输入迭代器访问的值。 与之匹敌的接 口设计一般要求合并器构造成符合一定的接口, +使之可以为 Signals2 库定制(并局限于库)。 虽然这些接口通常使信号插槽库的实 现更简单, +但可惜这种合并器不可重用(在其他信号插槽库或在其他通用算法中), 并且学习特 殊的合并器接口的学习曲线有点陡。 </p>
+
 <p> The Signals2 formulation of combiners is based on the
     combiner using the "pull" mode of communication, instead of the
     more complex "push" mechanism. With a "pull" mechanism, the
@@ -171,6 +274,15 @@
     called. Compare, for example, a combiner that returns the maximum
     element from calling the slots. If the maximum element ever
     exceeds 100, no more slots are to be called.</p>
+
+<p> Signals2 库的合并器设计方案基于使用"拉(pull)"模式通讯的合并器, 而不 是更复杂的"推(push)"机制。 +用"拉"机制,合并器的状态可以保存在栈上,并保持程序计数器寄存器, 因为无论何 时需要新数据时(即调用下一插槽来提取其返回值), +有一个简单的接口来立即提取那个数据, 而不必从合并器的代码中返回。 "推"机制 与此相反,它的合并器必须在类成员中保存所有的状态,
+因为每次调用信号都会引起合并器函数的调用。
+比较下例合并器的两种实现,
+该合并器返回插槽调用的最大元素。
+如果最大元素超过 100,就不再调用以后的插槽。 </p>
+
 <div class="informaltable"><table class="table">
 <colgroup>
 <col>
@@ -255,6 +367,11 @@
     subjective, the "pull" model is clearly shorter and more reusable
     and will often be construed as easier to write and understand,
     even outside the context of a signals &amp; slots library.</p>
+
+<p>该例中要注意几点。 "拉"的版本是个可重用的函数对象, 基于 <code class="computeroutput">value_type</code> 为整数的输入迭代器序列, +并且设计上非常简单。 另一方面,"推"的版本依赖于调用者专有的接口,一般不是可 重用的。 它同时要求额外的状态值,例如,是否已经接收过元素。 +尽管代码质量和易用性是主观性的, "拉"模式明显更短并且重用性更好,并且往往更 容易编写和理解, 即使是脱离信号插槽库的上下文。 </p>
+
 <p> The cost of the "pull" combiner interface is paid in the
     implementation of the Signals2 library itself. To correctly handle
     slot disconnections during calls (e.g., when the dereference
@@ -269,16 +386,34 @@
     that in the "push" model, but we have inverted the control
     structures to make iteration and dereference complex (instead of
     making combiner state-finding complex).</p>
+
+<p> "拉"合并器接口的代价支付于 Signals2 库本身的实现中。
+为了正确处理在调用中的插槽断开(例如当调用解引用运算符时), 你必须让迭代器 跳过已断开的插槽。 另外,迭代器必须携带一组参数以传送到每个插槽 +(尽管一个包含那些参数的结构的引用就足够了), 并且必须缓存插槽调用的结 果, 这样多次解引用才不会导致多次调用。 这显然需要很大的开销, +尽管如果考虑调用插槽整个过程,该开销几乎等同于"推"模型的开销, 但是我们颠倒 了控制结构, 让迭代和解引用变复杂了
+(替代了合并器状态查找的复杂性)。 </p>
+
 </div>
 <div class="section" lang="en">
 <div class="titlepage"><div><div><h3 class="title">
<a name="id3386428"></a>Connection Interfaces: += operator</h3></div></div></div>
+
+<div class="titlepage"><div><div><h3 class="title">
+<a name="id3386428"></a>连接的接口:+= 运算符</h3></div></div></div>
+
 <p> Boost.Signals2 supports a connection syntax with the form
<code class="computeroutput">sig.<a class="link" href="../boost/signals2/signalN.html#id1284885-bb">connect</a>(slot)</code>, but a more terse syntax <code class="computeroutput">sig += slot</code> has been suggested (and
     has been used by other signals &amp; slots implementations). There
     are several reasons as to why this syntax has been
     rejected:</p>
+
+<p> Boost.Signals2 支持形如
+<code class="computeroutput">sig.<a class="link" href="../boost/signals2/signalN.html#id1284885-bb">connect</a>(slot)</code>
+的连接语法, 但是有人建议用更简洁的语法
+<code class="computeroutput">sig += slot</code>
+(并已被其他信号插槽实现所用)。 为什么拒绝这个语法有以下几个原因: </p>
+
 <div class="itemizedlist"><ul type="disc">
 <li><p><span class="bold"><strong>It's unnecessary</strong></span>: the
         connection syntax supplied by Boost.Signals2 is no less
@@ -286,14 +421,33 @@
operator. The savings in typing (<code class="computeroutput">connect()</code> vs. <code class="computeroutput">+=</code>) is essentially negligible. Furthermore, one could argue that calling <code class="computeroutput">connect()</code> is more - readable than an overload of <code class="computeroutput">+=</code>.</p></li> + readable than an overload of <code class="computeroutput">+=</code>.</p>
+
+<p><span class="bold"><strong>没必要</strong></span>:
+Boost.Signals2 提供的连接语法并不比 <code class="computeroutput">+=</code>
+运算符差。 少打几个字符(<code class="computeroutput">connect()</code>
+vs. <code class="computeroutput">+=</code>)根本是可以忽略的。
+另外,有人主张调用 <code class="computeroutput">connect()</code>
+比 <code class="computeroutput">+=</code> 重载可读性更好。</p>
+
+        </li>
 <li><p><span class="bold"><strong>Ambiguous return type</strong></span>:
         there is an ambiguity concerning the return value of the
<code class="computeroutput">+=</code> operation: should it be a reference to the signal itself, to enable <code class="computeroutput">sig += slot1 += slot2</code>,
         or should it return a
<code class="computeroutput"><a class="link" href="../boost/signals2/connection.html" title="Class connection">connection</a></code> for the
-        newly-created signal/slot connection?</p></li>
+        newly-created signal/slot connection?</p>
+
+<p><span class="bold"><strong>返回类型二义性</strong></span>:
+<code class="computeroutput">+=</code>
+运算符的返回值存在二义性。 它应该是返回信号本身的引用,可以
+<code class="computeroutput">sig += slot1 += slot2</code>,
+还是返回新建的信号/插槽连接的一个
+<code class="computeroutput"><a class="link" href="../boost/signals2/connection.html" title="Class connection">connection</a></code>
+?</p>
+
+        </li>
 <li>
 <p><span class="bold"><strong>Gateway to operators -=,
         +</strong></span>: when one has added a connection operator
@@ -301,18 +455,35 @@
operator <code class="computeroutput">-=</code>. However, this presents problems when
         the library allows arbitrary function objects to implicitly
         become slots, because slots are no longer comparable.  </p>
+
+<p><span class="bold"><strong>通往运算符 -=、+</strong></span>:
+当添加一个连接运算符 <code class="computeroutput">+=</code>,
+好像自然地要有一个断开运算符 <code class="computeroutput">-=</code>。
+然而, 当库允许任意的函数对象隐式地变成插槽时, 这里出现了问题, 因为插槽不 再具有比较性。 </p>
+
 <p> The second obvious addition when one has
<code class="computeroutput">operator+=</code> would be to add a <code class="computeroutput">+</code>
         operator that supports addition of multiple slots, followed by
         assignment to a signal. However, this would require
implementing <code class="computeroutput">+</code> such that it can accept any two
         function objects, which is technically infeasible.</p>
+
+<p> 当具有 <code class="computeroutput">operator+=</code>
+时,第二个明显会添加的是 <code class="computeroutput">+</code>
+运算符,以支持多个插槽相加,然后再赋值到信号。 然而,这要求实现
+<code class="computeroutput">+</code>
+可以接收任意两个函数对象, 这在技术上是不可行的。 </p>
+
 </li>
 </ul></div>
 </div>
 <div class="section" lang="en">
 <div class="titlepage"><div><div><h3 class="title">
 <a name="id3386600"></a>Signals2 Mutex Classes</h3></div></div></div>
+
+<div class="titlepage"><div><div><h3 class="title">
+<a name="id3386600"></a>Signals2 互斥类</h3></div></div></div>
+       
 <p>
The Boost.Signals2 library provides 2 mutex classes: <code class="computeroutput"><a class="link" href="../boost/signals2/mutex.html" title="Class mutex">boost::signals2::mutex</a></code>, and <code class="computeroutput"><a class="link" href="../boost/signals2/dummy_mutex.html" title="Class dummy_mutex">boost::signals2::dummy_mutex</a></code>. The motivation for providing
@@ -333,13 +504,27 @@
 <div class="section" lang="en">
 <div class="titlepage"><div><div><h3 class="title">
<a name="id3386712"></a>Comparison with other Signal/Slot implementations</h3></div></div></div>
+
+<div class="titlepage"><div><div><h3 class="title">
+<a name="id3386712"></a>与其他信号/插槽实现的比较</h3></div></div></div>
+
 <div class="toc"><dl>
<dt><span class="section"><a href="rationale.html#id3386718">libsigc++</a></span></dt> <dt><span class="section"><a href="rationale.html#id3386790">.NET delegates</a></span></dt>
 </dl></div>
+
+<div class="toc"><dl>
+<dt><span class="section"><a href="rationale.html#id3386718">libsigc++</a></span></dt> +<dt><span class="section"><a href="rationale.html#id3386790">.NET 委托 </a></span></dt>
+</dl></div>
+
 <div class="section" lang="en">
 <div class="titlepage"><div><div><h4 class="title">
 <a name="id3386718"></a>libsigc++</h4></div></div></div>
+
+<div class="titlepage"><div><div><h4 class="title">
+<a name="id3386718"></a>libsigc++</h4></div></div></div>
+
<p> <a href="http://libsigc.sourceforge.net"; target="_top">libsigc++</a> is a C++
       signals &amp; slots library that originally started as part of
an initiative to wrap the C interfaces to <a href="http://www.gtk.org"; target="_top">GTK</a> libraries in C++, and has
@@ -351,6 +536,16 @@
       connections. There
       are some major differences in design that separate these
       libraries:</p>
+
+<p><a href="http://libsigc.sourceforge.net"; target="_top">libsigc++</a>
+是个C++信号插槽库, 最初开始于一个项目的一部分,
+用C++封装 <a href="http://www.gtk.org"; target="_top">GTK</a>
+库的C接口, 并且发展成为一个独立的库,由 Karl Nelson 维护。
+libsigc++ 和 Boost.Signals2
+之间有很多相同之处, 其实原 Boost.Signals 受 Karl Nelson 和 libsigc++ 影响 很大。
+粗略地检查这两个库就会发现相似的语法, 如信号的构造
+和连接的使用。 这两个库在设计上的主要区别是: </p>
+
 <div class="itemizedlist"><ul type="disc">
 <li><p><span class="bold"><strong>Slot definitions</strong></span>:
           slots in libsigc++ are created using a set of primitives
@@ -358,37 +553,80 @@
           objects (as part of the library), explicit adaptation from
           the argument and return types of the signal to the argument
           and return types of the slot (libsigc++ is, by default, more
-          strict about types than Boost.Signals2).</p></li>
+          strict about types than Boost.Signals2).</p>
+
+<p><span class="bold"><strong>插槽定义</strong></span>:
+libsigc++ 中的插槽用一套库定义的原语创建。
+这些原语允许对象绑定(作为库的一部分),
+显式地把信号的参数和返回类型适配为插槽的参数和返回类型
+(相比 Boost.Signals2,libsigc++ 在默认情况下对类型更严格)。
+</p>
+
+          </li>
 <li><p><span class="bold"><strong>Combiner/Marshaller
           interface</strong></span>: the equivalent to Boost.Signals2
           combiners in libsigc++ are the marshallers. Marshallers are
           similar to the "push" interface described in Combiner
           Interface, and a proper treatment of the topic is given
-          there.</p></li>
+          there.</p>
+
+<p><span class="bold"><strong>合并器/集结器接口</strong></span>:
+libsigc++ 中与 Boost.Signals 的合并器等效的是集结器(marshaller)。
+集结器类似于"合并器接口"一节中描述的"推"接口, 那里对该主题进行了适当的分 析。 </p>
+
+          </li>
 </ul></div>
 </div>
 <div class="section" lang="en">
 <div class="titlepage"><div><div><h4 class="title">
 <a name="id3386790"></a>.NET delegates</h4></div></div></div>
+
+<div class="titlepage"><div><div><h4 class="title">
+<a name="id3386790"></a>.NET 委托</h4></div></div></div>
+
 <p> <a href="http://www.microsoft.com"; target="_top">Microsoft</a>
       has introduced the .NET Framework and an associated set of
       languages and language extensions, one of which is the
       delegate. Delegates are similar to signals and slots, but they
       are more limited than most C++ signals and slots implementations
       in that they:</p>
+
+<p><a href="http://www.microsoft.com"; target="_top">微软</a>
+引入了 .NET 框架,并关联了一组语言和语言扩展,
+其中之一就是委托(delegate)。 委托类似于信号插槽,
+但是它比大多数C++信号插槽的实现具有更多的限制, 表现在: </p>
+
 <div class="itemizedlist"><ul type="disc">
 <li><p>Require exact type matches between a delegate and what
-          it is calling.</p></li>
-<li><p>Only return the result of the last target called, with no option for customization.</p></li>
+          it is calling.</p>
+
+<p>在委托和它的调用之间,要求精确的类型匹配。</p>
+
+</li>
+<li><p>Only return the result of the last target called, with no option for customization.</p>
+
+<p>仅返回最后调用目标的结果,无法定制。</p>
+
+</li>
<li><p>Must call a method with <code class="computeroutput">this</code> already
-          bound.</p></li>
+          bound.</p>
+
+<p>必须调用一个 <code class="computeroutput">this</code>
+已绑定的方法。 </p>
+
+</li>
 </ul></div>
 </div>
 </div>
 </div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"; width="100%"><tr> <td align="left"><p><small>Last revised: June 12, 2007 at 14:01:23 -0400</small></p></td> -<td align="right"><div class="copyright-footer">Copyright 2001-2004 Douglas Gregor<br>Copyright 2007-2009 Frank Mori Hess<p>Distributed under the Boost +<td align="right"><div class="copyright-footer">Copyright (c) 2001-2004 Douglas Gregor<br>Copyright (c) 2007-2009 Frank Mori Hess
+
+    <p>翻译:<a href="http://blog.csdn.net/jq0123";>金庆</a></p>
+    <p>译文更新:2009.6.18</p>
+
+    <p>Distributed under the Boost
     Software License, Version 1.0. (See accompanying file
<code class="filename">LICENSE_1_0.txt</code> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt"; target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)</p>
 </div></td>

Modified: trunk/doc/html/signals2/tutorial.html
==============================================================================
--- trunk/doc/html/signals2/tutorial.html       (original)
+++ trunk/doc/html/signals2/tutorial.html       Wed Jun 17 23:42:47 2009
@@ -74,6 +74,7 @@
 <tr><td>disconnect</td><td>断开</td><td>&nbsp;</td></tr>
 <tr><td>metafunction</td><td>元函数</td><td>&nbsp;</td></tr>
 <tr><td>mutex</td><td>互斥体</td><td>&nbsp;</td></tr>
+<tr><td>mutex class</td><td>互斥类</td><td>&nbsp;</td></tr>
 <tr><td>portable syntax</td><td>兼容句法</td><td>可移植句法</td></tr>
 <tr><td>preferred form</td><td>首选形式</td><td>&nbsp;</td></tr>
 <tr><td>preferred syntax</td><td>首选句法</td><td>&nbsp;</td></tr>
@@ -2017,7 +2018,7 @@
 <p>
       Boost.Signals2 库提供了另外一个可用于
<code class="computeroutput"><a class="link" href="../boost/signal.html" title="Class template signal">signal</a></code>
-      的互斥体类:
+      的互斥类:
<code class="computeroutput"><a class="link" href="../boost/signals2/dummy_mutex.html" title="Class dummy_mutex">boost::signals2::dummy_mutex</a></code>。 这是个用于单线程的假互斥体,因为在单线程中,用真实的互斥体加锁是无谓 的开销。

Other related posts:

  • » [boost-doc-zh commit] r271 - Signals2设计原理中与Signal相同部份翻译, 同时更新Signal相关内容 - codesite-noreply