Boost logo

Boost :

From: James Fowler (boost_list_at_[hidden])
Date: 2005-03-09 16:33:30


ION_G_M wrote:

>... In boost vault you will fine a new folder (Shmem) with 3 new files:
>
>
thanks!

> Write now I am writing documentation with a text editor and it's just
>a pain. For this version, I've discovered the CDATA usage so I don't
>have to manually escape XML characters (<, >, &). I will have a look at
>Quickbook.
>
QuickBook takes care of all that. Ironically, the only time this has
been a problem for me is this morning when I _didn't_ want to escape
things for me, because I was adding "Ion Gazta&ntilde;aga" to certain
parts of my docs :) There's a way to 'escape' QuickBook's normal
processing and insert raw XML, but it's a little awkward for just one
small piece of a phrase.

> Is there any way to "insert" a cpp file directly on the code
>using BoostBook/QuickBook? That would help me a lot to mantain example
>code without errors.
>
>
There is an experimental version floating around which supports this. I
recently added support for "include" semantics, and Thomas Guest has
done some cool stuff with dynamic filtering to make source code look
really spiff (color highlighting based on C++ syntax). Using this in a
quickbook document be as simple as

    [section:qg_memory_pool I want to use shared memory as a memory pool]

    You are the biggest fan of malloc/free and you hate passing long
    messages to other processes ... You just need to type in one process:

    [include ../example/creat_pool.cpp]

    In receiver process one just could write the following lines:

    [include ../example/use_pool.cpp]

    [endsect]

I've attached a larger sample based on your "Quick Guide" (which might
be out of date...). Take a look, and if your interested check out the
Boost Documentation list at
https://lists.sourceforge.net/lists/listinfo/boost-docs. There's quite
a bit happening with QuickBook.

> I've also seen in unordered associative containers documentation that
>colored code is used and I'm very interested in that, but I don't know
>if that is provided by BoostBook or was created with an external tool.
>
>
QuickBook handles that automatically. With the new dynamic
highlighting, you can even extend it to support totally custom
source-code formats (C++, Python, and QuickBook support is built in).

- james

-- 
__________________________________________________________
 James Fowler, Open Sea Consulting
 http://www.OpenSeaConsulting.com, Marietta, Georgia, USA
 Do C++ Right.  http://www.OpenCpp.org, opening soon!

[section:quick_guide Quick Guide for the Impatient]

You don not want to read all this boring documentation. You just want to
do some fast programming. So this is the section for you:

[section:qg_memory_pool I want to use shared memory as a memory pool]

You are the biggest fan of malloc/free and you hate passing long
messages to other processes (fragment message, send, and rebuild
message). You just want to copy your long message to memory, you don not
want to remember if that shared memory portion was used or not, send
memory offset to another process, and continue doing that with other
processes. You just need to type in one process:

[include ../example/creat_pool.cpp]

In receiver process one just could write the following lines:

[include ../example/use_pool.cpp]

[endsect]

[section:qg_named_shmem I want to create named shared memory objects]

You want to create a shared memory objects, giving a name to them so
that any other process can look for that object, use it and delete it
from segment when the object is not needed anymore. Just write this code
in one process:

[include ../example/create_named.cpp]

In other process, while the first process is alive, execute the following:

[include ../example/use_named.cpp]

[endsect]

[section:qg_named_shmem_algo I want to create named shared memory objects with my own shared memory allocation algorithm]

Creating a new memory allocator algorithm to use it in Boost Shmem
framework is very easy. Read "Writing a new shared memory allocation
algorithm" to write your own algorithm. After that, you only need to
change a single line in the previous example:
      
   named_object_manager segment;

becomes:

   basic_named_object_manager<char, MyAlgorithm> segment;

[endsect]

[endsect]


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk