Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r84938 - trunk/libs/circular_buffer/doc
From: pbristow_at_[hidden]
Date: 2013-07-02 03:44:39


Author: pbristow
Date: 2013-07-02 03:44:38 EDT (Tue, 02 Jul 2013)
New Revision: 84938
URL: http://svn.boost.org/trac/boost/changeset/84938

Log:
Quickbook version of docs.

Added:
   trunk/libs/circular_buffer/doc/circular_buffer.idx (contents, props changed)
   trunk/libs/circular_buffer/doc/circular_buffer.qbk (contents, props changed)
   trunk/libs/circular_buffer/doc/jamfile.v2 (contents, props changed)

Added: trunk/libs/circular_buffer/doc/circular_buffer.idx
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/libs/circular_buffer/doc/circular_buffer.idx 2013-07-02 03:44:38 EDT (Tue, 02 Jul 2013) (r84938)
@@ -0,0 +1,22 @@
+# circular_buffer.idx index script file
+# for Boost.circular_buffer Quickbook Doxygen documentation Auto-indexing forcircular_buffer library.
+
+# Copyright (c) 2011 Paul A. Bristow
+# Copyright (c) 2003 - 2008 Jan Gaspar
+
+# boost-no-inspect
+
+# Use, modification and distribution is subject to the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt
+# or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+# All header files, recursing down to include sub-folders.
+!scan-path "boost/circular_buffer" ".*\.hpp" true
+
+# All example source files, assuming no sub-folders.
+!scan-path "libs/circular_buffer/example" ".*\.cpp"
+
+
+
+
+

Added: trunk/libs/circular_buffer/doc/circular_buffer.qbk
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/libs/circular_buffer/doc/circular_buffer.qbk 2013-07-02 03:44:38 EDT (Tue, 02 Jul 2013) (r84938)
@@ -0,0 +1,575 @@
+[article Circular Buffer
+ [quickbook 1.6]
+ [id circular_buffer]
+ [copyright 2003-2013 Jan Gaspar]
+ [license
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ [@http://www.boost.org/LICENSE_1_0.txt])
+ ]
+ [authors [Gaspar, Jan]]
+ [source-mode c++]
+]
+
+[/ Links - by (most common) convention, prefixed with double underscore so not confused with other names.]
+[def __alert [$./images/alert.png]] [/ Examples of your own images (in doc/html/images/ .]
+[def __tip [$./images/tip.png]]
+[/ If you provide a file type like .png, you will probably find that the file is missing in the pdf version.]
+[/ This is because the default file type specified is .png in html, but .svg for pdf version.]
+
+[/ Some links to external sources.]
+[/ You often want to link more than once, so using a def ensures you always refer to the same location.]
+[def __boost [@http://www.boost.org/ Boost]] [/Boost.org]
+[def __boostroot [@boost: Boost root]] [/ Your boost root]
+[/Note the custom boost root url schema for linking to files within the Boost distribution.]
+[/Note It can't be used for images, nor for pdf, so not so useful.]
+[/def __boostlicense [@http://www.boost.org/LICENSE_1_0.txt Boost License]]
+[/ Or refer to your most recent version of Boost.]
+[def __boostlicense [@boost:/LICENSE_1_0.txt Boost License]]
+[def __boostbook [@http://www.boost.org/doc/html/boostbook.html BoostBook]]
+[def __boostbook_docs [@http://www.boost.org/doc/libs/1_53_0/doc/html/boostbook.html BoostBook documentation]]
+[def __quickbook [@http://www.boost.org/doc/tools/quickbook/index.html Quickbook]]
+[def __quickbook_syntax [@http://www.boost.org/doc/libs/1_53_0/doc/html/quickbook/ref.html Quickbook Syntax Compendium]]
+[def __docbook [@http://www.docbook.org/ DocBook]]
+[def __doxygen [@http://www.doxygen.org/ Doxygen]]
+[def __autoindex [@boost:/tools/auto_index/doc/html/index.html AutoIndex]]
+[def __pdf [@http://www.adobe.com/products/acrobat/adobepdf.html PDF]]
+[def __textpad [@http://www.textpad.com Textpad]]
+[def __emacs [@http://www.gnu.org/software/emacs/ GNU emacs]]
+[def __css [@http://en.wikipedia.org/wiki/Cascading_Style_Sheets Cascading Style Sheet]]
+[def __intro [link circular_buffer.intro Introduction]] [/Link to a Quickbook section (see below).]
+
+[def __docbook_params [@http://docbook.sourceforge.net/release/xsl/current/doc/ Docbook xsl:param format options]]
+
+[def __cb [classref boost::circular_buffer circular_buffer]]
+[def __cbso [classref boost::circular_buffer_space_optimized circular_buffer_space_optimized]]
+[def __min_capacity [memberref boost::circular_buffer_space_optimized::min_capacity() min_capacity]]
+[def __capacity_control [memberref boost::circular_buffer_space_optimized::capacity_control () capacity_control ]]
+
+
+[def __debug_support [link circular_buffer.implmentation.debug_support debug support]]
+
+[include ../../../boost-trunk/tools/auto_index/include/auto_index_helpers.qbk]
+[/ Must be first included file!]
+
+[note A printer-friendly PDF version of this manual is also available.]
+
+[section:intro Introduction]
+
+A Circular Buffer.
+
+[h2 Description]
+
+The term [@http://en.wikipedia.org/wiki/Circular_buffer circular buffer]
+(also called a ['ring] or ['cyclic buffer])
+refers to an area in memory which is used to store incoming data.
+When the buffer is filled,
+new data is written starting at the beginning of the buffer and overwriting the old.
+
+[classref boost::circular_buffer] is a STL compliant container.
+
+It is a kind of sequence similar to [@http://www.sgi.com/tech/stl/List.html std::list]
+or [@http://www.sgi.com/tech/stl/Deque.html std::deque].
+It supports random access iterators, constant time insert and erase operations
+at the beginning or the end of the buffer and interoperability with std algorithms.
+
+The __cb is especially designed to provide [*fixed capacity] storage.
+When its capacity is exhausted, newly inserted elements will cause elements
+to be overwritten, either at the beginning or end of the buffer
+(depending on what insert operation is used).
+
+The __cb only allocates memory when created,
+when the capacity is adjusted explicitly,
+or as necessary to accommodate resizing or assign operations.
+
+[$images/circular_buffer.png]
+
+There is also a __cbso version available.
+
+[$images/space_optimized.png]
+
+__cbso is an adaptation of the __cb
+which [*does not allocate memory all at once when created],
+instead it allocates memory as needed.
+
+The predictive memory allocation is similar to typical `std::vector` implementation.
+Memory is automatically freed as the size of the container decreases.
+
+The memory allocation process of the space-optimized circular buffer.
+The __min_capacity of the capacity controller represents
+the minimal guaranteed amount of allocated memory.
+The allocated memory will never drop under this value.
+The default value of the `min_capacity` is set to 0.
+The `min_capacity` can be set using the constructor parameter __capacity_control
+or the function `set_capacity`.
+
+The space-optimized version is, of course, a little slower.
+
+[endsect] [/section:intro Introduction]
+
+[section:example Circular_buffer example]
+
+Here is a simple example to introduce the class __cb.
+
+[import ../example/circular_buffer_example.cpp]
+
+[circular_buffer_example_1]
+
+This example shows contruction, inserting elements, overwriting and popping.
+
+[circular_buffer_example_2]
+
+[/circular_buffer_example_output - there is no output for this example]
+
+You can see the full example code at [@../../example/circular_buffer_example.cpp circular_buffer_example.cpp].
+
+The full annotated description is in the C++ Reference section.
+
+[endsect] [/section:example circular_buffer example]
+
+[section:rationale Rationale]
+
+The basic motivation behind the __cb was to create a container which would [*work seamlessly with STL].
+
+Additionally, the design of the __cb was guided by the following principles:
+
+* Maximum ['efficiency] for envisaged applications.
+* Suitable for ['general purpose use].
+* The behaviour of the buffer as ['intuitive] as possible.
+* Suitable for ['specialization] by means of adaptors. (The __cbso is such an example of the adaptor.)
+* Easy to ['debug]. (See Debug Support for details.)
+
+In order to achieve maximum efficiency, the __cb and __cbso store their elements in a
+[*contiguous region of memory], which then enables:
+
+* Use of fixed memory and no implicit or unexpected memory allocation.
+* Fast constant-time insertion and removal of elements from the front and back.
+* Fast constant-time random access of elements.
+* Suitability for real-time and performance critical applications.
+
+Possible applications of the circular buffer include:
+
+* Storage of the ['most recently received samples], overwriting the oldest as new samples arrive.
+* As an underlying container for a ['bounded buffer]
+(see the Bounded Buffer example, code at [@../../example/circular_buffer_bound_example.cpp circular_buffer_bound_example.cpp]).
+* A kind of ['cache] storing a specified number of last inserted elements.
+* Efficient fixed capacity ['FIFO (First In, First Out)],
+* Efficient fixed capacity ['LIFO (Last In, First Out)] queue which removes the oldest (inserted as first) elements when full.
+
+[endsect] [/section:rationale Rationale]
+
+[section:implementation Implementation ]
+
+The following paragraphs describe issues that had to be considered during the implementation of the circular_buffer:
+
+[h3 Thread-Safety]
+
+The thread-safety of the __cb is the same as the thread-safety of containers in most STL implementations.
+This means the __cb is not fully thread-safe.
+The thread-safety is guaranteed only in the sense that simultaneous accesses
+to distinct instances of the __cb are safe,
+and simultaneous read accesses to a shared __cb are safe.
+
+If multiple threads access a single __cb,
+and at least one of the threads may potentially write,
+then the user is responsible for ensuring mutual exclusion between the threads during the container accesses.
+The mutual exclusion between the threads can be achieved by wrapping
+operations of the underlying __cb with a lock acquisition and release.
+(See the Bounded Buffer example code at [@../../example/circular_buffer_bound_example.cpp circular_buffer_bound_example.cpp])
+
+[h3 Overwrite Operation]
+
+Overwrite operation occurs when an element is inserted into a full __cb -
+the old element is being overwritten by the new one.
+There was a discussion what exactly "overwriting of an element" means during the formal review.
+It may be either a destruction of the original element and
+a consequent inplace construction of a new element
+or it may be an assignment of a new element into an old one.
+The __cb implements assignment because it is more effective.
+
+From the point of business logic of a stored element,
+the destruction/construction operation and assignment usually mean the same.
+However, in very rare cases (if in any) they may differ.
+If there is a requirement for elements to be destructed/constructed instead of being assigned,
+consider implementing a wrapper of the element which would implement the assign operator,
+and store the wrappers instead.
+It is necessary to note that storing such wrappers has a drawback.
+The destruction/construction will be invoked on every assignment of the wrapper -
+not only when a wrapper is being overwritten (when the buffer is full)
+but also when the stored wrappers are being shifted
+(e.g. as a result of insertion into the middle of container).
+
+[h3 Writing to a Full Buffer]
+
+There are several options how to cope if a data source produces more data than can fit in the fixed-sized buffer:
+
+* Inform the data source to wait until there is room in the buffer (e.g. by throwing an overflow exception).
+* If the oldest data is the most important, ignore new data from the source until there is room in the buffer again.
+* If the latest data is the most important, write over the oldest data.
+* Let the producer to be responsible for checking the size of the buffer prior writing into it.
+
+It is apparent that the __cb implements the third option.
+But it may be less apparent it does not implement any other option -
+especially the first two.
+One can get an impression that the __cb should implement first three options
+and offer a mechanism of choosing among them. This impression is wrong.
+
+The __cb was designed and optimized to be circular
+(which means overwriting the oldest data when full).
+If such a controlling mechanism had been enabled,
+it would just complicate the matters
+and the usage of the __cb would be probably less straightforward.
+
+Moreover, the first two options (and the fourth option as well)
+do not require the buffer to be circular at all.
+If there is a need for the first or second option, consider implementing an adaptor of e.g. std::vector.
+In this case the __cb is not suitable for adapting, because,
+contrary to std::vector, it bears an overhead for its circular behaviour.
+
+[h3 Reading/Removing from an Empty Buffer]
+
+When reading or removing an element from an empty buffer,
+the buffer should be able to notify the data consumer
+(e.g. by throwing underflow exception) that there are no elements stored in it.
+The __cb does not implement such a behaviour for two reasons:
+
+* It would introduce a performance overhead.
+* No other std container implements it this way.
+
+It is considered to be a bug to read or remove an element
+(e.g. by calling [memberref boost::circular_buffer::front() front()]
+or [memberref boost::circular_buffer::pop_back() pop_back()])
+from an empty std container and from an empty __cb as well.
+The data consumer has to test if the container is not empty before reading/removing from it by testing
+[memberref boost::circular_buffer::empty empty()].
+However, when reading from the __cb,
+there is an option to rely on the [memberref boost::circular_buffer::at() at()]
+method which throws an exception when the index is out of range.
+
+[h3 Iterator Invalidation]
+
+An iterator is usually considered to be invalidated if an element,
+the iterator pointed to, had been removed or overwritten by an another element.
+This definition is enforced by the Debug Support and is documented for every method.
+However, some applications utilizing __cb may require less strict definition:
+an iterator is invalid only if it points to an uninitialized memory.
+
+Consider following example:
+
+[import ../example/circular_buffer_iter_example.cpp]
+
+[circular_buffer_iter_example_1]
+
+The iterator does not point to the original element any more
+(and is considered to be invalid from the "strict" point of view)
+but it still points to the same valid place in the memory.
+This "soft" definition of iterator invalidation is supported by the __cb
+but should be considered as an implementation detail rather than a full-fledged feature.
+The rules when the iterator is still valid can be inferred from the code in
+[@../../test/soft_iterator_invalidation.cpp soft_iterator_invalidation.cpp].
+
+[h3 Caveats]
+
+The __cb should not be used for storing pointers to dynamically allocated objects.
+When a circular buffer becomes full, further insertion will overwrite the stored pointers
+- resulting in a [*memory leak]. One recommend alternative is the use of smart pointers, for example
+[@http://www.boost.org/doc/libs/1_53_0/libs/smart_ptr/smart_ptr.htm Boost Smart pointers].
+
+[@http://en.wikipedia.org/wiki/Std::auto_ptr std::auto_ptr]
+
+[caution Any container of `std::auto_ptr` is considered particularly hazardous.]
+
+[tip Never create a circular buffer of `std::auto_ptr`.
+Refer to Scott Meyers' excellent book Effective STL for a detailed discussion.
+(Meyers S., Effective STL: 50 Specific Ways to Improve Your Use of the Standard Template Library.
+Addison-Wesley, 2001.)
+]
+
+While internals of a __cb are circular, [*iterators are not].
+Iterators of a __cb are only valid for the range `\[begin(), end()\]`,
+so for example: iterators `(begin() - 1)` and `(end() + 1)` are both invalid.
+
+[h3 Debug Support]
+
+In order to help a programmer to avoid and find common bugs,
+the __cb contains a kind of debug support.
+
+The __cb maintains a list of valid iterators.
+As soon as any element gets destroyed all iterators pointing to this element
+are removed from this list and explicitly invalidated (an invalidation flag is set).
+The debug support also consists of many assertions (`BOOST_ASSERT` macros)
+which ensure the __cb and its iterators are used in the correct manner at runtime.
+In case an invalid iterator is used, the assertion will report an error.
+The connection of explicit iterator invalidation and assertions
+makes a very robust debug technique which catches most of the errors.
+
+Moreover, the uninitialized memory allocated by __cb is filled with the value `0xcc` in the debug mode.
+When debugging the code, this can help the programmer to recognize the initialized memory from the uninitialized.
+For details refer the source code [@../../../../boost/circular_buffer/debug.hpp circular_buffer/debug.hpp].
+
+The debug support is enabled only in the debug mode (when the `NDEBUG` is not defined).
+It can also be explicitly disabled (only for __cb)
+by defining macro BOOST_CB_DISABLE_DEBUG.
+
+[h3 Compatibility with Interprocess library]
+
+The __cb is compatible with the [@boost:libs/interprocess/index.html Boost.Interprocess]
+[/ This should be in @boost:libs/interprocess/doc/index.html ]
+library used for interprocess communication.
+Considering that the circular_buffer's debug support relies on 'raw' pointers
+(which is not permited by the Interprocess library)
+the code has to compiled with `-DBOOST_CB_DISABLE_DEBUG` or `-DNDEBUG` (which disables the Debug Support).
+Not doing that will cause the compilation to fail.
+
+[endsect] [/section:implementation Implementation ]
+
+[section:examples More Examples]
+
+[h3 Summing all the values in a circular buffer]
+
+[import ../example/circular_buffer_sum_example.cpp]
+
+[circular_buffer_sum_example_1]
+
+[/circular_buffer_example_output - there is no output for this example]
+
+The __cb has a capacity of three `int`.
+Therefore, the size of the buffer will never exceed three.
+The `std::accumulate` algorithm evaluates the sum of the stored elements.
+The semantics of the __cb can be inferred from the assertions.
+
+You can see the full example code at [@../../example/circular_buffer_sum_example.cpp circular_buffer_sum_example.cpp].
+
+[h3 Bounded Buffer Example]
+
+The bounded buffer is normally used in a producer-consumer mode:
+producer threads produce items and store them in the container
+and consumer threads remove these items and process them.
+The bounded buffer has to guarantee that
+
+* producers do not insert items into the container when the container is full,
+* consumers do not try to remove items when the container is empty,
+* each produced item is consumed by exactly one consumer.
+
+[import ../example/circular_buffer_bound_example.cpp]
+
+[circular_buffer_bound_example_1]
+
+[/ there is no output for this example]
+
+The bounded_buffer relies on [@boost:/doc/html/thread.html Boost.Thread]
+and [@boost:libs/bind/index.html Boost.Bind] libraries
+and [@boost:libs/utility/call_traits.htm Boost.call_traits utility].
+
+The [memberref boost::circular_buffer::push_front() push_front()]
+method is called by the producer thread in order to insert a new item into the buffer.
+The method locks the mutex and waits until there is a space for the new item.
+(The mutex is unlocked during the waiting stage and has to be regained when the condition is met.)
+If there is a space in the buffer available,
+the execution continues and the method inserts the item at the end of the __cb.
+Then it increments the number of unread items and unlocks the mutex
+(in case an exception is thrown before the mutex is unlocked,
+the mutex is unlocked automatically by the destructor of the scoped_lock).
+At last the method notifies one of the consumer threads
+waiting for a new item to be inserted into the buffer.
+
+The [memberref boost::circular_buffer::pop_back() pop_back()]
+method is called by the consumer thread in order to read the next item from the buffer.
+ The method locks the mutex and waits until there is an unread item in the buffer.
+If there is at least one unread item,
+the method decrements the number of unread items and reads the next item from the __cb.
+Then it unlocks the mutex and notifies one of the producer threads
+waiting for the buffer to free a space for the next item.
+
+The `bounded buffer::pop_back()`
+method [*does not remove the item] but the item is left
+in the circular_buffer which then [*replaces it with a new one]
+(inserted by a producer) when the circular_buffer is full.
+This technique is more effective than removing the item
+explicitly by calling the [memberref boost::circular_buffer::pop_back() circular_buffer::pop_back()]
+method of the __cb.
+
+This claim is based on the assumption that an assignment (replacement)
+of a new item into an old one is more effective than a destruction
+(removal) of an old item and a consequent inplace construction (insertion) of a new item.
+
+For comparison of bounded buffers based on different containers compile and
+run [@../../test/bounded_buffer_comparison.cpp bounded_buffer_comparison.cpp].
+The test should reveal the bounded buffer based on the __cb is most effective
+closely followed by the `std::deque` based bounded buffer.
+(In reality, the result may differ sometimes because the test
+is always affected by external factors such as immediate CPU load.)
+
+[import ../test/bounded_buffer_comparison.cpp]
+
+You can see the full test code at [@../../test/bounded_buffer_comparison.cpp bounded_buffer_comparison.cpp],
+and an example of output is [bounded_buffer_comparison_output].
+
+[endsect] [/section:examples More examples]
+
+[section:headers Header Files]
+
+The circular buffer library is defined in the file [@../../../../boost/circular_buffer.hpp circular_buffer.hpp].
+
+ #include <boost/circular_buffer.hpp>
+
+(There is also a forward declaration for the __cb
+in the header file [@../../../../boost/circular_buffer_fwd.hpp circular_buffer_fwd.hpp]).
+
+The __cb is defined in the file [@../../../../boost/circular_buffer/base.hpp base.hpp].
+
+The __cbso is defined in the file [@../../../../boost/circular_buffer/space_optimized.hpp space_optimized.hpp].
+
+[endsect] [/section:headers Header Files]
+
+[section:concepts Modelled Concepts]
+
+[@http://www.sgi.com/tech/stl/RandomAccessContainer.html Random Access Container],
+[@http://www.sgi.com/tech/stl/FrontInsertionSequence.html Front Insertion Sequence], and
+[@http://www.sgi.com/tech/stl/BackInsertionSequence.html Back Insertion sequence]
+
+[endsect] [/section:concepts Modelled Concepts]
+
+[section:template_params Template Parameters]
+
+[table:templ Template parameter requirements
+[[parameter] [Requirements]]
+[[T] [The type of the elements stored in the circular_buffer.
+The T has to be [@boost:libs/utility/Assignable.html Assignable]
+and [@boost:libs/utility/CopyConstructible.html CopyConstructible].
+Moreover T has to be [@http://www.sgi.com/tech/stl/DefaultConstructible.html DefaultConstructible]
+if supplied as a default parameter when invoking some of the circular_buffer's methods,
+e.g. `insert(iterator pos, const value_type& item = value_type())`.
+And [@http://www.sgi.com/tech/stl/EqualityComparable.html EqualityComparable]
+and/or [@boost:libs/utility/LessThanComparable.html LessThanComparable]
+if the circular_buffer will be compared with another container.]]
+[[Alloc] [The allocator type used for all internal memory management.
+The Alloc has to meet the allocator requirements imposed by STL.]]
+]
+
+[endsect] [/section:template_params Template Parameters]
+
+[section:tickets Trac Tickets]
+
+Report and view bugs and features by adding a ticket at [@https://svn.boost.org/trac/boost Boost.Trac].
+
+Existing open tickets for this library alone can be viewed
+[@https://svn.boost.org/trac/boost/query?status=assigned&status=new&status=reopened&component=circular_buffer&col=id&col=summary&col=status&col=owner&col=type&col=milestone&order=priority here].
+Existing tickets for this library - including closed ones - can be viewed
+[@https://svn.boost.org/trac/boost/query?status=assigned&status=closed&status=new&status=reopened&component=circular_buffer&col=id&col=summary&col=status&col=owner&col=type&col=milestone&order=priority here].
+
+Type: Bugs
+
+[@https://svn.boost.org/trac/boost/ticket/4100 #4100] Some boost classes have sizeof that depends on NDEBUG.
+
+[@https://svn.boost.org/trac/boost/ticket/5362 #5362] circular_buffer does not compile with BOOST_NO_EXCEPTIONS.
+
+[@https://svn.boost.org/trac/boost/ticket/6277 #6277] Checked iterators are not threadsafe.
+
+[@https://svn.boost.org/trac/boost/ticket/6747 #6747] Circular_Buffer / Bounded_Buffer inside Template class problem.
+
+[@https://svn.boost.org/trac/boost/ticket/7025 #7025] circular buffer reports warning: " type qualifiers ignored on function return type" while compile.
+
+[@https://svn.boost.org/trac/boost/ticket/7950 #7950] Eliminate W4-warnings under VS2005.
+
+[@https://svn.boost.org/trac/boost/ticket/8012 #8012] Inconsistency in `linearize()`.
+
+[@https://svn.boost.org/trac/boost/ticket/8438 #8438] `vector` & __cb storage misbehave when using compiler optimizations.
+
+Type: Feature Requests
+
+[@https://svn.boost.org/trac/boost/ticket/5511 #5511] Documentation needs some improvement.
+
+[@https://svn.boost.org/trac/boost/ticket/7888 #7888] circular_buffer should support move semantics.
+
+Type: Patches
+
+[@https://svn.boost.org/trac/boost/ticket/8032 #8032] Warning fixes in circular_buffer.
+
+[endsect] [/section:tickets Trac Tickets]
+
+[section:release Release Notes]
+
+[h4 Boost 1.55]
+
+* Documentation refactored by Paul A. Bristow using Quickbook, Doxygen and Autoindexing.
+
+[h4 Boost 1.42]
+
+* Added methods erase_begin(size_type) and erase_end(size_type) with constant complexity for such types of stored elements which do not need an explicit destruction e.g. int or double.
+* Similarly changed implementation of the clear() method and the destructor so their complexity is now constant for such types of stored elements which do not require an explicit destruction (the complexity for other types remains linear).
+
+[h4 Boost 1.37]
+
+ *Added new methods is_linearized() and rotate(const_iterator).
+* Fixed bugs:
+[@https://svn.boost.org/trac/boost/ticket/1987 #1987] Patch to make circular_buffer.hpp #includes absolute.
+[@https://svn.boost.org/trac/boost/ticket/1852 #1852] Copy constructor does not copy capacity.
+
+[h4 Boost 1.36]
+
+* Changed behaviour of the circular_buffer(const allocator_type&) constructor.
+Since this version the constructor does not allocate any memory and both capacity and size are set to zero.
+* Fixed bug:
+ [@https://svn.boost.org/trac/boost/ticket/191 #1919] Default constructed circular buffer throws std::bad_alloc.
+
+[h4 Boost 1.35]
+* Initial release.
+
+[endsect] [/section:release Release Notes]
+
+[section:acknowledgements Acknowledgements]
+
+Thomas Witt in 2002 produced a prototype called cyclic buffer.
+
+The circular_buffer has a short history. Its first version was a std::deque adaptor.
+This container was not very effective because of many reallocations when inserting/removing an element.
+Thomas Wenish did a review of this version and
+motivated me to create a circular buffer which allocates memory at once when created.
+
+The second version adapted `std::vector` but it has been abandoned soon
+because of limited control over iterator invalidation.
+The current version is a full-fledged STL compliant container.
+
+Pavel Vozenilek did a thorough review of this version and came with many good ideas and improvements.
+
+The idea of the space optimized circular buffer has been introduced by Pavel Vozenilek.
+
+Also, I would like to thank Howard Hinnant, Nigel Stewart and everyone
+who participated at the formal review for valuable comments and ideas.
+
+Paul A. Bristow refactored the documentation in 2013 to use the full power of Quickbook, Doxygen and Autoindexing.
+
+[endsect] [/section:acknowledgements Acknowledgements]
+
+
+[section:version_id Documentation Version Info]
+
+Last edit to Quickbook file __FILENAME__ was at __TIME__ on __DATE__.
+
+[tip This should appear on the pdf version
+(but may be redundant on a html version where the last edit date is on the first (home) page).]
+
+[warning Home page "Last revised" is GMT, not local time. Last edit date is local time.]
+[/See also Adobe Reader pdf File Properties for creation date, and PDF producer, version and page count.]
+
+[endsect] [/section:version_id Version Info]
+
+[xinclude autodoc.xml] [/ Using Doxygen reference documentation.]
+[/ The position of this in the Quickbook determines the location of the Doxygen references section.]
+[/ Index(es) should be invoked in the main module, not within a section.]
+
+[? enable_index
+'''
+ <index/>
+'''
+]
+
+[/ circular_buffer.qbk
+ Copyright 2013 Paul A. Bristow.
+ Copyright 2003-2008 Jan Gaspar.
+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt).
+]

Added: trunk/libs/circular_buffer/doc/jamfile.v2
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/libs/circular_buffer/doc/jamfile.v2 2013-07-02 03:44:38 EDT (Tue, 02 Jul 2013) (r84938)
@@ -0,0 +1,279 @@
+
+# Boost.circular_buffer library documentation Jamfile.v2
+#
+# Copyright Paul A. Bristow 2013.
+# Copyright Jan Gaspar 2003-2008.
+
+# Use, modification and distribution is subject to
+# the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt
+# or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+path-constant nav_images : html/images/ ; # png and svg images for home, next, note, tip...
+path-constant images_location : html/images ; # location of my SVG and PNG images referenced by Quickbook.
+path-constant pdf_images_location : html ; # location of SVG and PNG images referenced by pdf.
+path-constant here : . ; # location of /doc folder.
+
+echo "nav_images = " $(nav_images) ; # "nav_images = I:\boost-trunk\libs\circular_buffer\doc\html\images
+echo "images_location = " $(images_location) ; # images_location = I:\boost-trunk\libs\circular_buffer\doc\html\images
+echo "pdf_images_location = " $(pdf_images_location) #
+import modules ;
+
+if --enable-index in [ modules.peek : ARGV ]
+{
+ ECHO "Building the docs with automatic index generation enabled." ;
+ using auto-index ;
+ project : requirements
+
+ <auto-index>on # Turns on index (or off).
+ # Turns on (or off) index-verbose for diagnostic info (using /bin auto-index-verbose folders).
+ <auto-index-verbose>on
+
+ # Choose indexing method (separately for html and pdf):
+ <format>html:<auto-index-internal>on # on (or off) to use internally generated indexes.
+ # <format>html:<xsl:param>generate.index=0 # Don't let the XSL stylesheets generate indexes.
+
+ <format>pdf:<auto-index-internal>off # on (or off) to use internally generated indexes.
+ # <auto-index-type>index # Use <index>...</index> as the XML wrapper.
+
+ <format>html:<xsl:param>index.on.type=1 # = 1 For the native stylesheets to generate multiple different indexes.
+
+ # PDF native index support is probably better for PDFs as then you actually get page numbers.
+
+ <auto-index-script>circular_buffer.idx # Specifies the name of the script to load for circular_buffer.
+ <auto-index-prefix>../../.. # Will get you back up to /circular_buffer, so !scan-path "boost/circular_buffer/" is where *.hpp will be,
+ # and /libs/circular_buffer for other files.
+ # Without this would need !scan-path "../../../boost/circular_buffer"
+
+ <quickbook-define>enable_index ;
+ # Used by Quickbook to invoke indexing.
+}
+else
+{
+ ECHO "Building the my_library docs with automatic index generation disabled. To get an auto-index, try building with --enable-index." ;
+}
+
+using auto-index ;
+
+using doxygen ; # Required if you want to use Doxygen.
+using quickbook ;
+
+doxygen autodoc
+ :
+ # List all the files individually (RECURSIVE=NO ).
+ [ glob ../../../boost/circular_buffer.hpp ]
+ [ glob ../../../boost/circular_buffer/base.hpp ]
+ [ glob ../../../boost/circular_buffer/space_optimized.hpp ]
+ [ glob ../../../boost/circular_buffer/details.hpp ] # Needed for capacity_control at least.
+ [ glob ../../../boost/circular_buffer/debug.hpp ] # not needed?
+
+ :
+ # Pass some setting parameters to Doxygen.
+ <doxygen:param>WARNINGS=YES # Default NO, but useful to see warnings, especially in a logfile.
+ # It is also wise to to set a warnings logfile like this:
+ <doxygen:param>WARN_LOGFILE=AutoDoxywarnings.log # This may not be empty (usually not a good sign!), depending on options chosen.
+ # Much better to send message to a logfile than the default stderr.
+ # and make sure that there are no Doxygen errors or significant warnings in the log file.
+ <doxygen:param>RECURSIVE=NO # Search recursively down .hpp and .cpp subdirectories.
+ <doxygen:param>EXTRACT_ALL=NO
+ <doxygen:param>EXTRACT_PRIVATE=NO # NO means do not extract info about private member functions and data.
+ <doxygen:param>HIDE_UNDOC_MEMBERS=YES # Only show members that have some documentation like \param, \return ...
+ <doxygen:param>MACRO_EXPANSION=YES # YES will expand all macro names in the source code (default = NO).
+ <doxygen:param>EXPAND_ONLY_PREDEF=YES # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+ # then the macro expansion is limited to the macros specified with the PREDEFINED and EXPAND_AS_DEFINED tags.
+ # If EXPAND_ONLY_PREDEF tag can be used to specify a list of macro names that should be expanded (as defined).
+ # The PREDEFINED tag can be used to specify one or more macro names that are defined
+ # before the preprocessor is started (similar to the -D option of gcc).
+ # The argument of the tag is a list of macros of the form:
+ # name or name=definition (no spaces).
+ # If the definition and the "=" are omitted, "=1" is assumed.
+ # To prevent a macro definition from being undefined via #undef or
+ # recursively expanded use the := operator instead of the = operator.
+ # See http://www.stack.nl/~dimitri/doxygen/config.html#cfg_predefined.
+ # static char *malloc BOOST_PREVENT_MACRO_SUBSTITUTION(const size_type bytes);
+ # will not produce a helpful Doxygen output, so
+ # replace some with more helpful text, or none, for example:
+ <doxygen:param>"PREDEFINED= \\
+ \"BOOST_PREVENT_MACRO_SUBSTITUTION\" \\
+ \"BOOST_STATIC_CONSTANT(T,V)=static x const y\" \\
+ \"BOOST_UNITS_AUTO_STATIC_CONSTANT(a,b)=static const auto a = b\" \\
+ \"BOOST_DEDUCED_TYPENAME=typename\" \\
+ \"BOOST_CONSTEXPR=constexpr\" \\
+ \"BOOST_UNITS_TYPEOF(a)=typeof(a)\" \\
+ \"BOOST_UNITS_HAS_TYPEOF=1\" \\
+ \"BOOST_MPL_ASSERT(expr)=\" \\
+ \"BOOST_ASSERT(expr)=\" \\
+ \"ASSERT(x)=assert(x)\" \\
+ \"__cplusplus \""
+ # BOOST_PREVENT_MACRO_SUBSTITUTION, will not be replaced by ,
+ # BOOST_STATIC_CONSTANT will be replaced by "static x const y",
+ # BOOST_DEDUCED_TYPENAME will be replaced by "typename",
+ # BOOST_CONSTEXPR will be replaced by "constexpr".
+ <doxygen:param>EXCLUDE_SYMBOLS=*_throws
+ # <doxygen:param>IMAGE_PATH="../images" # for circular_buffer.png
+ # See autodoxywarnings.log to check this is correct.
+
+ # The syntax hoops to jump through are 'interesting' for more than one PREDEFINED,
+ # and to permit spaces within definitions (use double quotes).
+ # Don't forget that every double quote " needs a preceeding \trip character!
+ # and that each trailing continuation \ needs a preceeding \trip character too!
+ # And finally that if more than one item is included (as here) the whole is
+ # enclosed in "PREDEFINED=... ", but without a leading \. Go figure...
+
+ # A grep for PREDEFINED= in jamfiles will reveal even more complex examples.
+ # Boost Libraries with useful examples are: Accumulators, Interprocess, MPI, Random, Units, Expressive.
+
+ # Optionally, you can provide a Reference section name specific for your library, for example:
+ <xsl:param>"boost.doxygen.reftitle=Boost.Circular_buffer C++ Reference"
+ ;
+
+xml circular_buffer : circular_buffer.qbk ;
+
+using boostbook ;
+
+boostbook standalone
+ :
+ circular_buffer
+ :
+
+ # General settings
+ # =================
+ # Path for links to Boost.
+ <xsl:param>boost.root=../../../..
+ # Path for libraries index, for example: http://www.boost.org/doc/libs/1_53_0/libs/libraries.htm:
+ <xsl:param>boost.libraries=../../../../../boost-trunk/libs/libraries.htm
+
+ # Use the main Boost stylesheet:
+ #<xsl:param>html.stylesheet=../../doc/html/boostbook.css
+ # Use local stylsheet
+ <xsl:param>html.stylesheet=boostbook.css
+ # <xsl:param>html.stylesheet=./boostbook.css
+ #<xsl:param>img.src.path=../images/ # graphics (diagrams) for html.
+ <xsl:param>nav.layout=horizontal # to get a horizontal navigation bar (you probably DO want this).
+
+ # Path for links to Boost logo.
+ #<xsl:param>boost.root=.. # already defined
+ <xsl:param>boost.image=Boost # options are: none (no logo), Boost (for boost.png), or your own logo, for example, inspired_by_boost.png
+ <xsl:param>boost.image.src=../images/draft_for_boost.png #
+ <xsl:param>boost.image.w=180 # Width of logo in pixels. (JM has W = 162, h = 46)
+ <xsl:param>boost.image.h=90 # Height of logo in pixels.
+
+ # Options for html and pdf
+ # ========================
+ # No indent on body text:
+ <xsl:param>body.start.indent=0pt
+ # Margin size:
+ <xsl:param>page.margin.inner=0.5in
+ # Margin size:
+ <xsl:param>page.margin.outer=0.5in
+ # Yes, we want graphics for admonishments:
+ <xsl:param>admon.graphics=1
+
+ # HTML options:
+ # =============
+ # Use graphics icons not text for navigation:
+ <xsl:param>navig.graphics=1
+ # How far down we chunk nested sections, basically all of them:
+ <xsl:param>chunk.section.depth=2
+ # Don't put the first section on the same page as the TOC itself:
+ <xsl:param>chunk.first.sections=1
+ # How far down sections get TOC's
+ <xsl:param>toc.section.depth=4
+ # Max depth in each TOC:
+ <xsl:param>toc.max.depth=2
+ # How far down we go with TOC's
+ <xsl:param>generate.section.toc.level=10
+ # Horizontal ? spacing in table cells.
+ <format>html:<xsl:param>html.cellspacing=3 # pixels
+ # Vertical spacing in table cells.
+ <format>html:<xsl:param>html.cellpadding=5 # pixels
+ # Not sure if these are right way round?
+
+ # Required by boost-trunk/doc/ see jamfile.v2 to use auto-index.
+ # Choose indexing method for html:
+ <format>html:<auto-index-internal>on
+ <format>docbook:<auto-index-internal>on
+
+ # Set the name of the script file to use (library_name.idx is good):
+ <auto-index-script>$(here)/circular_buffer.idx
+ # Commands in the script file should all use RELATIVE PATHS
+ # otherwise the script will not be portable to other machines.
+ # Relative paths are normally taken as relative to the location
+ # of the script file, but we can add a prefix to all
+ # those relative paths using the <auto-index-prefix> feature.
+ # The path specified by <auto-index-prefix> may be either relative or
+ # absolute, for example the following will get us up to the boost root
+ # directory for most Boost libraries:
+ <auto-index-prefix>"$(here)/../../.."
+
+ <format>html:<xsl:param>boost.root=../../../..
+ <format>html:<xsl:param>boost.libraries=../../../../libs/libraries.htm
+
+# Finally, in boost.xml we xi:include circular_buffer.auto_index.docbook which is the final
+# post-index generation docbook, rather than circular_buffer.xml
+# which is the pre-indexed boostbook.
+
+
+ # PDF Options:
+ # ============
+ # TOC Generation: this is needed for FOP-0.9 and later:
+ <format>pdf:<xsl:param>fop1.extensions=0
+ # Or enable this if you're using XEP:
+ <format>pdf:<xsl:param>xep.extensions=1
+ # TOC generation: this is needed for FOP 0.2, but must not be set to zero for FOP-0.9!
+ <format>pdf:<xsl:param>fop.extensions=0
+ # No indent on body text:
+ <xsl:param>body.start.indent=0pt
+ # Margin size:
+ <xsl:param>page.margin.inner=0.5in
+ # Margin size:
+ <xsl:param>page.margin.outer=0.5in
+
+ # Yes, we want graphics for admonishments:
+ <xsl:param>admon.graphics=1
+
+ # Set these one for PDF generation *only*:
+ # default png graphics are awful in PDF form,
+ # better use SVG instead:
+ #<format>pdf:<xsl:param>admon.graphics.extension=".svg"
+ <format>pdf:<xsl:param>admon.graphics.extension=".png" # Only png images are available.
+ <format>pdf:<xsl:param>admon.graphics.path=$(nav_images)/ # next, prev, note, tip ... for pdf.
+ <format>pdf:<xsl:param>use.role.for.mediaobject=1
+ <format>pdf:<xsl:param>preferred.mediaobject.role=print
+ <format>pdf:<xsl:param>img.src.path=$(pdf_images_location)/ # graphics (diagrams) for pdf.
+ <format>pdf:<xsl:param>draft.mode="no"
+ #<format>pdf:<xsl:param>boost.url.prefix=I:/boost-trunk/boost/circular_buffer/libs/circular_buffer/doc/html
+ #<format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/libs/circular_buffer/doc/html
+ #<format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/libs/math/doc/html
+
+ <dependency>autodoc #
+ <dependency>css-install
+ <dependency>png-install
+ #<dependency>svg-install
+ ;
+
+# Install (copy) the 'master' copy of boostbook Cascading Style sheet from your current Boost-root.
+path-constant boost-root : [ modules.peek : BOOST ] ;
+
+echo "BOOST ROOT" $(boost-root) ;
+
+#install css-install : $(boost-root)/doc/src/boostbook.css : <location>html ;
+install css-install : ./boostbook.css : <location>html ; # copy a local version of boostbook.css to /html
+#install images-install : /images/circular_buffer.png : <location>html ; # copy a local version of /images to /html
+
+# Install (copy) the 'master' copies of all icon images (both PNG and SVG)
+# and the Boost logo from your current Boost-root
+# to the local /doc/html/images folder so that html is complete and standalone.
+ install png-install : [ glob ./images/*.png ] : <location>html/images ;
+# install svg-install : [ glob $(boost-root)/doc/images/*.svg ] : <location>html/images ;
+
+# install pdf-install : standalone : <install-type>PDF <location>. ;
+# Effectively copies the file from \bin folder to the \doc folder,
+# but will not work as expected if doxygen and/or autoindex is used
+# because a modified pdf file is created, so this command
+# will rename the file to the expected filename, here circular_buffer.pdf.
+
+install pdf-install : standalone : <install-type>PDF <location>. <name>circular_buffer.pdf ;
+
+install html-install : standalone : <location>. ;
+


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk