[boost-doc-zh] r365 committed - 翻译至Quick Guide

  • From: boost-doc-zh@xxxxxxxxxxxxxx
  • To: boost-doc-zh-notify@xxxxxxxxxxxxx
  • Date: Wed, 13 Jan 2010 14:20:04 +0000

Revision: 365
Author: yongjun.mao
Date: Wed Jan 13 06:17:39 2010
Log: 翻译至Quick Guide
http://code.google.com/p/boost-doc-zh/source/detail?r=365

Modified:
 /trunk/libs/interprocess/doc/interprocess.qbk

=======================================
--- /trunk/libs/interprocess/doc/interprocess.qbk       Mon Dec 28 23:05:14 2009
+++ /trunk/libs/interprocess/doc/interprocess.qbk       Wed Jan 13 06:17:39 2010
@@ -19,59 +19,44 @@
     ]
 ]

-[section:intro Introduction]
-
-[*Boost.Interprocess] simplifies the use of common interprocess communication
-and synchronization mechanisms and offers a wide range of them:
-
-* Shared memory.
-* Memory-mapped files.
-* Semaphores, mutexes, condition variables and upgradable mutex types to place
-  them in shared memory and memory mapped files.
-* Named versions of those synchronization objects, similar to UNIX/Windows
-  sem_open/CreateSemaphore API.
-* File locking.
-* Relative pointers.
-* Message queues.
-
-[*Boost.Interprocess] also offers higher-level interprocess mechanisms to allocate -dynamically portions of a shared memory or a memory mapped file (in general, -to allocate portions of a fixed size memory segment). Using these mechanisms, -[*Boost.Interprocess] offers useful tools to construct C++ objects, including
-STL-like containers, in shared memory and memory mapped files:
-
-* Dynamic creation of anonymous and named objects in a shared memory or memory
-  mapped file.
-* STL-like containers compatible with shared memory/memory-mapped files.
-* STL-like allocators ready for shared memory/memory-mapped files implementing
-  several memory allocation patterns (like pooling).
-
-[section:introduction_building_interprocess Building Boost.Interprocess]
-
-There is no need to compile [*Boost.Interprocess], since it's
-a header only library. Just include your Boost header directory in your
-compiler include path.
-
-[*Boost.Interprocess] depends on
-[@http://www.boost.org/libs/date_time/ [*Boost.DateTime]], which needs
-separate compilation. However, the subset used by [*Boost.Interprocess] does -not need any separate compilation so the user can define `BOOST_DATE_TIME_NO_LIB`
-to avoid Boost from trying to automatically link the [*Boost.DateTime].
-
-In POSIX systems, [*Boost.Interprocess] uses pthread system calls to implement -classes like mutexes, condition variables, etc... In some operating systems, -these POSIX calls are implemented in separate libraries that are not automatically -linked by the compiler. For example, in some Linux systems POSIX pthread functions
-are implemented in `librt.a` library, so you might need to add that library
-when linking an executable or shared library that uses [*Boost.Interprocess]. -If you obtain linking errors related to those pthread functions, please revise
-your system's documentation to know which library implements them.
+[section:intro µ¼ÑÔ]
+
+[*Boost.Interprocess]¼ò»¯Á˽ø³Ì¼äͨÐźÍͬ²½»úÖƵÄÓ¦Ó㬲¢ÌṩÁ˶ÔÕâЩ»úÖƵĹ㷺֧³Ö£º
+
+* ¹²ÏíÄÚ´æ
+* ÄÚ´æÓ³ÉäÎļþ
+* ¿ÉÓÃÓÚ¹²ÏíÄÚ´æºÍÄÚ´æÓ³ÉäÎļþµÄÐźŵơ¢»¥³â¶ÔÏó¡¢Ìõ¼þ±äÁ¿¼°¿ÉÉý¼¶µÄ»¥³âÀàÐÍ +* ÉÏÊöͬ²½¶ÔÏóµÄÃüÃû°æ±¾£¬ÀàËÆÓÚUNIX/WindowsϵÄsem_open/CreateSemaphore API
+* ÎļþËø¶¨
+* Ïà¶ÔÖ¸Õë
+* ÏûÏ¢¶ÓÁÐ
+
+[*Boost.Interprocess]»¹Óиü¸ß¼¶µÄ»úÖÆÓÃÓÚ´Ó¹²ÏíÄÚ´æ»òÄÚ´æÓ³ÉäÎļþÖж¯Ì¬·ÖÅ䣨һ°ã´Ó¹Ì¶¨´óСµÄÄÚ´æ¶ÎÖзÖÅ䣩¡£ÀûÓÃÕâЩ»úÖÆ£¬
+[*Boost.Interprocess]ÌṩÁËÓÐÓõŤ¾ßÀ´ÔÚ¹²ÏíÄÚ´æºÍÄÚ´æÓ³ÉäÎļþÖй¹ÔìÀàËÆÀàSTLµÄÈÝÆ÷µÄC++¶ÔÏó£º
+
+* ÔÚ¹²ÏíÄÚ´æ»òÄÚ´æÓ³ÉäÎļþÖж¯Ì¬´´½¨ÄäÃûºÍÃüÁî¶ÔÏó¡£
+* Óë¹²ÏíÄÚ´æ/ÄÚ´æÓ³ÉäÎļþ¼æÈݵÄÀàSTLÈÝÆ÷¡£
+* Ö§³Ö¹²ÏíÄÚ´æ/ÄÚ´æÓ³ÉäÎļþµÄÀàSTL·ÖÅäÆ÷£¬¿ÉʵÏÖ¶àÖÖÄÚ´æ·ÖÅäģʽ£¨ÈçÄÚ´æ³Ø£©¡£
+
+[section:introduction_building_interprocess ½¨Á¢ Boost.Interprocess]
+
+[*Boost.Interprocess]ÊÇÒ»¸öHeader OnlyµÄ¿â£¬²»ÐèÒª±àÒëËü¡£Ö»ÒªÔÚÄãµÄ±àÒëÆ÷°üº¬Â·¾¶Àï¼ÓÈëBoostÍ·ÎļþĿ¼¾Í¿ÉÒÔÁË¡£
+
+[*Boost.Interprocess]ÒÀÀµ
+[@http://www.boost.org/libs/date_time/ [*Boost.DateTime]]£¬¶øËüÒªµ¥¶À±àÒë¡£²»¹ÜÔõÑù£¬
+ֻʹÓÃ[*Boost.Interprocess]×Ó¼¯²»ÐèÒªÈκÎÐÎʽµÄµ¥¶À±àÒ룬Óû§¿ÉÒÔ¶¨Òå`BOOST_DATE_TIME_NO_LIB`
+ÒÔ±ÜÃâBoost×Ô¶¯Á´½Ó[*Boost.DateTime]¡£
+
+ÔÚPOSIXϵͳÖУ¬[*Boost.Interprocess]ʹÓÃpthreadϵͳµ÷ÓÃÀ´ÊµÏÖ»¥³â¶ÔÏó¡¢Ìõ¼þ±äÁ¿µÈÀà¡£
+ÔÚһЩ²Ù×÷ϵͳÖУ¬ÕâЩPOSIXµ÷ÓÃ×÷Ϊµ¥¶ÀµÄ¿â£¬²»»á±»±àÒëÆ÷×Ô¶¯Á´½Ó¡£
+ÀýÈ磬һЩLinuxϵͳµÄPOSIX pthreadº¯Êý·ÅÔÚ`librt.a`¿âÀËùÒÔÁ´½ÓʹÓÃ[*Boost.Interprocess]µÄ¿ÉÖ´ÐÐÎļþ»ò¹²Ïí¿âʱ¿ÉÄÜÒª¼ÓÉÏÕâЩ¿â¡£
+Èç¹ûÄãµÃµ½¹ØÓÚÕâЩpthreadº¯ÊýµÄÁ´½Ó´íÎó£¬Çë²Î¿¼ÄãµÄϵͳÎĵµ£¬ÒÔÁ˽âËüÃǵĿâʵÏÖ¡£

 [endsect]

-[section:tested_compilers Tested compilers]
-
-[*Boost.Interprocess] has been tested in the following compilers/platforms:
+[section:tested_compilers ²âÊԵıàÒëÆ÷]
+
+[*Boost.Interprocess]ÒѾ­ÔÚÏÂÃæµÄ±àÒëÆ÷/ƽ̨ÖнøÐÐÁ˲âÊÔ£º

 *  Visual 7.1 Windows XP
 *  Visual 8.0 Windows XP
@@ -86,86 +71,61 @@

 [endsect]

-[section:quick_guide Quick Guide for the Impatient]
-
-[section:qg_memory_pool Using shared memory as a pool of unnamed memory blocks]
-
-You can just allocate a portion of a shared memory segment, copy the
-message to that buffer, send the offset of that portion of shared
-memory to another process, and you are done. Let's see the example:
+[section:quick_guide ¿ìËÙÏòµ¼]
+
+[section:qg_memory_pool Óù²ÏíÄÚ´æ×÷ΪÄäÃûÄÚ´æ³Ø]
+
+Ö»Òª·ÖÅä¹²ÏíÄÚ´æ¶ÎµÄÒ»²¿·Ö×÷Ϊ»º´æÇø£¬°ÑÐÅÏ¢¸´ÖƽøÈ¥£¬ÔÙ°Ñ»º´æÇøÔÚ¹²ÏíÄÚ´æÖеÄÆ«ÒÆÖµ·¢Ë͸øÁíÍâµÄ½ø³Ì£¬ÈÎÎñ¾ÍÍê³ÉÀ²£¡ÈÃÎÒÃÇ¿´Ò»¸öÀý×Ó£º

 [import ../example/doc_ipc_message.cpp]
 [doc_ipc_message]

 [endsect]

-[section:qg_named_interprocess Creating named shared memory objects]
-
-You want to create objects in a shared memory segment, giving a string name to them so that -any other process can find, use and delete them from the segment when the objects are not
-needed anymore. Example:
+[section:qg_named_interprocess ½¨Á¢ÃüÃû¹²ÏíÄÚ´æ¶ÔÏó]
+
+Äã¿ÉÒÔÔÚ¹²ÏíÄÚ´æ¶ÎÖн¨Á¢¶ÔÏ󣬸³ÓÚÕâ¸ö¶ÔÏóÒ»¸ö×Ö·û´®Ãû³Æ£¬ÕâÑùÆäËü½ø³Ì¾Í¿ÉÒÔÕÒµ½¡¢Ê¹ÓÃËüÃÇ£¬ÒÔ¼°µ±²»ÔÙÐèҪʱɾ³ýËüÃÇ¡£Àý£º

 [import ../example/doc_named_alloc.cpp]
 [doc_named_alloc]

 [endsect]

-[section:qg_offset_ptr Using an offset smart pointer for shared memory]
-
-[*Boost.Interprocess] offers offset_ptr smart pointer family
-as an offset pointer that stores the distance between the address of
-the offset pointer itself and the address of the pointed object.
-When offset_ptr is placed in a shared memory segment, it
-can point safely objects stored in the same shared
-memory segment, even if the segment is mapped in
-different base addresses in different processes.
-
-This allows placing objects with pointer members
-in shared memory. For example, if we want to create
-a linked list in shared memory:
+[section:qg_offset_ptr ʹÓÃÆ«ÒÆÖÇÄÜÖ¸Õ루offset smart pointer£©]
+
+[*Boost.Interprocess] Ìṩoffset_ptrÖÇÄÜÖ¸Õë×壬Ëü±£´æµÄÊÇ×ÔÉíµØÖ·µ½ËùÖ¸¶ÔÏóµØÖ·µÄ¾àÀë¡£
+µ±offset_ptrλÓÚ¹²ÏíÄÚ´æ¶Îʱ£¬Ëü¿ÉÒÔ°²È«µØÖ¸Ïò±£´æÓÚͬһ¹²ÏíÄÚ´æ¶ÎµÄ¶ÔÏ󣬼´Ê¹Õâ¸ö¹²ÏíÄÚ´æ¶ÎÔÚ²»Í¬µÄ½ø³ÌÖÐÓ³ÉäµÄ»ùÖ·²»Í¬¡£
+
+ËüÔÊÐíÔÚ¹²ÏíÄÚ´æÖÐ×÷ΪָÕë³ÉÔ±´æ·Å¶ÔÏó¡£ÀýÈ磬ÎÒÃÇÏëÔÚ¹²ÏíÄÚ´æÖн¨Á¢Ò»¸öÁ´±í£º

 [import ../example/doc_offset_ptr.cpp]
 [doc_offset_ptr]

-To help with basic data structures, [*Boost.Interprocess] offers containers like vector, -list, map, so you can avoid these manual data structures just like with standard containers.
-
+ΪÁË°ïÖúʹÓûù±¾Êý¾Ý½á¹¹£¬[*Boost.Interprocess] ÌṩÁËÏñvector¡¢list¡¢mapµÄÈÝÆ÷£¬ËùÒÔÄã²»ÓÃ×Ô¼ºÊµÏÖÕâЩÊý¾Ý½á¹¹£¬Ö»ÒªÏó±ê×¼ÈÝÆ÷Ò»ÑùÓþÍÐС£
 [endsect]

-[section:qg_interprocess_container Creating vectors in shared memory]
-
-[*Boost.Interprocess] allows creating complex objects in shared memory and memory -mapped files. For example, we can construct STL-like containers in shared memory. -To do this, we just need to create a special (managed) shared memory segment, -declare a [*Boost.Interprocess] allocator and construct the vector in shared memory
-just if it was any other object.
-
-The class that allows this complex structures in shared memory is called
-[classref boost::interprocess::managed_shared_memory] and it's easy to use.
-Just execute this example without arguments:
+[section:qg_interprocess_container ÔÚ¹²ÏíÄÚ´æÖн¨Á¢vector]
+
+[*Boost.Interprocess] ÔÊÐíÔÚ¹²ÏíÄÚ´æºÍÄÚ´æÓ³ÉäÎļþÖн¨Á¢¸´ÔÓ¶ÔÏó¡£ÀýÈ磬ÎÒÃÇ¿ÉÒÔÔÚ¹²ÏíÄÚ´æÖй¹ÔìÀàSTLµÄÈÝÆ÷¡£ +ʵÏÖËüÎÒÃÇÖ»ÐèÒª½¨Á¢Ò»¸öÌض¨µÄ£¨ÊÜ¿ØµÄ managed£©¹²ÏíÄÚ´æ¶Î£¬ÉùÃ÷Ò»¸ö[*Boost.Interprocess] ·ÖÅäÆ÷£¬²¢ÇÒÈçͬÆäËü¶ÔÏóÒ»ÑùÔÚ¹²ÏíÄÚ´æÖй¹Ôìvector¡£
+
+ÔÊÐíÔÚ¹²ÏíÄÚ´æÖÐÓ¦Óø´ÔӽṹµÄÀà³ÆΪ[classref boost::interprocess::managed_shared_memory]£¬ËüºÜÈÝÒ×ʹÓᣲ»´ø²ÎÊýµØÔËÐÐÏÂÃæµÄÀý×Ó£º

 [import ../example/doc_spawn_vector.cpp]
 [doc_spawn_vector]

-The parent process will create an special shared memory class that allows easy construction -of many complex data structures associated with a name. The parent process executes the same -program with an additional argument so the child process opens the shared memory and uses
-the vector and erases it.
+¸¸½ø³Ì½¨Á¢Ò»¸öÌØÊâ¹²ÏíÄÚ´æÀ࣬ÔÊÐí¼òµ¥µØ¹¹Ôì¶à¸öÓëÃû³Æ¹ØÁªµÄ¸´Ôӽṹ¡£Ö®ºó¸¸½ø³Ì´ø²ÎÊýµØÆô¶¯Í¬Ò»³ÌÐò£¬×Ó½ø³Ì´ò¿ª¹²ÏíÄڴ沢ʹÓÃvectorºÍɾ³ýËü¡£

 [endsect]

-[section:qg_interprocess_map Creating maps in shared memory]
-
-Just like a vector, [*Boost.Interprocess] allows creating maps in
-shared memory and memory mapped files. The only difference is that
-like standard associative containers, [*Boost.Interprocess]'s map needs
-also the comparison functor when an allocator is passed in the constructor:
+[section:qg_interprocess_map ÔÚ¹²ÏíÄÚ´æÖн¨Á¢map]
+
+¾ÍÏóvectorÒ»Ñù£¬[*Boost.Interprocess] ¿ÉÒÔÔÚ¹²ÏíÄÚ´æºÍÄÚ´æÓ³ÉäÎļþÖн¨Á¢map¡£Î¨Ò»µÄÇø±ðÊÇ£¬ºÍ±ê×¼¹ØÁªÈÝÆ÷Ò»Ñù£¬[*Boost.Interprocess]µÄmapÔÚ¹¹Ôì·½·¨Öд«Èë·ÖÅäÆ÷ʱҲÐèÒª±È½ÏËã×Ó£º

 [import ../example/doc_map.cpp]
 [doc_map]

-For a more advanced example including containers of containers, see the section -[link interprocess.allocators_containers.containers_explained.containers_of_containers Containers of containers]. +¸ü¶à¸ß¼¶Àý×Ó£¬°üÀ¨ÈÝÆ÷µÄÈÝÆ÷£¬Çë²Î¿¼[link interprocess.allocators_containers.containers_explained.containers_of_containers ÈÝÆ÷µÄÈÝÆ÷]Ò»½Ú¡£

 [endsect]

Other related posts:

  • » [boost-doc-zh] r365 committed - 翻译至Quick Guide - boost-doc-zh