[boost-doc-zh commit] r218 - trunk/libs/flyweight/doc/tutorial

  • From: codesite-noreply@xxxxxxxxxx
  • To: boost-doc-zh-notify@xxxxxxxxxxxxx
  • Date: Wed, 11 Mar 2009 09:43:09 +0000

Author: zengkun100
Date: Wed Mar 11 02:42:16 2009
New Revision: 218

Modified:
   trunk/libs/flyweight/doc/tutorial/index.html

Log:


Modified: trunk/libs/flyweight/doc/tutorial/index.html
==============================================================================
--- trunk/libs/flyweight/doc/tutorial/index.html        (original)
+++ trunk/libs/flyweight/doc/tutorial/index.html        Wed Mar 11 02:42:16 2009
@@ -1,55 +1,157 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0.1 Transitional//EN">
-
 <html>
 <head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>Boost.Flyweight Documentation - Tutorial</title>
-<link rel="stylesheet" href="../style.css" type="text/css">
-<link rel="start" href="../index.html">
-<link rel="prev" href="../index.html">
-<link rel="up" href="../index.html">
-<link rel="next" href="basics.html">
+
+
+
+
+
+  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+
+
+
+
+
+
+
+
+  <title>Boost.Flyweight Documentation - Tutorial</title>
+  <link rel="stylesheet" href="../style.css" type="text/css">
+
+
+
+
+
+  <link rel="start" href="../index.html">
+
+
+
+
+
+  <link rel="prev" href="../index.html">
+
+
+
+
+
+  <link rel="up" href="../index.html">
+
+
+
+
+
+  <link rel="next" href="basics.html">
 </head>

+
 <body>
-<h1><img src="../../../../boost.png" alt="Boost logo" align=
-"middle" width="277" height="86">Boost.Flyweight Tutorial</h1>
+
+
+
+<h1><img src="../../../../boost.png" alt="Boost logo" align="middle" height="86" width="277">Boost.Flyweight Tutorial</h1>
+
+
+

<div class="prev_link"><a href="../index.html"><img src="../prev.gif" alt="index" border="0"><br>
+
+
+
 Index
 </a></div>
+
+
+
<div class="up_link"><a href="../index.html"><img src="../up.gif" alt="index" border="0"><br>
+
+
+
 Index
 </a></div>
+
+
+
<div class="next_link"><a href="basics.html"><img src="../next.gif" alt="basics" border="0"><br>
+
+
+
 Basics
-</a></div><br clear="all" style="clear: all;">
+</a></div>
+
+
+<br style="" clear="all">
+
+
+

 <hr>

-<h2>Contents</h2>
+<h2>Contents &nbsp;目录</h2>
+
+
+

 <ul>
-  <li><a href="#rationale">Rationale</a></li>
-  <li><a href="#namespace">Namespace</a></li>
-  <li><a href="#guide">Guide to the reader</a></li>
-  <li><a href="basics.html">Basics</a></li>
+
+
+
+  <li><a href="#rationale">Rationale &nbsp;原理</a></li>
+
+
+
+  <li><a href="#namespace">Namespace &nbsp;名字空间</a></li>
+
+
+
+  <li><a href="#guide">Guide to the reader &nbsp;读者指南</a></li>
+
+
+
+  <li><a href="basics.html">Basics &nbsp;基础</a></li>
+
+
+
   <li><a href="key_value.html">Key-value flyweights</a></li>
-  <li><a href="configuration.html">Configuring Boost.Flyweight</a></li>
-  <li><a href="extension.html">Extending Boost.Flyweight</a></li>
-  <li><a href="technical.html">Technical issues</a></li>
+
+
+
+ <li><a href="configuration.html">Configuring Boost.Flyweight &nbsp;配置 </a><a href="configuration.html">Boost.Flyweight</a></li>
+
+
+
+ <li><a href="extension.html">Extending Boost.Flyweight &nbsp;扩展</a><a href="configuration.html">Boost.Flyweight</a></li>
+
+
+
+  <li><a href="technical.html">Technical issues &nbsp;技术问题</a></li>
+
+
+
<li><a href="lambda_expressions.html">Annex: MPL Lambda expressions</a></li>
+
+
+
 </ul>

-<h2><a name="rationale">Rationale</a></h2>

-<span style="float:left;margin-right:20px;margin-bottom:20px">
+
+
+<h2><a name="rationale">Rationale &nbsp;原理</a></h2>
+
+
+
+
+<span style="float: left; margin-right: 20px; margin-bottom: 20px;">
 <p align="center">
-<img src="flyweight_rep.png"
-alt="representation of a flyweight scenario"
-width="424" height="320"><br>
+<img src="flyweight_rep.png" alt="representation of a flyweight scenario" height="320" width="424"><br>
+
+
+
 <b>Fig. 1: Representation of a flyweight scenario.</b>
 </p>
+
+
+
 </span>

 <p>
@@ -58,9 +160,17 @@
When these objects are <i>immutable</i>, i.e. they do not modify its internal
 state except maybe for reattaching to a new set of state data, and some
additional conditions are met, a very convenient optimization technique known
-as the <i>flyweight pattern</i> can be introduced.
+as the <i>flyweight pattern</i> can be introduced.</p>
+
+
+<p>考虑一个需要管理大量小对象的应用程序,这很可能需要比实际所能得到的更多的 内存。当这些对象是不可变的,换句话说,除非是重新附加到一组新的状态 +数据,并且满足一些附加条件,它们的内部状态不会改变,此时可以引入一种非常方 便的称为&ldquo;flyweight
+模式&rdquo;的优化技术。&nbsp;
 </p>

+
+
+
 <p>
 Let us say there are <i>N</i> different objects living at a given time
inside the application, globally taking <i>M</i> different values. If <i>N</i>
@@ -76,9 +186,14 @@
information, such as its Unicode identifier, font, size, typesetting effects, etc., but given that the degree of letter repetition in a document is extremely
 high, implementing those letters as flyweight classes allows us to easily
-handle documents ranging in the hundreds of thousands of characters.
-</p>
+handle documents ranging in the hundreds of thousands of characters.</p>
+

+让我们假设某一时刻应用程序中存在N个不同的对象,总共分为M个不同的值。如果N远 大于M,也就是说,有很多相同的对象,通过引用一个存储着共享对象的公 +用存储桶的句柄类来替换原来的对象我们可以消除这种隐含的冗余,就像这幅图里所 描述的那样。这些句柄对象或者flyweights,它们作为实际值的代 +理,一般只占一个指针的大小。对象越大,N/M比越高,这种技术所能节省的内存就越 显著。字处理应用程序是flyweight惯用法的典型案例:文档中的 +每个字母都携带了大量的信息,比如它的Unicode标识符,字体,大小,排版效果,等 等,但是如果一篇文档中字母的重复率极高的话,使用
+flyweight类型来实现这些字母能让我们轻松的处理高达几十万个字符的文档。
 <p>
 Most presentations of the design pattern found in the literature do make a
distinction between the flyweight <i>intrinsic information</i> (the constant
@@ -91,9 +206,18 @@
 entirely consists of intrinsic information: this allows for a particularly
 appealing realization of the idiom in C++ in which
 <code>flyweight&lt;T&gt;</code> is an opaque type convertible to
-<code>const T&amp;</code>.
+<code>const T&amp;</code>.</p>
+
+
+<p><span style="color: rgb(255, 0, 0);">所能找到的文献中绝大多数对这种设计 模式的的描述都区分了 +flyweight的内在信息(提取到存储桶中的常量)和外在、可变信息,这些信息随 flyweight对象存储或者通过外部传递。从应用程序设计的角度 +来说这种区别对待会有一些好处,但是当说到外部信息实现对整个flyweight体系没有 影响。因此,Boost.Flyweight假定它所操作的类型 +完全只有内在信息:这使得一种非常有趣的惯用法实现在C++里flyweight&lt;T&gt;是 可以转换成const T&amp;的不透明类型。</span>
 </p>

+
+
+
 <p>
 The central repository of shared value objects is known as the <i>flyweight
 factory</i>. This component is able to locate and return a reference to an
@@ -105,27 +229,58 @@
is expected to be suitable for most situations. When this is not the case, it
 is possible to customize the factory or even replace it with another one of
a different type, either provided by Boost.Flyweight or defined by the user.
-Other aspects of the implementation are also customizable and extendable.
+Other aspects of the implementation are also customizable and extendable.<br>
+
+
+<br>
+
+
+共享对象的中央存储桶被称为flyweight工厂。该模块能够找到并返回一个具有给定值 的对象的引用,或者插入这个值如果之前没有存储过该值的拷贝。 +Boost.Flyweight管理着Flyweights和它们的工厂的交互这对程序员来说是透明的,因 此偶尔使用这个库的用户甚至根本不需要关心这个 +工厂的存在。Boost.Flyweight默认使用一个基于哈希容器的工厂这在绝大多数的场合 是适用的。当默认实现不适用的时候,可以定制这个工厂或者 +甚至用另外一个不同的类型来替代它,要么是Boost.Flyweight提供的类型要么是用户 的自定义类型。实现的其它方面同样是可定制和可扩展的。
 </p>

-<h2 clear="all" style="clear: all;">
-<a name="namespace">Namespace</a>
+
+
+
+<h2 clear="all" style="">
+<a name="namespace">Namespace &nbsp;名字空间</a>
 </h2>

+
+
+
 <p>
All the public types of Boost.Flyweight reside in namespace <code>::boost::flyweights</code>. Additionaly, the main class template <code>flyweight</code> is lifted to namespace <code>::boost</code> by means of a <code>using</code> declaration. For brevity of exposition, the fragments of code in the documentation are written as if the following
-directives were in effect:
+directives were in effect:</p>
+
+
+<p>Boost.Flyweight的所有公共类型在::boost::flyweights名字空间下。<span style="color: rgb(255, 0, 0);">另外,通过using指令主类模板flyweight提升到 了::boost名字空间。</span>为表述简洁起见,本文档中的代码段在编写时都假定这几 个使用指令已经声明。
 </p>
+
+
+

-<blockquote><pre>
-<span class=keyword>using</span> <span class=keyword>namespace</span> <span class=special>::</span><span class=identifier>boost</span><span class=special>;</span> -<span class=keyword>using</span> <span class=keyword>namespace</span> <span class=special>::</span><span class=identifier>boost</span><span class=special>::</span><span class=identifier>flyweights</span><span class=special>;</span>
-</pre></blockquote>
+<blockquote>
+
+
+ <pre><span class="keyword">using</span> <span class="keyword">namespace</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">;</span> +<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">flyweights</span><span class="special">;</span> </pre>
+
+
+</blockquote>
+
+
+
+
+<h2><a name="guide">Guide to the reader &nbsp;读者指南</a></h2>
+
+

-<h2><a name="guide">Guide to the reader</a></h2>

 <p>
 Although Boost.Flyweight features an extensive customization
@@ -140,31 +295,71 @@
<a href="configuration.html">configuration</a> section teaches how to fine tune the
 different internal components of the library. Only very advanced usage
 scenarios will require implementing user-provided pluggable components:
-this is covered on the <a href="extension.html">extension</a> section.
+this is covered on the <a href="extension.html">extension</a> section.</p>
+
+
+<p><span style="color: rgb(255, 0, 0);">Boost.Flyweight以一个操控许多内部实 现方面的广泛定制框架为特色,</span>但是这个库的设计指导原则是希望绝大多数的 用户不需要关心或者 +根本不用意识到底层的复杂性。把Boost.Flyweight当作一个拿来即用的库来学习只需 要阅读<a href="basics.html">基础</a>章节和略读<a href="key_value.html">key-value
+flyweight</a>部分,
+flyweight<a href="configuration.html#tagging">类型标注</a>章节和一<a href="technical.html">技术讨论</a>。<a href="configuration.html">配置</a>章 节讲解如何调优这个库的各个内部组件。只有非常高级的使用场合才需要实现用户提供 的可插卸组件:这在<a href="extension.html">
+扩展</a>章节里有提到。
 </p>

+
+
+
 <hr>

<div class="prev_link"><a href="../index.html"><img src="../prev.gif" alt="index" border="0"><br>
+
+
+
 Index
 </a></div>
+
+
+
<div class="up_link"><a href="../index.html"><img src="../up.gif" alt="index" border="0"><br>
+
+
+
 Index
 </a></div>
+
+
+
<div class="next_link"><a href="basics.html"><img src="../next.gif" alt="basics" border="0"><br>
+
+
+
 Basics
-</a></div><br clear="all" style="clear: all;">
+</a></div>
+
+
+<br style="" clear="all">
+
+
+

 <br>

+
+
+
 <p>Revised August 13th 2008</p>

+
+
+
 <p>&copy; Copyright 2006-2008 Joaqu&iacute;n M L&oacute;pez Mu&ntilde;oz.
 Distributed under the Boost Software
License, Version 1.0. (See accompanying file <a href="../../../../LICENSE_1_0.txt"> LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt";>
 http://www.boost.org/LICENSE_1_0.txt</a>)
 </p>
+
+
+

 </body>
 </html>

Other related posts:

  • » [boost-doc-zh commit] r218 - trunk/libs/flyweight/doc/tutorial - codesite-noreply