Keep vanetza-idf in obu-firmware, so a plain clone builds the firmware

obu-firmware builds against the vanetza-idf C-ITS library, which until now
came from the colleague's microbu-esp32c5 tree beside the repository and was
not tracked here, so a clone of this repository could not build the firmware
it ships. The library alone is now part of obu-firmware, as
obu-firmware/external/vanetza-idf: their external/vanetza-idf at commit
cf4b99f, unchanged (9775 files; see its PROVENANCE.md). CMake takes it from
there by default; -DVANETZA_IDF_DIR still points the build elsewhere.

The rest of the colleague's tree (their own VAM firmware, PKI tooling,
station-link Python tools, the V2X2MAP bridge) stays out of this repository
and gitignored; nothing is pushed to their repository. NOTES.md, docs/06,
TODO.md and the pcap verifier's usage line point at the new location.
This commit is contained in:
Ashin Walpola
2026-09-24 10:56:05 +02:00
parent 2f60623e18
commit d107534eb2
9781 changed files with 1560475 additions and 17 deletions
@@ -0,0 +1,96 @@
* text=auto !eol svneol=native#text/plain
*.gitattributes text svneol=native#text/plain
# Scriptish formats
*.bat text svneol=native#text/plain
*.bsh text svneol=native#text/x-beanshell
*.cgi text svneol=native#text/plain
*.cmd text svneol=native#text/plain
*.js text svneol=native#text/javascript
*.php text svneol=native#text/x-php
*.pl text svneol=native#text/x-perl
*.pm text svneol=native#text/x-perl
*.py text svneol=native#text/x-python
*.sh eol=lf svneol=LF#text/x-sh
configure eol=lf svneol=LF#text/x-sh
# Image formats
*.bmp binary svneol=unset#image/bmp
*.gif binary svneol=unset#image/gif
*.ico binary svneol=unset#image/ico
*.jpeg binary svneol=unset#image/jpeg
*.jpg binary svneol=unset#image/jpeg
*.png binary svneol=unset#image/png
*.tif binary svneol=unset#image/tiff
*.tiff binary svneol=unset#image/tiff
*.svg text svneol=native#image/svg%2Bxml
# Data formats
*.pdf binary svneol=unset#application/pdf
*.avi binary svneol=unset#video/avi
*.doc binary svneol=unset#application/msword
*.dsp text svneol=crlf#text/plain
*.dsw text svneol=crlf#text/plain
*.eps binary svneol=unset#application/postscript
*.gz binary svneol=unset#application/gzip
*.mov binary svneol=unset#video/quicktime
*.mp3 binary svneol=unset#audio/mpeg
*.ppt binary svneol=unset#application/vnd.ms-powerpoint
*.ps binary svneol=unset#application/postscript
*.psd binary svneol=unset#application/photoshop
*.rdf binary svneol=unset#text/rdf
*.rss text svneol=unset#text/xml
*.rtf binary svneol=unset#text/rtf
*.sln text svneol=native#text/plain
*.swf binary svneol=unset#application/x-shockwave-flash
*.tgz binary svneol=unset#application/gzip
*.vcproj text svneol=native#text/xml
*.vcxproj text svneol=native#text/xml
*.vsprops text svneol=native#text/xml
*.wav binary svneol=unset#audio/wav
*.xls binary svneol=unset#application/vnd.ms-excel
*.zip binary svneol=unset#application/zip
# Text formats
.htaccess text svneol=native#text/plain
*.bbk text svneol=native#text/xml
*.cmake text svneol=native#text/plain
*.css text svneol=native#text/css
*.dtd text svneol=native#text/xml
*.htm text svneol=native#text/html
*.html text svneol=native#text/html
*.ini text svneol=native#text/plain
*.log text svneol=native#text/plain
*.mak text svneol=native#text/plain
*.qbk text svneol=native#text/plain
*.rst text svneol=native#text/plain
*.sql text svneol=native#text/x-sql
*.txt text svneol=native#text/plain
*.xhtml text svneol=native#text/xhtml%2Bxml
*.xml text svneol=native#text/xml
*.xsd text svneol=native#text/xml
*.xsl text svneol=native#text/xml
*.xslt text svneol=native#text/xml
*.xul text svneol=native#text/xul
*.yml text svneol=native#text/plain
boost-no-inspect text svneol=native#text/plain
CHANGES text svneol=native#text/plain
COPYING text svneol=native#text/plain
INSTALL text svneol=native#text/plain
Jamfile text svneol=native#text/plain
Jamroot text svneol=native#text/plain
Jamfile.v2 text svneol=native#text/plain
Jamrules text svneol=native#text/plain
Makefile* text svneol=native#text/plain
README text svneol=native#text/plain
TODO text svneol=native#text/plain
# Code formats
*.c text svneol=native#text/plain
*.cpp text svneol=native#text/plain
*.h text svneol=native#text/plain
*.hpp text svneol=native#text/plain
*.ipp text svneol=native#text/plain
*.tpp text svneol=native#text/plain
*.jam text svneol=native#text/plain
*.java text svneol=native#text/plain
@@ -0,0 +1,26 @@
# Copyright 2018 Glen Joseph Fernandes
# (glenjofe@gmail.com)
#
# Distributed under the Boost Software License, Version 1.0.
# (http://www.boost.org/LICENSE_1_0.txt)
cmake_minimum_required(VERSION 3.5...3.20)
project(boost_circular_buffer VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
add_library(boost_circular_buffer INTERFACE)
add_library(Boost::circular_buffer ALIAS boost_circular_buffer)
target_include_directories(boost_circular_buffer INTERFACE include)
target_link_libraries(boost_circular_buffer INTERFACE
Boost::assert
Boost::concept_check
Boost::config
Boost::core
Boost::move
Boost::static_assert
Boost::throw_exception
Boost::type_traits
)
@@ -0,0 +1,48 @@
# Copyright 2018 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
version: 1.0.{build}-{branch}
shallow_clone: true
branches:
only:
- master
- develop
environment:
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
TOOLSET: msvc-9.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
TOOLSET: msvc-10.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
TOOLSET: msvc-11.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
TOOLSET: msvc-12.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
TOOLSET: msvc-14.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
TOOLSET: msvc-14.1
CXXSTD: 14,17
install:
- set BOOST_BRANCH=develop
- if "%APPVEYOR_REPO_BRANCH%" == "master" set BOOST_BRANCH=master
- cd ..
- git clone -b %BOOST_BRANCH% https://github.com/boostorg/boost.git boost
- cd boost
- git submodule update --init tools/build
- git submodule update --init libs/config
- git submodule update --init tools/boostdep
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\circular_buffer\
- python tools/boostdep/depinst/depinst.py circular_buffer
- cmd /c bootstrap
- b2 headers
build: off
test_script:
- PATH=%ADDPATH%%PATH%
- if not "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD%
- b2 -j 3 libs/circular_buffer/test toolset=%TOOLSET% %CXXSTD%
@@ -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"
@@ -0,0 +1,626 @@
[article Boost.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.implementation.debug_support debug support]]
[include ../../../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 [@https://www.boost.org/sgi/stl/List.html std::list]
or [@https://www.boost.org/sgi/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.
[$../../libs/circular_buffer/doc/images/circular_buffer.png]
There is also a __cbso version available.
[$../../libs/circular_buffer/doc/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 construction, 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 [@boost:libs/circular_buffer/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 [@boost:libs/circular_buffer/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 [@boost:libs/circular_buffer/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
[@boost:libs/circular_buffer/test/soft_iterator_invalidation.cpp soft_iterator_invalidation.cpp].
[h3 Move emulation and rvalues]
Since Boost 1.54.0 support for move semantics was implemented using
the [@boost:libs/move/index.html Boost.Move] library.
If rvalue references are available __cb will use them, but if not it uses a close,
but imperfect emulation. On such compilers:
* Non-copyable objects can be stored in the containers.
They can be constructed in place using `emplace`, or if they support
Boost.Move, moved into place.
* The containers themselves are not movable.
* Argument forwarding is not perfect.
__cb will use rvalues and move emulations for value types only if move constructor and move assignment operator of the value type do not throw;
or if the value type has no copy constructor.
Some methods won't use move constructor for the value type at all, if the constructor throws. This is
required for data consistency and avoidance of situations, when aftrer an exception __cb
contains moved away objects along with the good ones.
See documentation for [@boost:libs/type_traits/doc/html/boost_typetraits/reference/is_copy_constructible.html `is_copy_constructible`], [@boost:libs/type_traits/doc/html/boost_typetraits/reference/is_nothrow_move_assignable.html `is_nothrow_move_assignable`] and [@boost:libs/type_traits/doc/html/boost_typetraits/reference/is_nothrow_move_constructible.html `is_nothrow_move_constructible`] type triats.
There you'll find information about how to make constructor of class noexcept and how to make a non-copyable
class in C++03 and C++98.
Performance of __cb will *greatly improve* if value type has noexcept move constructor and noexcept move assignment.
[h3 Exceptions of move_if_noexcept(T&)]
Reference documentation of the __cb contains notes like "Throws: See Exceptions of `move_if_noexcept(T&)`".
That note means the following: `move_if_noexcept(T& value)` does not throws exceptions at all, but it returns
`value` as rvalue reference only if class `T` have noexcept move constructor and noexcept move assignment operator;
or if it has no copy constructor. Otherwise `move_if_noexcept(T& value)` returns `value` as const reference.
This leads us to the following situation:
* If `value` has a noexcept move constructor and noexcept move assignment operator, then no exceptions will be thrown at all.
* If `value` has a throwing move constructor and some copy constructor, then method may throw exceptions of copy constructor.
* If `value` has no copy constructor, then method may throw exceptions of move constructor.
`move_if_noexcept(T&)` uses [@boost:libs/move/index.html Boost.Move], [@boost:libs/type_traits/doc/html/boost_typetraits/reference/is_copy_constructible.html `is_copy_constructible`], [@boost:libs/type_traits/doc/html/boost_typetraits/reference/is_nothrow_move_assignable.html `is_nothrow_move_assignable`] and [@boost:libs/type_traits/doc/html/boost_typetraits/reference/is_nothrow_move_constructible.html `is_nothrow_move_constructible`] type triats.
[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 can be enabled to provide a kind of debug support.
When the debugging functionality is enabled, 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:boost/circular_buffer/debug.hpp circular_buffer/debug.hpp].
[caution Since the debugging code makes __cb and its iterators more interconnected, thread safety guarantees of __cb
are different when debug support is enabled. In addition to the container itself, all iterators tracked by the container
(including any copies thereof) must be protected from concurrent access. In particular, this includes copying, destroying or
obtaining iterators from the container, even if for read-only access.]
The debug support is disabled by default. To enable it, one has to define `BOOST_CB_ENABLE_DEBUG` macro with the value of 1
while compiling the code using __cb.
[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 permitted by the Interprocess library)
the code has to compiled with debug support disabled (i.e. with `BOOST_CB_ENABLE_DEBUG` macro not defined or defined to 0).
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 [@boost:libs/circular_buffer/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 [@boost:libs/circular_buffer/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 [@boost:libs/circular_buffer/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: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:boost/circular_buffer_fwd.hpp circular_buffer_fwd.hpp]).
The __cb is defined in the file [@boost:boost/circular_buffer/base.hpp base.hpp].
The __cbso is defined in the file [@boost:boost/circular_buffer/space_optimized.hpp space_optimized.hpp].
[endsect] [/section:headers Header Files]
[section:concepts Modelled Concepts]
[@https://www.boost.org/sgi/stl/RandomAccessContainer.html Random Access Container],
[@https://www.boost.org/sgi/stl/FrontInsertionSequence.html Front Insertion Sequence], and
[@https://www.boost.org/sgi/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 [@https://www.boost.org/sgi/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 [@https://www.boost.org/sgi/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.56]
* C++11 allocator model support implemented by Glen Fernandes.
[h4 Boost 1.55]
* Documentation refactored by Paul A. Bristow using Quickbook, Doxygen and Autoindexing.
* Rvalue references emulation added by Antony Polukhin using Boost.Move.
[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.]
'''
<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).
]
Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

@@ -0,0 +1,217 @@
# 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 : .. ; # 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 ;
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 ]
:
# 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_CONTAINER_NOEXCEPT=noexcept\" \\
\"BOOST_CONTAINER_NOEXCEPT_IF(T)=noexcept(T)\" \\
\"BOOST_UNITS_TYPEOF(a)=typeof(a)\" \\
\"BOOST_UNITS_HAS_TYPEOF=1\" \\
\"BOOST_MPL_ASSERT(expr)=\" \\
\"BOOST_ASSERT(expr)=\" \\
\"BOOST_RV_REF(T)=T &&\" \\
\"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 preceding \trip character!
# and that each trailing continuation \ needs a preceding \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
# =================
<format>html:<xsl:param>boost.root=../../../..
<format>html:<xsl:param>img.src.path=../../../../doc/html/
<format>docbook:<xsl:param>boost.root=boost:
# 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?
<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
<format>pdf:<auto-index-internal>off # on (or off) to use internally generated indexes.
<format>html:<xsl:param>index.on.type=1 # = 1 For the native stylesheets to generate multiple different indexes.
<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"
# Used by Quickbook to invoke indexing.
# 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
# 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.
# Don't need this, default path works OK:
#<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=../../../..
<dependency>autodoc #
<dependency>png_install
;
# 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 $(here)/*.png ] : <location>$(here)/../../../doc/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 pdfinstall : standalone : <install-type>PDF <location>. <name>circular_buffer.pdf ;
###############################################################################
alias boostdoc
: standalone/<format>docbook
:
:
: ;
explicit boostdoc ;
alias boostrelease ;
explicit boostrelease ;
@@ -0,0 +1,316 @@
// Comparison of bounded buffers based on different containers.
// Copyright (c) 2003-2008 Jan Gaspar
// Copyright 2013 Paul A. Bristow. Added some Quickbook snippet markers.
// 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)
#include <boost/circular_buffer.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition.hpp>
#include <boost/thread/thread.hpp>
#include <boost/timer/timer.hpp>
#include <boost/call_traits.hpp>
#include <boost/bind.hpp>
#include <deque>
#include <list>
#include <string>
#include <iostream>
const unsigned long QUEUE_SIZE = 1000L;
const unsigned long TOTAL_ELEMENTS = QUEUE_SIZE * 1000L;
template <class T>
class bounded_buffer {
public:
typedef boost::circular_buffer<T> container_type;
typedef typename container_type::size_type size_type;
typedef typename container_type::value_type value_type;
typedef typename boost::call_traits<value_type>::param_type param_type;
explicit bounded_buffer(size_type capacity) : m_unread(0), m_container(capacity) {}
void push_front(param_type item) {
boost::mutex::scoped_lock lock(m_mutex);
m_not_full.wait(lock, boost::bind(&bounded_buffer<value_type>::is_not_full, this));
m_container.push_front(item);
++m_unread;
lock.unlock();
m_not_empty.notify_one();
}
void pop_back(value_type* pItem) {
boost::mutex::scoped_lock lock(m_mutex);
m_not_empty.wait(lock, boost::bind(&bounded_buffer<value_type>::is_not_empty, this));
*pItem = m_container[--m_unread];
lock.unlock();
m_not_full.notify_one();
}
private:
bounded_buffer(const bounded_buffer&); // Disabled copy constructor
bounded_buffer& operator = (const bounded_buffer&); // Disabled assign operator
bool is_not_empty() const { return m_unread > 0; }
bool is_not_full() const { return m_unread < m_container.capacity(); }
size_type m_unread;
container_type m_container;
boost::mutex m_mutex;
boost::condition m_not_empty;
boost::condition m_not_full;
};
template <class T>
class bounded_buffer_space_optimized {
public:
typedef boost::circular_buffer_space_optimized<T> container_type;
typedef typename container_type::size_type size_type;
typedef typename container_type::value_type value_type;
typedef typename boost::call_traits<value_type>::param_type param_type;
explicit bounded_buffer_space_optimized(size_type capacity) : m_container(capacity) {}
void push_front(param_type item) {
boost::mutex::scoped_lock lock(m_mutex);
m_not_full.wait(lock, boost::bind(&bounded_buffer_space_optimized<value_type>::is_not_full, this));
m_container.push_front(item);
lock.unlock();
m_not_empty.notify_one();
}
void pop_back(value_type* pItem) {
boost::mutex::scoped_lock lock(m_mutex);
m_not_empty.wait(lock, boost::bind(&bounded_buffer_space_optimized<value_type>::is_not_empty, this));
*pItem = m_container.back();
m_container.pop_back();
lock.unlock();
m_not_full.notify_one();
}
private:
bounded_buffer_space_optimized(const bounded_buffer_space_optimized&); // Disabled copy constructor
bounded_buffer_space_optimized& operator = (const bounded_buffer_space_optimized&); // Disabled assign operator
bool is_not_empty() const { return m_container.size() > 0; }
bool is_not_full() const { return m_container.size() < m_container.capacity(); }
container_type m_container;
boost::mutex m_mutex;
boost::condition m_not_empty;
boost::condition m_not_full;
};
template <class T>
class bounded_buffer_deque_based {
public:
typedef std::deque<T> container_type;
typedef typename container_type::size_type size_type;
typedef typename container_type::value_type value_type;
typedef typename boost::call_traits<value_type>::param_type param_type;
explicit bounded_buffer_deque_based(size_type capacity) : m_capacity(capacity) {}
void push_front(param_type item) {
boost::mutex::scoped_lock lock(m_mutex);
m_not_full.wait(lock, boost::bind(&bounded_buffer_deque_based<value_type>::is_not_full, this));
m_container.push_front(item);
lock.unlock();
m_not_empty.notify_one();
}
void pop_back(value_type* pItem) {
boost::mutex::scoped_lock lock(m_mutex);
m_not_empty.wait(lock, boost::bind(&bounded_buffer_deque_based<value_type>::is_not_empty, this));
*pItem = m_container.back();
m_container.pop_back();
lock.unlock();
m_not_full.notify_one();
}
private:
bounded_buffer_deque_based(const bounded_buffer_deque_based&); // Disabled copy constructor
bounded_buffer_deque_based& operator = (const bounded_buffer_deque_based&); // Disabled assign operator
bool is_not_empty() const { return m_container.size() > 0; }
bool is_not_full() const { return m_container.size() < m_capacity; }
const size_type m_capacity;
container_type m_container;
boost::mutex m_mutex;
boost::condition m_not_empty;
boost::condition m_not_full;
};
template <class T>
class bounded_buffer_list_based {
public:
typedef std::list<T> container_type;
typedef typename container_type::size_type size_type;
typedef typename container_type::value_type value_type;
typedef typename boost::call_traits<value_type>::param_type param_type;
explicit bounded_buffer_list_based(size_type capacity) : m_capacity(capacity) {}
void push_front(param_type item) {
boost::mutex::scoped_lock lock(m_mutex);
m_not_full.wait(lock, boost::bind(&bounded_buffer_list_based<value_type>::is_not_full, this));
m_container.push_front(item);
lock.unlock();
m_not_empty.notify_one();
}
void pop_back(value_type* pItem) {
boost::mutex::scoped_lock lock(m_mutex);
m_not_empty.wait(lock, boost::bind(&bounded_buffer_list_based<value_type>::is_not_empty, this));
*pItem = m_container.back();
m_container.pop_back();
lock.unlock();
m_not_full.notify_one();
}
private:
bounded_buffer_list_based(const bounded_buffer_list_based&); // Disabled copy constructor
bounded_buffer_list_based& operator = (const bounded_buffer_list_based&); // Disabled assign operator
bool is_not_empty() const { return m_container.size() > 0; }
bool is_not_full() const { return m_container.size() < m_capacity; }
const size_type m_capacity;
container_type m_container;
boost::mutex m_mutex;
boost::condition m_not_empty;
boost::condition m_not_full;
};
template<class Buffer>
class Consumer {
typedef typename Buffer::value_type value_type;
Buffer* m_container;
value_type m_item;
public:
Consumer(Buffer* buffer) : m_container(buffer) {}
void operator()() {
for (unsigned long i = 0L; i < TOTAL_ELEMENTS; ++i) {
m_container->pop_back(&m_item);
}
}
};
template<class Buffer>
class Producer {
typedef typename Buffer::value_type value_type;
Buffer* m_container;
public:
Producer(Buffer* buffer) : m_container(buffer) {}
void operator()() {
for (unsigned long i = 0L; i < TOTAL_ELEMENTS; ++i) {
m_container->push_front(value_type());
}
}
};
template<class Buffer>
void fifo_test(Buffer* buffer) {
// Start of measurement
boost::timer::auto_cpu_timer progress;
// Initialize the buffer with some values before launching producer and consumer threads.
for (unsigned long i = QUEUE_SIZE / 2L; i > 0; --i) {
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x581))
buffer->push_front(Buffer::value_type());
#else
buffer->push_front(BOOST_DEDUCED_TYPENAME Buffer::value_type());
#endif
}
Consumer<Buffer> consumer(buffer);
Producer<Buffer> producer(buffer);
// Start the threads.
boost::thread consume(consumer);
boost::thread produce(producer);
// Wait for completion.
consume.join();
produce.join();
// End of measurement
}
int main(int /*argc*/, char* /*argv*/[]) {
bounded_buffer<int> bb_int(QUEUE_SIZE);
std::cout << "bounded_buffer<int> ";
fifo_test(&bb_int);
bounded_buffer_space_optimized<int> bb_space_optimized_int(QUEUE_SIZE);
std::cout << "bounded_buffer_space_optimized<int> ";
fifo_test(&bb_space_optimized_int);
bounded_buffer_deque_based<int> bb_deque_based_int(QUEUE_SIZE);
std::cout << "bounded_buffer_deque_based<int> ";
fifo_test(&bb_deque_based_int);
bounded_buffer_list_based<int> bb_list_based_int(QUEUE_SIZE);
std::cout << "bounded_buffer_list_based<int> ";
fifo_test(&bb_list_based_int);
bounded_buffer<std::string> bb_string(QUEUE_SIZE);
std::cout << "bounded_buffer<std::string> ";
fifo_test(&bb_string);
bounded_buffer_space_optimized<std::string> bb_space_optimized_string(QUEUE_SIZE);
std::cout << "bounded_buffer_space_optimized<std::string> ";
fifo_test(&bb_space_optimized_string);
bounded_buffer_deque_based<std::string> bb_deque_based_string(QUEUE_SIZE);
std::cout << "bounded_buffer_deque_based<std::string> ";
fifo_test(&bb_deque_based_string);
bounded_buffer_list_based<std::string> bb_list_based_string(QUEUE_SIZE);
std::cout << "bounded_buffer_list_based<std::string> ";
fifo_test(&bb_list_based_string);
return 0;
}
/*
//[bounded_buffer_comparison_output
Description: Autorun "J:\Cpp\Misc\Debug\bounded_buffer_comparison.exe"
bounded_buffer<int> 5.15 s
bounded_buffer_space_optimized<int> 5.71 s
bounded_buffer_deque_based<int> 15.57 s
bounded_buffer_list_based<int> 17.33 s
bounded_buffer<std::string> 24.49 s
bounded_buffer_space_optimized<std::string> 28.33 s
bounded_buffer_deque_based<std::string> 29.45 s
bounded_buffer_list_based<std::string> 31.29 s
//] //[bounded_buffer_comparison_output]
*/
@@ -0,0 +1,192 @@
// Copyright 2003-2008 Jan Gaspar.
// Copyright 2013 Paul A. Bristow. Added some Quickbook snippet markers.
// Distributed under the Boost Software License, Version 1.0.
// (See the accompanying file LICENSE_1_0.txt
// or a copy at <http://www.boost.org/LICENSE_1_0.txt>.)
//[circular_buffer_bound_example_1
/*`
This example shows how the `circular_buffer` can be utilized
as an underlying container of the bounded buffer.
*/
#include <boost/circular_buffer.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition.hpp>
#include <boost/thread/thread.hpp>
#include <boost/call_traits.hpp>
#include <boost/bind.hpp>
#include <boost/timer/timer.hpp> // for auto_cpu_timer
#include <iostream>
template <class T>
class bounded_buffer
{
public:
typedef boost::circular_buffer<T> container_type;
typedef typename container_type::size_type size_type;
typedef typename container_type::value_type value_type;
typedef typename boost::call_traits<value_type>::param_type param_type;
explicit bounded_buffer(size_type capacity) : m_unread(0), m_container(capacity) {}
void push_front(typename boost::call_traits<value_type>::param_type item)
{ // `param_type` represents the "best" way to pass a parameter of type `value_type` to a method.
boost::mutex::scoped_lock lock(m_mutex);
m_not_full.wait(lock, boost::bind(&bounded_buffer<value_type>::is_not_full, this));
m_container.push_front(item);
++m_unread;
lock.unlock();
m_not_empty.notify_one();
}
void pop_back(value_type* pItem) {
boost::mutex::scoped_lock lock(m_mutex);
m_not_empty.wait(lock, boost::bind(&bounded_buffer<value_type>::is_not_empty, this));
*pItem = m_container[--m_unread];
lock.unlock();
m_not_full.notify_one();
}
private:
bounded_buffer(const bounded_buffer&); // Disabled copy constructor.
bounded_buffer& operator = (const bounded_buffer&); // Disabled assign operator.
bool is_not_empty() const { return m_unread > 0; }
bool is_not_full() const { return m_unread < m_container.capacity(); }
size_type m_unread;
container_type m_container;
boost::mutex m_mutex;
boost::condition m_not_empty;
boost::condition m_not_full;
}; //
//] [/circular_buffer_bound_example_1]
const unsigned long queue_size = 1000L;
const unsigned long total_elements = queue_size * 1000L;
//[circular_buffer_bound_example_2]
/*`To demonstrate, create two classes to exercise the buffer.
The producer class fills the buffer with elements.
The consumer class consumes the buffer contents.
*/
template<class Buffer>
class Producer
{
typedef typename Buffer::value_type value_type;
Buffer* m_container;
public:
Producer(Buffer* buffer) : m_container(buffer)
{}
void operator()()
{
for (unsigned long i = 0L; i < total_elements; ++i)
{
m_container->push_front(value_type());
}
}
};
template<class Buffer>
class Consumer
{
typedef typename Buffer::value_type value_type;
Buffer* m_container;
value_type m_item;
public:
Consumer(Buffer* buffer) : m_container(buffer)
{}
void operator()()
{
for (unsigned long i = 0L; i < total_elements; ++i)
{
m_container->pop_back(&m_item);
}
}
};
/*`Create a first-int first-out test of the bound_buffer.
Include a call to boost::progress_timer
[@http://www.boost.org/doc/libs/1_53_0/libs/timer/doc/cpu_timers.html CPU timer]
*/
template<class Buffer>
void fifo_test(Buffer* buffer)
{
// Start of timing.
boost::timer::auto_cpu_timer progress;
// Initialize the buffer with some values before launching producer and consumer threads.
for (unsigned long i = queue_size / 2L; i > 0; --i)
{
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x581))
buffer->push_front(Buffer::value_type());
#else
buffer->push_front(BOOST_DEDUCED_TYPENAME Buffer::value_type());
#endif
}
// Construct the threads.
Consumer<Buffer> consumer(buffer);
Producer<Buffer> producer(buffer);
// Start the threads.
boost::thread consume(consumer);
boost::thread produce(producer);
// Wait for completion.
consume.join();
produce.join();
// End of timing.
// destructor of boost::timer::auto_cpu_timer will output the time to std::cout.
}
//] [/circular_buffer_bound_example_2]
int main()
{
//[circular_buffer_bound_example_3]
//`Construct a bounded_buffer to hold the chosen type, here int.
bounded_buffer<int> bb_int(queue_size);
std::cout << "Testing bounded_buffer<int> ";
//`Start the fifo test.
fifo_test(&bb_int);
//` destructor of boost::timer::auto_cpu_timer will output the time to std::cout
//] [/circular_buffer_bound_example_3]
return 0;
} // int main()
/*
//[circular_buffer_bound_output
Description: Autorun "J:\Cpp\Misc\Debug\circular_buffer_bound_example.exe"
Testing bounded_buffer<int> 15.010692s wall, 9.188459s user + 7.207246s system = 16.395705s CPU (109.2%)
//] [/circular_buffer_bound_output]
*/
@@ -0,0 +1,63 @@
// Copyright 2003-2008 Jan Gaspar.
// Copyright 2013 Paul A. Bristow. Added some Quickbook snippet markers.
// Distributed under the Boost Software License, Version 1.0.
// (See the accompanying file LICENSE_1_0.txt
// or a copy at <http://www.boost.org/LICENSE_1_0.txt>.)
//[circular_buffer_example_1
/*`For all examples, we need this include:
*/
#include <boost/circular_buffer.hpp>
//] [/circular_buffer_example_1]
int main()
{
//[circular_buffer_example_2
// Create a circular buffer with a capacity for 3 integers.
boost::circular_buffer<int> cb(3);
// Insert three elements into the buffer.
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);
int a = cb[0]; // a == 1
int b = cb[1]; // b == 2
int c = cb[2]; // c == 3
// The buffer is full now, so pushing subsequent
// elements will overwrite the front-most elements.
cb.push_back(4); // Overwrite 1 with 4.
cb.push_back(5); // Overwrite 2 with 5.
// The buffer now contains 3, 4 and 5.
a = cb[0]; // a == 3
b = cb[1]; // b == 4
c = cb[2]; // c == 5
// Elements can be popped from either the front or the back.
cb.pop_back(); // 5 is removed.
cb.pop_front(); // 3 is removed.
// Leaving only one element with value = 4.
int d = cb[0]; // d == 4
//] [/circular_buffer_example_2]
return 0;
}
/*
//[circular_buffer_example_output
There is no output from this example.
//] [/circular_buffer_example_output]
*/
@@ -0,0 +1,14 @@
echo off
rem quickbook doxygen auto-index docs template circular_buffer_html_index.bat
rem echo circular_buffer_html_index_%date%_%time:~0,2%_%time:~3,2%.log
rem The DOS time format is assumed 12:34 and the : separator is not used.
set t=%time% /T
set tim=%t:~0,2%%t:~3,2%
rem pick just hours and minutes.
rem time may include leading space, like " 915", so remove space.
set tim=%tim: =%
rem boost-no-inspect
rem cd \boost-trunk/circular_buffer\libs\circular_buffer\example
bjam -a > circular_buffer_examples_%date%_%tim%.log
if not ERRORLEVEL 0 (echo Errorlevel is %ERRORLEVEL%) else (echo OK)
pause
@@ -0,0 +1,40 @@
// Copyright 2003-2008 Jan Gaspar.
// Copyright 2013 Paul A. Bristow. Added some Quickbook snippet markers.
// Distributed under the Boost Software License, Version 1.0.
// (See the accompanying file LICENSE_1_0.txt
// or a copy at <http://www.boost.org/LICENSE_1_0.txt>.)
#undef BOOST_CB_ENABLE_DEBUG
//[circular_buffer_iter_example_1
/*`
*/
#define BOOST_CB_ENABLE_DEBUG 0 // The Debug Support has to be disabled, otherwise the code produces a runtime error.
#include <boost/circular_buffer.hpp>
#include <boost/assert.hpp>
#include <assert.h>
int main(int /*argc*/, char* /*argv*/[])
{
boost::circular_buffer<int> cb(3);
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);
boost::circular_buffer<int>::iterator it = cb.begin();
assert(*it == 1);
cb.push_back(4);
assert(*it == 4); // The iterator still points to the initialized memory.
return 0;
}
//] [/circular_buffer_iter_example_1]
@@ -0,0 +1,64 @@
// Copyright 2003-2008 Jan Gaspar.
// Copyright 2013 Paul A. Bristow. Added some Quickbook snippet markers.
// Distributed under the Boost Software License, Version 1.0.
// (See the accompanying file LICENSE_1_0.txt
// or a copy at <http://www.boost.org/LICENSE_1_0.txt>.)
//[circular_buffer_sum_example_1
/*`This example shows several functions, including summing all valid values.
*/
#include <boost/circular_buffer.hpp>
#include <numeric>
#include <assert.h>
int main(int /*argc*/, char* /*argv*/[])
{
// Create a circular buffer of capacity 3.
boost::circular_buffer<int> cb(3);
assert(cb.capacity() == 3);
// Check is empty.
assert(cb.size() == 0);
assert(cb.empty());
// Insert some elements into the circular buffer.
cb.push_back(1);
cb.push_back(2);
// Assertions to check push_backs have expected effect.
assert(cb[0] == 1);
assert(cb[1] == 2);
assert(!cb.full());
assert(cb.size() == 2);
assert(cb.capacity() == 3);
// Insert some other elements.
cb.push_back(3);
cb.push_back(4);
// Evaluate the sum of all elements.
int sum = std::accumulate(cb.begin(), cb.end(), 0);
// Assertions to check state.
assert(sum == 9);
assert(cb[0] == 2);
assert(cb[1] == 3);
assert(cb[2] == 4);
assert(*cb.begin() == 2);
assert(cb.front() == 2);
assert(cb.back() == 4);
assert(cb.full());
assert(cb.size() == 3);
assert(cb.capacity() == 3);
return 0;
}
//] [/circular_buffer_sum_example_1]
/*
There is no output from this example.
*/
@@ -0,0 +1,42 @@
# Copyright Paul A. Bristow 2013
# 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)
# jamfile.v2 to run all circular_buffer examples.
# bring in the rules for testing.
import testing ;
project
: requirements
<library>/boost/system//boost_system
<library>/boost/thread//boost_thread
#<define>BOOST_ALL_NO_LIB=1
<threading>multi
<toolset>gcc:<cxxflags>-Wno-missing-braces
<toolset>darwin:<cxxflags>-Wno-missing-braces
<toolset>acc:<cxxflags>+W2068,2461,2236,4070
<toolset>intel:<cxxflags>-Qwd264,239
<toolset>msvc:<warnings>all
<toolset>msvc:<asynch-exceptions>on
<toolset>msvc:<define>_CRT_SECURE_NO_DEPRECATE
<toolset>msvc:<define>_SCL_SECURE_NO_DEPRECATE
<toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
<toolset>msvc:<define>_CRT_SECURE_NO_WARNINGS
<toolset>msvc:<cxxflags>/wd4996
<toolset>msvc:<cxxflags>/wd4512
<toolset>msvc:<cxxflags>/wd4610
<toolset>msvc:<cxxflags>/wd4510
<toolset>msvc:<cxxflags>/wd4127
<toolset>msvc:<cxxflags>/wd4701
<toolset>msvc:<cxxflags>/wd4127
<toolset>msvc:<cxxflags>/wd4305
;
run bounded_buffer_comparison.cpp ../../timer/build//boost_timer ;
run circular_buffer_iter_example.cpp ;
run circular_buffer_sum_example.cpp ;
run circular_buffer_bound_example.cpp ../../thread/build//boost_thread ../../timer/build//boost_timer ;
@@ -0,0 +1,65 @@
// Circular buffer library header file.
// Copyright (c) 2003-2008 Jan Gaspar
// 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)
// See www.boost.org/libs/circular_buffer for documentation.
/*! @file
Includes <boost/circular_buffer/base.hpp>
*/
#if !defined(BOOST_CIRCULAR_BUFFER_HPP)
#define BOOST_CIRCULAR_BUFFER_HPP
#if defined(_MSC_VER)
#pragma once
#endif
#include <boost/circular_buffer_fwd.hpp>
#include <boost/config/workaround.hpp>
#include <boost/static_assert.hpp>
/*! Debug support control. */
#if !defined(BOOST_CB_ENABLE_DEBUG)
#define BOOST_CB_ENABLE_DEBUG 0
#endif
/*! INTERNAL ONLY */
#if BOOST_CB_ENABLE_DEBUG
#include <boost/assert.hpp>
#define BOOST_CB_ASSERT(Expr) BOOST_ASSERT(Expr)
#else
#define BOOST_CB_ASSERT(Expr) ((void)0)
#endif
/*! INTERNAL ONLY */
#if BOOST_WORKAROUND(BOOST_BORLANDC, <= 0x0550) || BOOST_WORKAROUND(__MWERKS__, <= 0x2407)
#define BOOST_CB_IS_CONVERTIBLE(Iterator, Type) ((void)0)
#else
#include <iterator>
#include <boost/type_traits/is_convertible.hpp>
#define BOOST_CB_IS_CONVERTIBLE(Iterator, Type) \
BOOST_STATIC_ASSERT((is_convertible<typename std::iterator_traits<Iterator>::value_type, Type>::value))
#endif
/*! INTERNAL ONLY */
#if defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)
#define BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS BOOST_STATIC_ASSERT(false);
#else
#define BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS ((void)0);
#endif
#include <boost/circular_buffer/debug.hpp>
#include <boost/circular_buffer/details.hpp>
#include <boost/circular_buffer/base.hpp>
#include <boost/circular_buffer/space_optimized.hpp>
#undef BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS
#undef BOOST_CB_IS_CONVERTIBLE
#undef BOOST_CB_ASSERT
#endif // #if !defined(BOOST_CIRCULAR_BUFFER_HPP)
@@ -0,0 +1,248 @@
// Debug support for the circular buffer library.
// Copyright (c) 2003-2008 Jan Gaspar
// 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)
#if !defined(BOOST_CIRCULAR_BUFFER_DEBUG_HPP)
#define BOOST_CIRCULAR_BUFFER_DEBUG_HPP
#if defined(_MSC_VER)
#pragma once
#endif
#if BOOST_CB_ENABLE_DEBUG
#include <cstring>
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std {
using ::memset;
}
#endif
#endif // BOOST_CB_ENABLE_DEBUG
namespace boost {
namespace cb_details {
#if BOOST_CB_ENABLE_DEBUG
// The value the uninitialized memory is filled with.
const int UNINITIALIZED = 0xcc;
template <class T>
inline void do_fill_uninitialized_memory(T* data, std::size_t size_in_bytes) BOOST_NOEXCEPT {
std::memset(static_cast<void*>(data), UNINITIALIZED, size_in_bytes);
}
template <class T>
inline void do_fill_uninitialized_memory(T& /*data*/, std::size_t /*size_in_bytes*/) BOOST_NOEXCEPT {
// Do nothing
}
class debug_iterator_registry;
/*!
\class debug_iterator_base
\brief Registers/unregisters iterators into the registry of valid iterators.
This class is intended to be a base class of an iterator.
*/
class debug_iterator_base {
private:
// Members
//! Iterator registry.
mutable const debug_iterator_registry* m_registry;
//! Next iterator in the iterator chain.
mutable const debug_iterator_base* m_next;
public:
// Construction/destruction
//! Default constructor.
debug_iterator_base();
//! Constructor taking the iterator registry as a parameter.
debug_iterator_base(const debug_iterator_registry* registry);
//! Copy constructor.
debug_iterator_base(const debug_iterator_base& rhs);
//! Destructor.
~debug_iterator_base();
// Methods
//! Assign operator.
debug_iterator_base& operator = (const debug_iterator_base& rhs);
//! Is the iterator valid?
bool is_valid(const debug_iterator_registry* registry) const;
//! Invalidate the iterator.
/*!
\note The method is const in order to invalidate const iterators, too.
*/
void invalidate() const;
//! Return the next iterator in the iterator chain.
const debug_iterator_base* next() const;
//! Set the next iterator in the iterator chain.
/*!
\note The method is const in order to set a next iterator to a const iterator, too.
*/
void set_next(const debug_iterator_base* it) const;
private:
// Helpers
//! Register self as a valid iterator.
void register_self();
//! Unregister self from valid iterators.
void unregister_self();
};
/*!
\class debug_iterator_registry
\brief Registry of valid iterators.
This class is intended to be a base class of a container.
*/
class debug_iterator_registry {
//! Pointer to the chain of valid iterators.
mutable const debug_iterator_base* m_iterators;
public:
// Methods
//! Default constructor.
debug_iterator_registry() : m_iterators(0) {}
//! Register an iterator into the list of valid iterators.
/*!
\note The method is const in order to register iterators into const containers, too.
*/
void register_iterator(const debug_iterator_base* it) const {
it->set_next(m_iterators);
m_iterators = it;
}
//! Unregister an iterator from the list of valid iterators.
/*!
\note The method is const in order to unregister iterators from const containers, too.
*/
void unregister_iterator(const debug_iterator_base* it) const {
const debug_iterator_base* previous = 0;
for (const debug_iterator_base* p = m_iterators; p != it; previous = p, p = p->next()) {}
remove(it, previous);
}
//! Invalidate every iterator pointing to the same element as the iterator passed as a parameter.
template <class Iterator>
void invalidate_iterators(const Iterator& it) {
const debug_iterator_base* previous = 0;
for (const debug_iterator_base* p = m_iterators; p != 0; p = p->next()) {
if (((Iterator*)p)->m_it == it.m_it) {
p->invalidate();
remove(p, previous);
continue;
}
previous = p;
}
}
//! Invalidate all iterators except an iterator poining to the same element as the iterator passed as a parameter.
template <class Iterator>
void invalidate_iterators_except(const Iterator& it) {
const debug_iterator_base* previous = 0;
for (const debug_iterator_base* p = m_iterators; p != 0; p = p->next()) {
if (((Iterator*)p)->m_it != it.m_it) {
p->invalidate();
remove(p, previous);
continue;
}
previous = p;
}
}
//! Invalidate all iterators.
void invalidate_all_iterators() {
for (const debug_iterator_base* p = m_iterators; p != 0; p = p->next())
p->invalidate();
m_iterators = 0;
}
private:
// Helpers
//! Remove the current iterator from the iterator chain.
void remove(const debug_iterator_base* current,
const debug_iterator_base* previous) const {
if (previous == 0)
m_iterators = m_iterators->next();
else
previous->set_next(current->next());
}
};
// Implementation of the debug_iterator_base methods.
inline debug_iterator_base::debug_iterator_base() : m_registry(0), m_next(0) {}
inline debug_iterator_base::debug_iterator_base(const debug_iterator_registry* registry)
: m_registry(registry), m_next(0) {
register_self();
}
inline debug_iterator_base::debug_iterator_base(const debug_iterator_base& rhs)
: m_registry(rhs.m_registry), m_next(0) {
register_self();
}
inline debug_iterator_base::~debug_iterator_base() { unregister_self(); }
inline debug_iterator_base& debug_iterator_base::operator = (const debug_iterator_base& rhs) {
if (m_registry == rhs.m_registry)
return *this;
unregister_self();
m_registry = rhs.m_registry;
register_self();
return *this;
}
inline bool debug_iterator_base::is_valid(const debug_iterator_registry* registry) const {
return m_registry == registry;
}
inline void debug_iterator_base::invalidate() const { m_registry = 0; }
inline const debug_iterator_base* debug_iterator_base::next() const { return m_next; }
inline void debug_iterator_base::set_next(const debug_iterator_base* it) const { m_next = it; }
inline void debug_iterator_base::register_self() {
if (m_registry != 0)
m_registry->register_iterator(this);
}
inline void debug_iterator_base::unregister_self() {
if (m_registry != 0)
m_registry->unregister_iterator(this);
}
#endif // #if BOOST_CB_ENABLE_DEBUG
} // namespace cb_details
} // namespace boost
#endif // #if !defined(BOOST_CIRCULAR_BUFFER_DEBUG_HPP)
@@ -0,0 +1,491 @@
// Helper classes and functions for the circular buffer.
// Copyright (c) 2003-2008 Jan Gaspar
// Copyright 2014,2018 Glen Joseph Fernandes
// (glenjofe@gmail.com)
// 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)
#if !defined(BOOST_CIRCULAR_BUFFER_DETAILS_HPP)
#define BOOST_CIRCULAR_BUFFER_DETAILS_HPP
#if defined(_MSC_VER)
#pragma once
#endif
#include <boost/throw_exception.hpp>
#include <boost/core/allocator_access.hpp>
#include <boost/core/pointer_traits.hpp>
#include <boost/move/move.hpp>
#include <boost/type_traits/is_nothrow_move_constructible.hpp>
#include <boost/core/no_exceptions_support.hpp>
#include <iterator>
// Silence MS /W4 warnings like C4913:
// "user defined binary operator ',' exists but no overload could convert all operands, default built-in binary operator ',' used"
// This might happen when previously including some boost headers that overload the coma operator.
#if defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable:4913)
#endif
namespace boost {
namespace cb_details {
template <class Alloc> struct nonconst_traits;
template<class ForwardIterator, class Diff, class T, class Alloc>
void uninitialized_fill_n_with_alloc(
ForwardIterator first, Diff n, const T& item, Alloc& alloc);
template<class InputIterator, class ForwardIterator, class Alloc>
ForwardIterator uninitialized_copy(InputIterator first, InputIterator last, ForwardIterator dest, Alloc& a);
template<class InputIterator, class ForwardIterator, class Alloc>
ForwardIterator uninitialized_move_if_noexcept(InputIterator first, InputIterator last, ForwardIterator dest, Alloc& a);
/*!
\struct const_traits
\brief Defines the data types for a const iterator.
*/
template <class Alloc>
struct const_traits {
// Basic types
typedef typename Alloc::value_type value_type;
typedef typename boost::allocator_const_pointer<Alloc>::type pointer;
typedef const value_type& reference;
typedef typename boost::allocator_size_type<Alloc>::type size_type;
typedef typename boost::allocator_difference_type<Alloc>::type difference_type;
// Non-const traits
typedef nonconst_traits<Alloc> nonconst_self;
};
/*!
\struct nonconst_traits
\brief Defines the data types for a non-const iterator.
*/
template <class Alloc>
struct nonconst_traits {
// Basic types
typedef typename Alloc::value_type value_type;
typedef typename boost::allocator_pointer<Alloc>::type pointer;
typedef value_type& reference;
typedef typename boost::allocator_size_type<Alloc>::type size_type;
typedef typename boost::allocator_difference_type<Alloc>::type difference_type;
// Non-const traits
typedef nonconst_traits<Alloc> nonconst_self;
};
/*!
\struct iterator_wrapper
\brief Helper iterator dereference wrapper.
*/
template <class Iterator>
struct iterator_wrapper {
mutable Iterator m_it;
explicit iterator_wrapper(Iterator it) : m_it(it) {}
Iterator operator () () const { return m_it++; }
private:
iterator_wrapper<Iterator>& operator = (const iterator_wrapper<Iterator>&); // do not generate
};
/*!
\struct item_wrapper
\brief Helper item dereference wrapper.
*/
template <class Pointer, class Value>
struct item_wrapper {
Value m_item;
explicit item_wrapper(Value item) : m_item(item) {}
Pointer operator () () const { return &m_item; }
private:
item_wrapper<Pointer, Value>& operator = (const item_wrapper<Pointer, Value>&); // do not generate
};
/*!
\struct assign_n
\brief Helper functor for assigning n items.
*/
template <class Value, class Alloc>
struct assign_n {
typedef typename boost::allocator_size_type<Alloc>::type size_type;
size_type m_n;
Value m_item;
Alloc& m_alloc;
assign_n(size_type n, Value item, Alloc& alloc) : m_n(n), m_item(item), m_alloc(alloc) {}
template <class Pointer>
void operator () (Pointer p) const {
uninitialized_fill_n_with_alloc(p, m_n, m_item, m_alloc);
}
private:
assign_n<Value, Alloc>& operator = (const assign_n<Value, Alloc>&); // do not generate
};
/*!
\struct assign_range
\brief Helper functor for assigning range of items.
*/
template <class Iterator, class Alloc>
struct assign_range {
Iterator m_first;
Iterator m_last;
Alloc& m_alloc;
assign_range(const Iterator& first, const Iterator& last, Alloc& alloc)
: m_first(first), m_last(last), m_alloc(alloc) {}
template <class Pointer>
void operator () (Pointer p) const {
boost::cb_details::uninitialized_copy(m_first, m_last, p, m_alloc);
}
};
template <class Iterator, class Alloc>
inline assign_range<Iterator, Alloc> make_assign_range(const Iterator& first, const Iterator& last, Alloc& a) {
return assign_range<Iterator, Alloc>(first, last, a);
}
/*!
\class capacity_control
\brief Capacity controller of the space optimized circular buffer.
*/
template <class Size>
class capacity_control {
//! The capacity of the space-optimized circular buffer.
Size m_capacity;
//! The lowest guaranteed or minimum capacity of the adapted space-optimized circular buffer.
Size m_min_capacity;
public:
//! Constructor.
capacity_control(Size buffer_capacity, Size min_buffer_capacity = 0)
: m_capacity(buffer_capacity), m_min_capacity(min_buffer_capacity)
{ // Check for capacity lower than min_capacity.
BOOST_CB_ASSERT(buffer_capacity >= min_buffer_capacity);
}
// Default copy constructor.
// Default assign operator.
//! Get the capacity of the space optimized circular buffer.
Size capacity() const { return m_capacity; }
//! Get the minimal capacity of the space optimized circular buffer.
Size min_capacity() const { return m_min_capacity; }
//! Size operator - returns the capacity of the space optimized circular buffer.
operator Size() const { return m_capacity; }
};
/*!
\struct iterator
\brief Random access iterator for the circular buffer.
\param Buff The type of the underlying circular buffer.
\param Traits Basic iterator types.
\note This iterator is not circular. It was designed
for iterating from begin() to end() of the circular buffer.
*/
template <class Buff, class Traits>
struct iterator
#if BOOST_CB_ENABLE_DEBUG
: public debug_iterator_base
#endif // #if BOOST_CB_ENABLE_DEBUG
{
// Helper types
//! Non-const iterator.
typedef iterator<Buff, typename Traits::nonconst_self> nonconst_self;
// Basic types
typedef std::random_access_iterator_tag iterator_category;
//! The type of the elements stored in the circular buffer.
typedef typename Traits::value_type value_type;
//! Pointer to the element.
typedef typename Traits::pointer pointer;
//! Reference to the element.
typedef typename Traits::reference reference;
//! Size type.
typedef typename Traits::size_type size_type;
//! Difference type.
typedef typename Traits::difference_type difference_type;
// Member variables
//! The circular buffer where the iterator points to.
const Buff* m_buff;
//! An internal iterator.
pointer m_it;
// Construction & assignment
// Default copy constructor.
//! Default constructor.
iterator() : m_buff(0), m_it(0) {}
#if BOOST_CB_ENABLE_DEBUG
//! Copy constructor (used for converting from a non-const to a const iterator).
iterator(const nonconst_self& it) : debug_iterator_base(it), m_buff(it.m_buff), m_it(it.m_it) {}
//! Internal constructor.
/*!
\note This constructor is not intended to be used directly by the user.
*/
iterator(const Buff* cb, const pointer p) : debug_iterator_base(cb), m_buff(cb), m_it(p) {}
#else
iterator(const nonconst_self& it) : m_buff(it.m_buff), m_it(it.m_it) {}
iterator(const Buff* cb, const pointer p) : m_buff(cb), m_it(p) {}
#endif // #if BOOST_CB_ENABLE_DEBUG
//! Assign operator.
#if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS)
iterator& operator=(const iterator&) = default;
#else
iterator& operator=(const iterator& it) {
if (this == &it)
return *this;
#if BOOST_CB_ENABLE_DEBUG
debug_iterator_base::operator =(it);
#endif // #if BOOST_CB_ENABLE_DEBUG
m_buff = it.m_buff;
m_it = it.m_it;
return *this;
}
#endif
// Random access iterator methods
//! Dereferencing operator.
reference operator * () const {
BOOST_CB_ASSERT(is_valid(m_buff)); // check for uninitialized or invalidated iterator
BOOST_CB_ASSERT(m_it != 0); // check for iterator pointing to end()
return *m_it;
}
//! Dereferencing operator.
pointer operator -> () const { return &(operator*()); }
//! Difference operator.
template <class Traits0>
difference_type operator - (const iterator<Buff, Traits0>& it) const {
BOOST_CB_ASSERT(is_valid(m_buff)); // check for uninitialized or invalidated iterator
BOOST_CB_ASSERT(it.is_valid(m_buff)); // check for uninitialized or invalidated iterator
return linearize_pointer(*this) - linearize_pointer(it);
}
//! Increment operator (prefix).
iterator& operator ++ () {
BOOST_CB_ASSERT(is_valid(m_buff)); // check for uninitialized or invalidated iterator
BOOST_CB_ASSERT(m_it != 0); // check for iterator pointing to end()
m_buff->increment(m_it);
if (m_it == m_buff->m_last)
m_it = 0;
return *this;
}
//! Increment operator (postfix).
iterator operator ++ (int) {
iterator<Buff, Traits> tmp = *this;
++*this;
return tmp;
}
//! Decrement operator (prefix).
iterator& operator -- () {
BOOST_CB_ASSERT(is_valid(m_buff)); // check for uninitialized or invalidated iterator
BOOST_CB_ASSERT(m_it != m_buff->m_first); // check for iterator pointing to begin()
if (m_it == 0)
m_it = m_buff->m_last;
m_buff->decrement(m_it);
return *this;
}
//! Decrement operator (postfix).
iterator operator -- (int) {
iterator<Buff, Traits> tmp = *this;
--*this;
return tmp;
}
//! Iterator addition.
iterator& operator += (difference_type n) {
BOOST_CB_ASSERT(is_valid(m_buff)); // check for uninitialized or invalidated iterator
if (n > 0) {
BOOST_CB_ASSERT(m_buff->end() - *this >= n); // check for too large n
m_it = m_buff->add(m_it, n);
if (m_it == m_buff->m_last)
m_it = 0;
} else if (n < 0) {
*this -= -n;
}
return *this;
}
//! Iterator addition.
iterator operator + (difference_type n) const { return iterator<Buff, Traits>(*this) += n; }
//! Iterator subtraction.
iterator& operator -= (difference_type n) {
BOOST_CB_ASSERT(is_valid(m_buff)); // check for uninitialized or invalidated iterator
if (n > 0) {
BOOST_CB_ASSERT(*this - m_buff->begin() >= n); // check for too large n
m_it = m_buff->sub(m_it == 0 ? m_buff->m_last : m_it, n);
} else if (n < 0) {
*this += -n;
}
return *this;
}
//! Iterator subtraction.
iterator operator - (difference_type n) const { return iterator<Buff, Traits>(*this) -= n; }
//! Element access operator.
reference operator [] (difference_type n) const { return *(*this + n); }
// Equality & comparison
//! Equality.
template <class Traits0>
bool operator == (const iterator<Buff, Traits0>& it) const {
BOOST_CB_ASSERT(is_valid(m_buff)); // check for uninitialized or invalidated iterator
BOOST_CB_ASSERT(it.is_valid(m_buff)); // check for uninitialized or invalidated iterator
return m_it == it.m_it;
}
//! Inequality.
template <class Traits0>
bool operator != (const iterator<Buff, Traits0>& it) const {
BOOST_CB_ASSERT(is_valid(m_buff)); // check for uninitialized or invalidated iterator
BOOST_CB_ASSERT(it.is_valid(m_buff)); // check for uninitialized or invalidated iterator
return m_it != it.m_it;
}
//! Less.
template <class Traits0>
bool operator < (const iterator<Buff, Traits0>& it) const {
BOOST_CB_ASSERT(is_valid(m_buff)); // check for uninitialized or invalidated iterator
BOOST_CB_ASSERT(it.is_valid(m_buff)); // check for uninitialized or invalidated iterator
return linearize_pointer(*this) < linearize_pointer(it);
}
//! Greater.
template <class Traits0>
bool operator > (const iterator<Buff, Traits0>& it) const { return it < *this; }
//! Less or equal.
template <class Traits0>
bool operator <= (const iterator<Buff, Traits0>& it) const { return !(it < *this); }
//! Greater or equal.
template <class Traits0>
bool operator >= (const iterator<Buff, Traits0>& it) const { return !(*this < it); }
// Helpers
//! Get a pointer which would point to the same element as the iterator in case the circular buffer is linearized.
template <class Traits0>
typename Traits0::pointer linearize_pointer(const iterator<Buff, Traits0>& it) const {
return it.m_it == 0 ? m_buff->m_buff + m_buff->size() :
(it.m_it < m_buff->m_first ? it.m_it + (m_buff->m_end - m_buff->m_first)
: m_buff->m_buff + (it.m_it - m_buff->m_first));
}
};
//! Iterator addition.
template <class Buff, class Traits>
inline iterator<Buff, Traits>
operator + (typename Traits::difference_type n, const iterator<Buff, Traits>& it) {
return it + n;
}
/*!
\fn ForwardIterator uninitialized_copy(InputIterator first, InputIterator last, ForwardIterator dest)
\brief Equivalent of <code>std::uninitialized_copy</code> but with explicit specification of value type.
*/
template<class InputIterator, class ForwardIterator, class Alloc>
inline ForwardIterator uninitialized_copy(InputIterator first, InputIterator last, ForwardIterator dest, Alloc& a) {
ForwardIterator next = dest;
BOOST_TRY {
for (; first != last; ++first, ++dest)
boost::allocator_construct(a, boost::to_address(dest), *first);
} BOOST_CATCH(...) {
for (; next != dest; ++next)
boost::allocator_destroy(a, boost::to_address(next));
BOOST_RETHROW
}
BOOST_CATCH_END
return dest;
}
template<class InputIterator, class ForwardIterator, class Alloc>
ForwardIterator uninitialized_move_if_noexcept_impl(InputIterator first, InputIterator last, ForwardIterator dest, Alloc& a,
true_type) {
for (; first != last; ++first, ++dest)
boost::allocator_construct(a, boost::to_address(dest), boost::move(*first));
return dest;
}
template<class InputIterator, class ForwardIterator, class Alloc>
ForwardIterator uninitialized_move_if_noexcept_impl(InputIterator first, InputIterator last, ForwardIterator dest, Alloc& a,
false_type) {
return uninitialized_copy(first, last, dest, a);
}
/*!
\fn ForwardIterator uninitialized_move_if_noexcept(InputIterator first, InputIterator last, ForwardIterator dest)
\brief Equivalent of <code>std::uninitialized_copy</code> but with explicit specification of value type and moves elements if they have noexcept move constructors.
*/
template<class InputIterator, class ForwardIterator, class Alloc>
ForwardIterator uninitialized_move_if_noexcept(InputIterator first, InputIterator last, ForwardIterator dest, Alloc& a) {
typedef typename boost::is_nothrow_move_constructible<typename Alloc::value_type>::type tag_t;
return uninitialized_move_if_noexcept_impl(first, last, dest, a, tag_t());
}
/*!
\fn void uninitialized_fill_n_with_alloc(ForwardIterator first, Diff n, const T& item, Alloc& alloc)
\brief Equivalent of <code>std::uninitialized_fill_n</code> with allocator.
*/
template<class ForwardIterator, class Diff, class T, class Alloc>
inline void uninitialized_fill_n_with_alloc(ForwardIterator first, Diff n, const T& item, Alloc& alloc) {
ForwardIterator next = first;
BOOST_TRY {
for (; n > 0; ++first, --n)
boost::allocator_construct(alloc, boost::to_address(first), item);
} BOOST_CATCH(...) {
for (; next != first; ++next)
boost::allocator_destroy(alloc, boost::to_address(next));
BOOST_RETHROW
}
BOOST_CATCH_END
}
} // namespace cb_details
} // namespace boost
#if defined(_MSC_VER)
# pragma warning(pop)
#endif
#endif // #if !defined(BOOST_CIRCULAR_BUFFER_DETAILS_HPP)
@@ -0,0 +1,43 @@
// Forward declaration of the circular buffer and its adaptor.
// Copyright (c) 2003-2008 Jan Gaspar
// 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)
// See www.boost.org/libs/circular_buffer for documentation.
#if !defined(BOOST_CIRCULAR_BUFFER_FWD_HPP)
#define BOOST_CIRCULAR_BUFFER_FWD_HPP
#if defined(_MSC_VER)
#pragma once
#endif
#include <boost/config.hpp>
#if !defined(BOOST_NO_STD_ALLOCATOR)
#include <memory>
#else
#include <vector>
#endif
namespace boost {
#if !defined(BOOST_NO_STD_ALLOCATOR)
#define BOOST_CB_DEFAULT_ALLOCATOR(T) std::allocator<T>
#else
#define BOOST_CB_DEFAULT_ALLOCATOR(T) BOOST_DEDUCED_TYPENAME std::vector<T>::allocator_type
#endif
template <class T, class Alloc = BOOST_CB_DEFAULT_ALLOCATOR(T)>
class circular_buffer;
template <class T, class Alloc = BOOST_CB_DEFAULT_ALLOCATOR(T)>
class circular_buffer_space_optimized;
#undef BOOST_CB_DEFAULT_ALLOCATOR
} // namespace boost
#endif // #if !defined(BOOST_CIRCULAR_BUFFER_FWD_HPP)
@@ -0,0 +1,25 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="refresh" content="0; URL=../../doc/html/circular_buffer.html">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>
Redirection
</title>
</head>
<body>
Automatic redirection failed, please go to
<a href="../../doc/html/circular_buffer.html"> ../../doc/html/circular_buffer.html</a>.
<p>
<small>Copyright © 2003-2008 Jan Gaspar, 2013 Paul A. Bristow</small>
</p>
<p>
<small>Use, modification, and distribution is subject to the Boost Software License, Version 1.0.<br>
(See accompanying file <code>LICENSE_1_0.txt</code> or copy at <a href=
"http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</small>
</p>
</body>
</html>
@@ -0,0 +1,15 @@
{
"key": "circular_buffer",
"name": "Circular Buffer",
"authors": [
"Jan Gaspar"
],
"description": "A STL compliant container also known as ring or cyclic buffer.",
"category": [
"Containers"
],
"maintainers": [
"Jan Gaspar <jano_gaspar -at- yahoo.com>"
],
"cxxstd": "03"
}
@@ -0,0 +1,32 @@
# Boost circular_buffer test Jamfile.
#
# Copyright (c) 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 warning suppression Paul A. Bristow 25 Nov 2008
# Bring in rules for testing.
import testing ;
project
: requirements
<toolset>msvc:<warnings>all
<toolset>msvc:<asynch-exceptions>on
<toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
<toolset>msvc:<cxxflags>/wd4996 # 'function': was declared deprecated
<toolset>msvc:<cxxflags>/wd4244 # conversion from 'int' to 'unsigned short', possible loss of data
# in date-time
;
test-suite "circular_buffer"
: [ run base_test.cpp : : : <threading>single : ]
[ run space_optimized_test.cpp : : : <threading>single : ]
[ run base_test.cpp : : : <threading>single <define>"BOOST_CB_ENABLE_DEBUG=1" : base_test_dbg ]
[ run space_optimized_test.cpp : : : <threading>single <define>"BOOST_CB_ENABLE_DEBUG=1" : space_optimized_test_dbg ]
[ run soft_iterator_invalidation.cpp : : : <threading>single : ]
[ run constant_erase_test.cpp : : : <threading>single : ]
[ compile bounded_buffer_comparison.cpp : <threading>multi : ]
;
@@ -0,0 +1,866 @@
// Test of the base circular buffer container.
// Copyright (c) 2003-2008 Jan Gaspar
// Copyright (c) 2013 Antony Polukhin
// 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)
#include "test.hpp"
#define CB_CONTAINER circular_buffer
#include "common.ipp"
void iterator_constructor_and_assign_test() {
circular_buffer<MyInteger> cb(4, 3);
circular_buffer<MyInteger>::iterator it = cb.begin();
circular_buffer<MyInteger>::const_iterator cit2 = cb.cbegin();
circular_buffer<MyInteger>::iterator itCopy;
itCopy = it;
it = it;
circular_buffer<MyInteger>::const_iterator cit;
cit = it;
circular_buffer<MyInteger>::const_iterator end1 = cb.end();
circular_buffer<MyInteger>::const_iterator end2 = end1;
circular_buffer<MyInteger>::const_iterator end3 = cb.cend();
BOOST_TEST(itCopy == it);
BOOST_TEST(cit == it);
BOOST_TEST(end1 == end2);
BOOST_TEST(it != end1);
BOOST_TEST(cit != end2);
BOOST_TEST(cit2 == it);
BOOST_TEST(end3 == end1);
}
void iterator_reference_test() {
circular_buffer<Dummy> cb(3, Dummy());
circular_buffer<Dummy>::iterator it = cb.begin();
circular_buffer<Dummy>::const_iterator cit = cb.begin() + 1;
BOOST_TEST((*it).m_n == Dummy::eVar);
BOOST_TEST((*it).fnc() == Dummy::eFnc);
BOOST_TEST((*cit).const_fnc() == Dummy::eConst);
BOOST_TEST((*it).virtual_fnc() == Dummy::eVirtual);
BOOST_TEST(it->m_n == Dummy::eVar);
BOOST_TEST(it->fnc() == Dummy::eFnc);
BOOST_TEST(cit->const_fnc() == Dummy::eConst);
BOOST_TEST(it->virtual_fnc() == Dummy::eVirtual);
}
void iterator_difference_test() {
circular_buffer<MyInteger> cb(5, 1);
cb.push_back(2);
circular_buffer<MyInteger>::iterator it1 = cb.begin() + 2;
circular_buffer<MyInteger>::iterator it2 = cb.begin() + 3;
circular_buffer<MyInteger>::const_iterator begin = cb.begin();
circular_buffer<MyInteger>::iterator end = cb.end();
BOOST_TEST(begin - begin == 0);
BOOST_TEST(end - cb.begin() == 5);
BOOST_TEST(end - end == 0);
BOOST_TEST(begin - cb.end() == -5);
BOOST_TEST(it1 - cb.begin() == 2);
BOOST_TEST(it1 - begin == 2);
BOOST_TEST(end - it1 == 3);
BOOST_TEST(it2 - it1 == 1);
BOOST_TEST(it1 - it2 == -1);
BOOST_TEST(it2 - it2 == 0);
}
void iterator_increment_test() {
circular_buffer<MyInteger> cb(10, 1);
cb.push_back(2);
circular_buffer<MyInteger>::iterator it1 = cb.begin();
circular_buffer<MyInteger>::iterator it2 = cb.begin() + 5;
circular_buffer<MyInteger>::iterator it3 = cb.begin() + 9;
it1++;
it2++;
++it3;
BOOST_TEST(it1 == cb.begin() + 1);
BOOST_TEST(it2 == cb.begin() + 6);
BOOST_TEST(it3 == cb.end());
}
void iterator_decrement_test() {
circular_buffer<MyInteger> cb(10, 1);
cb.push_back(2);
circular_buffer<MyInteger>::iterator it1= cb.end();
circular_buffer<MyInteger>::iterator it2= cb.end() - 5;
circular_buffer<MyInteger>::iterator it3= cb.end() - 9;
--it1;
it2--;
--it3;
BOOST_TEST(it1 == cb.end() - 1);
BOOST_TEST(it2 == cb.end() - 6);
BOOST_TEST(it3 == cb.begin());
}
void iterator_addition_test() {
circular_buffer<MyInteger> cb(10, 1);
cb.push_back(2);
cb.push_back(2);
circular_buffer<MyInteger>::iterator it1 = cb.begin() + 2;
circular_buffer<MyInteger>::iterator it2 = cb.end();
circular_buffer<MyInteger>::iterator it3 = cb.begin() + 5;
circular_buffer<MyInteger>::iterator it4 = cb.begin() + 9;
it1 += 3;
it2 += 0;
it3 += 5;
it4 += -2;
BOOST_TEST(it1 == 5 + cb.begin());
BOOST_TEST(it2 == cb.end());
BOOST_TEST(it3 == cb.end());
BOOST_TEST(it4 + 3 == cb.end());
BOOST_TEST((-3) + it4 == cb.begin() + 4);
BOOST_TEST(cb.begin() + 0 == cb.begin());
}
void iterator_subtraction_test() {
circular_buffer<MyInteger> cb(10, 1);
cb.push_back(2);
cb.push_back(2);
cb.push_back(2);
circular_buffer<MyInteger>::iterator it1 = cb.begin();
circular_buffer<MyInteger>::iterator it2 = cb.end();
circular_buffer<MyInteger>::iterator it3 = cb.end() - 5;
circular_buffer<MyInteger>::iterator it4 = cb.begin() + 7;
it1 -= -2;
it2 -= 0;
it3 -= 5;
BOOST_TEST(it1 == cb.begin() + 2);
BOOST_TEST(it2 == cb.end());
BOOST_TEST(it3 == cb.begin());
BOOST_TEST(it4 - 7 == cb.begin());
BOOST_TEST(it4 - (-3) == cb.end());
BOOST_TEST(cb.begin() - 0 == cb.begin());
}
void iterator_element_access_test() {
circular_buffer<MyInteger> cb(10);
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);
cb.push_back(4);
cb.push_back(5);
cb.push_back(6);
circular_buffer<MyInteger>::iterator it = cb.begin() + 1;
BOOST_TEST(it[0] == 2);
BOOST_TEST(it[-1] == 1);
BOOST_TEST(it[2] == 4);
}
void iterator_comparison_test() {
circular_buffer<MyInteger> cb(5, 1);
cb.push_back(2);
circular_buffer<MyInteger>::iterator it = cb.begin() + 2;
circular_buffer<MyInteger>::const_iterator begin = cb.begin();
circular_buffer<MyInteger>::iterator end = cb.end();
BOOST_TEST(begin == begin);
BOOST_TEST(end > cb.begin());
BOOST_TEST(begin < end);
BOOST_TEST(end > begin);
BOOST_TEST(end == end);
BOOST_TEST(begin < cb.end());
BOOST_TEST(!(begin + 1 > cb.end()));
BOOST_TEST(it > cb.begin());
BOOST_TEST(end > it);
BOOST_TEST(begin >= begin);
BOOST_TEST(end >= cb.begin());
BOOST_TEST(end <= end);
BOOST_TEST(begin <= cb.end());
BOOST_TEST(it >= cb.begin());
BOOST_TEST(end >= it);
BOOST_TEST(!(begin + 4 < begin + 4));
BOOST_TEST(begin + 4 < begin + 5);
BOOST_TEST(!(begin + 5 < begin + 4));
BOOST_TEST(it < end - 1);
BOOST_TEST(!(end - 1 < it));
}
void iterator_invalidation_test() {
#if BOOST_CB_ENABLE_DEBUG
circular_buffer<MyInteger>::iterator it1;
circular_buffer<MyInteger>::const_iterator it2;
circular_buffer<MyInteger>::iterator it3;
circular_buffer<MyInteger>::const_iterator it4;
circular_buffer<MyInteger>::const_iterator it5;
circular_buffer<MyInteger>::const_iterator it6;
BOOST_TEST(it1.is_valid(0));
BOOST_TEST(it2.is_valid(0));
BOOST_TEST(it3.is_valid(0));
BOOST_TEST(it4.is_valid(0));
BOOST_TEST(it5.is_valid(0));
BOOST_TEST(it6.is_valid(0));
{
circular_buffer<MyInteger> cb(5, 0);
const circular_buffer<MyInteger> ccb(5, 0);
it1 = cb.begin();
it2 = ccb.begin();
it3 = cb.end();
it4 = it1;
it5 = it2;
it6 = it1;
BOOST_TEST(it1.is_valid(&cb));
BOOST_TEST(it2.is_valid(&ccb));
BOOST_TEST(it3.is_valid(&cb));
BOOST_TEST(it4.is_valid(&cb));
BOOST_TEST(it5.is_valid(&ccb));
BOOST_TEST(it6.is_valid(&cb));
}
BOOST_TEST(it1.is_valid(0));
BOOST_TEST(it2.is_valid(0));
BOOST_TEST(it3.is_valid(0));
BOOST_TEST(it4.is_valid(0));
BOOST_TEST(it5.is_valid(0));
BOOST_TEST(it6.is_valid(0));
circular_buffer<MyInteger> cb(10, 0);
it1 = cb.end();
cb.clear();
BOOST_TEST(it1.is_valid(&cb));
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);
int i = 0;
for (it2 = cb.begin(); it2 != it1; it2++, i++);
BOOST_TEST(i == 3);
circular_buffer<MyInteger> cb1(10, 0);
circular_buffer<MyInteger> cb2(20, 0);
it1 = cb1.end();
it2 = cb2.begin();
BOOST_TEST(it1.is_valid(&cb1));
BOOST_TEST(it2.is_valid(&cb2));
cb1.swap(cb2);
BOOST_TEST(!it1.is_valid(&cb1));
BOOST_TEST(!it2.is_valid(&cb2));
it1 = cb1.begin() + 3;
it2 = cb1.begin();
cb1.push_back(1);
BOOST_TEST(it1.is_valid(&cb1));
BOOST_TEST(!it2.is_valid(&cb1));
BOOST_TEST(*it2.m_it == 1);
circular_buffer<MyInteger> cb3(5);
cb3.push_back(1);
cb3.push_back(2);
cb3.push_back(3);
cb3.push_back(4);
cb3.push_back(5);
it1 = cb3.begin() + 2;
it2 = cb3.begin();
cb3.insert(cb3.begin() + 3, 6);
BOOST_TEST(it1.is_valid(&cb3));
BOOST_TEST(!it2.is_valid(&cb3));
BOOST_TEST(*it2.m_it == 5);
it1 = cb3.begin() + 3;
it2 = cb3.end() - 1;
cb3.push_front(7);
BOOST_TEST(it1.is_valid(&cb3));
BOOST_TEST(!it2.is_valid(&cb3));
BOOST_TEST(*it2.m_it == 7);
circular_buffer<MyInteger> cb4(5);
cb4.push_back(1);
cb4.push_back(2);
cb4.push_back(3);
cb4.push_back(4);
cb4.push_back(5);
it1 = cb4.begin() + 3;
it2 = cb4.begin();
cb4.rinsert(cb4.begin() + 2, 6);
BOOST_TEST(it1.is_valid(&cb4));
BOOST_TEST(!it2.is_valid(&cb4));
BOOST_TEST(*it2.m_it == 2);
it1 = cb1.begin() + 5;
it2 = cb1.end() - 1;
cb1.pop_back();
BOOST_TEST(it1.is_valid(&cb1));
BOOST_TEST(!it2.is_valid(&cb1));
it1 = cb1.begin() + 5;
it2 = cb1.begin();
cb1.pop_front();
BOOST_TEST(it1.is_valid(&cb1));
BOOST_TEST(!it2.is_valid(&cb1));
circular_buffer<MyInteger> cb5(20, 0);
it1 = cb5.begin() + 5;
it2 = it3 = cb5.begin() + 15;
cb5.erase(cb5.begin() + 10);
BOOST_TEST(it1.is_valid(&cb5));
BOOST_TEST(!it2.is_valid(&cb5));
BOOST_TEST(!it3.is_valid(&cb5));
it1 = cb5.begin() + 1;
it2 = it3 = cb5.begin() + 8;
cb5.erase(cb5.begin() + 3, cb5.begin() + 7);
BOOST_TEST(it1.is_valid(&cb5));
BOOST_TEST(!it2.is_valid(&cb5));
BOOST_TEST(!it3.is_valid(&cb5));
circular_buffer<MyInteger> cb6(20, 0);
it4 = it1 = cb6.begin() + 5;
it2 = cb6.begin() + 15;
cb6.rerase(cb6.begin() + 10);
BOOST_TEST(!it1.is_valid(&cb6));
BOOST_TEST(!it4.is_valid(&cb6));
BOOST_TEST(it2.is_valid(&cb6));
it4 = it1 = cb6.begin() + 1;
it2 = cb6.begin() + 8;
cb6.rerase(cb6.begin() + 3, cb6.begin() + 7);
BOOST_TEST(!it1.is_valid(&cb6));
BOOST_TEST(!it4.is_valid(&cb6));
BOOST_TEST(it2.is_valid(&cb6));
circular_buffer<MyInteger> cb7(10, 1);
cb7.push_back(2);
cb7.push_back(3);
cb7.push_back(4);
it1 = cb7.end();
it2 = cb7.begin();
it3 = cb7.begin() + 6;
cb7.linearize();
BOOST_TEST(it1.is_valid(&cb7));
BOOST_TEST(!it2.is_valid(&cb7));
BOOST_TEST(!it3.is_valid(&cb7));
it1 = cb7.end();
it2 = cb7.begin();
it3 = cb7.begin() + 6;
cb7.linearize();
BOOST_TEST(it1.is_valid(&cb7));
BOOST_TEST(it2.is_valid(&cb7));
BOOST_TEST(it3.is_valid(&cb7));
cb7.push_back(5);
cb7.push_back(6);
it1 = cb7.end();
it2 = cb7.begin();
it3 = cb7.begin() + 6;
cb7.set_capacity(10);
BOOST_TEST(it1.is_valid(&cb7));
BOOST_TEST(it2.is_valid(&cb7));
BOOST_TEST(it3.is_valid(&cb7));
cb7.set_capacity(20);
BOOST_TEST(it1.is_valid(&cb7));
BOOST_TEST(!it2.is_valid(&cb7));
BOOST_TEST(!it3.is_valid(&cb7));
cb7.push_back(7);
it1 = cb7.end();
it2 = cb7.begin();
it3 = cb7.begin() + 6;
cb7.set_capacity(10);
BOOST_TEST(it1.is_valid(&cb7));
BOOST_TEST(!it2.is_valid(&cb7));
BOOST_TEST(!it3.is_valid(&cb7));
cb7.push_back(8);
cb7.push_back(9);
it1 = cb7.end();
it2 = cb7.begin();
it3 = cb7.begin() + 6;
cb7.rset_capacity(10);
BOOST_TEST(it1.is_valid(&cb7));
BOOST_TEST(it2.is_valid(&cb7));
BOOST_TEST(it3.is_valid(&cb7));
cb7.rset_capacity(20);
BOOST_TEST(it1.is_valid(&cb7));
BOOST_TEST(!it2.is_valid(&cb7));
BOOST_TEST(!it3.is_valid(&cb7));
cb7.push_back(10);
it1 = cb7.end();
it2 = cb7.begin();
it3 = cb7.begin() + 6;
cb7.rset_capacity(10);
BOOST_TEST(it1.is_valid(&cb7));
BOOST_TEST(!it2.is_valid(&cb7));
BOOST_TEST(!it3.is_valid(&cb7));
circular_buffer<MyInteger> cb8(10, 1);
cb8.push_back(2);
cb8.push_back(3);
it1 = cb8.end();
it2 = cb8.begin();
it3 = cb8.begin() + 6;
cb8.resize(10);
BOOST_TEST(it1.is_valid(&cb8));
BOOST_TEST(it2.is_valid(&cb8));
BOOST_TEST(it3.is_valid(&cb8));
cb8.resize(20);
BOOST_TEST(it1.is_valid(&cb8));
BOOST_TEST(!it2.is_valid(&cb8));
BOOST_TEST(!it3.is_valid(&cb8));
cb8.push_back(4);
it1 = cb8.end();
it2 = cb8.begin();
it3 = cb8.begin() + 6;
it4 = cb8.begin() + 12;
cb8.resize(10);
BOOST_TEST(it1.is_valid(&cb8));
BOOST_TEST(it2.is_valid(&cb8));
BOOST_TEST(it3.is_valid(&cb8));
BOOST_TEST(!it4.is_valid(&cb8));
cb8.set_capacity(10);
cb8.push_back(5);
cb8.push_back(6);
it1 = cb8.end();
it2 = cb8.begin();
it3 = cb8.begin() + 6;
cb8.rresize(10);
BOOST_TEST(it1.is_valid(&cb8));
BOOST_TEST(it2.is_valid(&cb8));
BOOST_TEST(it3.is_valid(&cb8));
cb8.rresize(20);
BOOST_TEST(it1.is_valid(&cb8));
BOOST_TEST(!it2.is_valid(&cb8));
BOOST_TEST(!it3.is_valid(&cb8));
cb8.push_back(7);
it1 = cb8.end();
it2 = cb8.begin();
it3 = cb8.begin() + 6;
it4 = cb8.begin() + 12;
cb8.rresize(10);
BOOST_TEST(it1.is_valid(&cb8));
BOOST_TEST(!it2.is_valid(&cb8));
BOOST_TEST(!it3.is_valid(&cb8));
BOOST_TEST(it4.is_valid(&cb8));
circular_buffer<MyInteger> cb9(15, 1);
it1 = cb9.end();
it2 = cb9.begin();
it3 = cb9.begin() + 6;
it4 = cb9.begin() + 12;
cb9 = cb8;
BOOST_TEST(it1.is_valid(&cb9));
BOOST_TEST(!it2.is_valid(&cb9));
BOOST_TEST(!it3.is_valid(&cb9));
BOOST_TEST(!it4.is_valid(&cb9));
circular_buffer<MyInteger> cb10(10, 1);
it1 = cb10.end();
it2 = cb10.begin();
it3 = cb10.begin() + 3;
it4 = cb10.begin() + 7;
cb10.assign(5, 2);
BOOST_TEST(it1.is_valid(&cb10));
BOOST_TEST(!it2.is_valid(&cb10));
BOOST_TEST(!it3.is_valid(&cb10));
BOOST_TEST(!it4.is_valid(&cb10));
circular_buffer<MyInteger> cb11(10, 1);
it1 = cb11.end();
it2 = cb11.begin();
it3 = cb11.begin() + 3;
it4 = cb11.begin() + 7;
cb11.assign(15, 5, 2);
BOOST_TEST(it1.is_valid(&cb11));
BOOST_TEST(!it2.is_valid(&cb11));
BOOST_TEST(!it3.is_valid(&cb11));
BOOST_TEST(!it4.is_valid(&cb11));
circular_buffer<MyInteger> cb12(10, 1);
it1 = cb12.end();
it2 = cb12.begin();
it3 = cb12.begin() + 3;
it4 = cb12.begin() + 7;
cb12.assign(cb11.begin(), cb11.end());
BOOST_TEST(it1.is_valid(&cb12));
BOOST_TEST(!it2.is_valid(&cb12));
BOOST_TEST(!it3.is_valid(&cb12));
BOOST_TEST(!it4.is_valid(&cb12));
circular_buffer<MyInteger> cb13(10, 1);
it1 = cb13.end();
it2 = cb13.begin();
it3 = cb13.begin() + 3;
it4 = cb13.begin() + 7;
cb13.assign(15, cb11.begin(), cb11.end());
BOOST_TEST(it1.is_valid(&cb13));
BOOST_TEST(!it2.is_valid(&cb13));
BOOST_TEST(!it3.is_valid(&cb13));
BOOST_TEST(!it4.is_valid(&cb13));
circular_buffer<MyInteger> cb14(10);
cb14.push_back(1);
cb14.push_back(2);
cb14.push_back(3);
cb14.push_back(4);
cb14.push_back(5);
cb14.push_back(6);
cb14.push_back(7);
it1 = cb14.end();
it2 = cb14.begin() + 2;
it3 = cb14.begin() + 1;
it4 = cb14.begin() + 5;
cb14.rotate(it2);
BOOST_TEST(it1.is_valid(&cb14));
BOOST_TEST(it2.is_valid(&cb14));
BOOST_TEST(!it3.is_valid(&cb14));
BOOST_TEST(it4.is_valid(&cb14));
circular_buffer<MyInteger> cb15(7);
cb15.push_back(1);
cb15.push_back(2);
cb15.push_back(3);
cb15.push_back(4);
cb15.push_back(5);
cb15.push_back(6);
cb15.push_back(7);
cb15.push_back(8);
cb15.push_back(9);
it1 = cb15.end();
it2 = cb15.begin() + 2;
it3 = cb15.begin() + 1;
it4 = cb15.begin() + 5;
cb15.rotate(it3);
BOOST_TEST(it1.is_valid(&cb15));
BOOST_TEST(it2.is_valid(&cb15));
BOOST_TEST(it3.is_valid(&cb15));
BOOST_TEST(it4.is_valid(&cb15));
circular_buffer<MyInteger> cb16(10);
cb16.push_back(1);
cb16.push_back(2);
cb16.push_back(3);
cb16.push_back(4);
cb16.push_back(5);
cb16.push_back(6);
cb16.push_back(7);
it1 = cb16.end();
it2 = cb16.begin() + 6;
it3 = cb16.begin();
it4 = cb16.begin() + 5;
cb16.rotate(it4);
BOOST_TEST(it1.is_valid(&cb16));
BOOST_TEST(!it2.is_valid(&cb16));
BOOST_TEST(it3.is_valid(&cb16));
BOOST_TEST(!it4.is_valid(&cb16));
#endif // #if BOOST_CB_ENABLE_DEBUG
}
// basic exception safety test (it is useful to use any memory-leak detection tool)
void exception_safety_test() {
#if !defined(BOOST_NO_EXCEPTIONS)
circular_buffer<MyInteger> cb1(3, 5);
MyInteger::set_exception_trigger(3);
BOOST_TEST_THROWS(cb1.set_capacity(5), std::exception);
BOOST_TEST(cb1.capacity() == 3);
MyInteger::set_exception_trigger(3);
BOOST_TEST_THROWS(cb1.rset_capacity(5), std::exception);
BOOST_TEST(cb1.capacity() == 3);
generic_test(cb1);
MyInteger::set_exception_trigger(3);
BOOST_TEST_THROWS(circular_buffer<MyInteger> cb2(5, 10), std::exception);
circular_buffer<MyInteger> cb3(5, 10);
MyInteger::set_exception_trigger(3);
BOOST_TEST_THROWS(circular_buffer<MyInteger> cb4(cb3), std::exception);
vector<MyInteger> v(5, MyInteger(10));
MyInteger::set_exception_trigger(3);
BOOST_TEST_THROWS(circular_buffer<MyInteger> cb5(8, v.begin(), v.end()), std::exception);
circular_buffer<MyInteger> cb6(5, 10);
circular_buffer<MyInteger> cb7(8, 3);
MyInteger::set_exception_trigger(3);
BOOST_TEST_THROWS(cb7 = cb6, std::exception);
BOOST_TEST(cb7.size() == 8);
BOOST_TEST(cb7.capacity() == 8);
BOOST_TEST(cb7[0] == 3);
BOOST_TEST(cb7[7] == 3);
generic_test(cb7);
circular_buffer<MyInteger> cb8(5, 10);
MyInteger::set_exception_trigger(2);
BOOST_TEST_THROWS(cb8.push_front(1), std::exception);
circular_buffer<MyInteger> cb9(5);
cb9.push_back(1);
cb9.push_back(2);
cb9.push_back(3);
MyInteger::set_exception_trigger(3);
BOOST_TEST_THROWS(cb9.insert(cb9.begin() + 1, 4), std::exception);
circular_buffer<MyInteger> cb10(5);
cb10.push_back(1);
cb10.push_back(2);
cb10.push_back(3);
MyInteger::set_exception_trigger(3);
BOOST_TEST_THROWS(cb10.rinsert(cb10.begin() + 1, 4), std::exception);
circular_buffer<MyInteger> cb11(5);
cb11.push_back(1);
cb11.push_back(2);
MyInteger::set_exception_trigger(2);
BOOST_TEST_THROWS(cb11.rinsert(cb11.begin(), 1), std::exception);
circular_buffer<MyInteger> cb12(5, 1);
MyInteger::set_exception_trigger(3);
BOOST_TEST_THROWS(cb12.assign(4, 2), std::exception);
circular_buffer<MyInteger> cb13(5, 1);
MyInteger::set_exception_trigger(3);
BOOST_TEST_THROWS(cb13.assign(6, 2), std::exception);
circular_buffer<MyInteger> cb14(5);
cb14.push_back(1);
cb14.push_back(2);
MyInteger::set_exception_trigger(3);
BOOST_TEST_THROWS(cb14.insert(cb14.begin(), 10, 3), std::exception);
circular_buffer<MyInteger> cb15(5);
cb15.push_back(1);
cb15.push_back(2);
MyInteger::set_exception_trigger(3);
BOOST_TEST_THROWS(cb15.insert(cb15.end(), 10, 3), std::exception);
circular_buffer<MyInteger> cb16(5);
cb16.push_back(1);
cb16.push_back(2);
MyInteger::set_exception_trigger(3);
BOOST_TEST_THROWS(cb16.rinsert(cb16.begin(), 10, 3), std::exception);
circular_buffer<MyInteger> cb17(5);
cb17.push_back(1);
cb17.push_back(2);
MyInteger::set_exception_trigger(3);
BOOST_TEST_THROWS(cb17.rinsert(cb17.end(), 10, 3), std::exception);
circular_buffer<MyInteger> cb18(5, 0);
cb18.push_back(1);
cb18.push_back(2);
cb18.pop_front();
MyInteger::set_exception_trigger(4);
BOOST_TEST_THROWS(cb18.linearize(), std::exception);
circular_buffer<MyInteger> cb19(5, 0);
cb19.push_back(1);
cb19.push_back(2);
MyInteger::set_exception_trigger(5);
BOOST_TEST_THROWS(cb19.linearize(), std::exception);
circular_buffer<MyInteger> cb20(5, 0);
cb20.push_back(1);
cb20.push_back(2);
MyInteger::set_exception_trigger(6);
BOOST_TEST_THROWS(cb20.linearize(), std::exception);
circular_buffer<MyInteger> cb21(5);
cb21.push_back(1);
cb21.push_back(2);
cb21.push_back(3);
MyInteger::set_exception_trigger(2);
BOOST_TEST_THROWS(cb21.insert(cb21.begin() + 1, 4), std::exception);
circular_buffer<MyInteger> cb22(5);
cb22.push_back(1);
cb22.push_back(2);
cb22.push_back(3);
MyInteger::set_exception_trigger(2);
BOOST_TEST_THROWS(cb22.insert(cb22.end(), 4), std::exception);
circular_buffer<MyInteger> cb23(5, 0);
MyInteger::set_exception_trigger(2);
BOOST_TEST_THROWS(cb23.insert(cb23.begin() + 1, 4), std::exception);
circular_buffer<MyInteger> cb24(5);
cb24.push_back(1);
cb24.push_back(2);
cb24.push_back(3);
MyInteger::set_exception_trigger(2);
BOOST_TEST_THROWS(cb24.rinsert(cb24.begin() + 1, 4), std::exception);
circular_buffer<MyInteger> cb25(5, 0);
MyInteger::set_exception_trigger(2);
BOOST_TEST_THROWS(cb25.rinsert(cb25.begin() + 3, 4), std::exception);
circular_buffer<MyInteger> cb26(5);
cb26.push_back(1);
cb26.push_back(2);
MyInteger::set_exception_trigger(5);
BOOST_TEST_THROWS(cb26.insert(cb26.begin(), 10, 3), std::exception);
circular_buffer<MyInteger> cb27(5);
cb27.push_back(1);
cb27.push_back(2);
MyInteger::set_exception_trigger(5);
BOOST_TEST_THROWS(cb27.insert(cb27.end(), 10, 3), std::exception);
circular_buffer<MyInteger> cb28(5);
cb28.push_back(1);
cb28.push_back(2);
MyInteger::set_exception_trigger(5);
BOOST_TEST_THROWS(cb28.rinsert(cb28.begin(), 10, 3), std::exception);
circular_buffer<MyInteger> cb29(5);
cb29.push_back(1);
cb29.push_back(2);
MyInteger::set_exception_trigger(5);
BOOST_TEST_THROWS(cb29.rinsert(cb29.end(), 10, 3), std::exception);
circular_buffer<MyInteger> cb30(10);
cb30.push_back(1);
cb30.push_back(2);
cb30.push_back(3);
MyInteger::set_exception_trigger(2);
BOOST_TEST_THROWS(cb30.rinsert(cb30.begin(), 10, 3), std::exception);
#endif // #if !defined(BOOST_NO_EXCEPTIONS)
}
void move_container_values_except() {
move_container_values_impl<noncopyable_movable_except_t>();
}
template <class T>
void move_container_values_resetting_impl() {
typedef T noncopyable_movable_test_t;
CB_CONTAINER<noncopyable_movable_test_t> cb1(1);
noncopyable_movable_test_t var;
cb1.push_back();
cb1.push_back(boost::move(var));
BOOST_TEST(!cb1.back().is_moved());
BOOST_TEST(var.is_moved());
BOOST_TEST(cb1.size() == 1);
var = boost::move(cb1.back());
BOOST_TEST(cb1.back().is_moved());
cb1.push_front(boost::move(var));
BOOST_TEST(!cb1.front().is_moved());
BOOST_TEST(var.is_moved());
BOOST_TEST(cb1.size() == 1);
var = boost::move(cb1.back());
BOOST_TEST(cb1.back().is_moved());
cb1.push_back();
BOOST_TEST(!cb1.back().is_moved());
BOOST_TEST(cb1.size() == 1);
var = boost::move(cb1.back());
BOOST_TEST(cb1.back().is_moved());
cb1.push_front();
BOOST_TEST(!cb1.front().is_moved());
BOOST_TEST(cb1.size() == 1);
var = boost::move(cb1.back());
BOOST_TEST(cb1.back().is_moved());
cb1.insert(cb1.begin());
// If the circular_buffer is full and the pos points to begin(),
// then the item will not be inserted.
BOOST_TEST(cb1.front().is_moved());
BOOST_TEST(cb1.size() == 1);
var = boost::move(cb1.back());
BOOST_TEST(cb1.back().is_moved());
cb1.insert(cb1.begin(), boost::move(var));
// If the circular_buffer is full and the pos points to begin(),
// then the item will not be inserted.
BOOST_TEST(cb1.front().is_moved());
BOOST_TEST(cb1.size() == 1);
var = boost::move(cb1.back());
BOOST_TEST(cb1.back().is_moved());
cb1.rinsert(cb1.begin());
BOOST_TEST(!cb1.back().is_moved());
BOOST_TEST(cb1.size() == 1);
var = boost::move(cb1.back());
BOOST_TEST(cb1.back().is_moved());
var.reinit();
cb1.rinsert(cb1.begin(), boost::move(var));
BOOST_TEST(!cb1.back().is_moved());
BOOST_TEST(cb1.size() == 1);
var = boost::move(cb1.back());
BOOST_TEST(cb1.back().is_moved());
cb1.rinsert(cb1.end());
BOOST_TEST(cb1.back().is_moved());
BOOST_TEST(cb1.size() == 1);
var = boost::move(cb1.back());
BOOST_TEST(cb1.back().is_moved());
var.reinit();
cb1.rinsert(cb1.end(), boost::move(var));
BOOST_TEST(cb1.back().is_moved());
BOOST_TEST(cb1.size() == 1);
var = boost::move(cb1.back());
BOOST_TEST(cb1.back().is_moved());
cb1.push_back();
BOOST_TEST(!cb1[0].is_moved());
const int val = cb1[0].value();
cb1.linearize();
BOOST_TEST(!cb1[0].is_moved());
BOOST_TEST(cb1[0].value() == val);
cb1.rotate(cb1.begin());
BOOST_TEST(!cb1[0].is_moved());
BOOST_TEST(cb1[0].value() == val);
}
void move_container_values_resetting_except() {
move_container_values_resetting_impl<noncopyable_movable_except_t>();
}
void move_container_values_resetting_noexcept() {
move_container_values_resetting_impl<noncopyable_movable_noexcept_t>();
}
// test main
int main()
{
run_common_tests();
iterator_constructor_and_assign_test();
iterator_reference_test();
iterator_difference_test();
iterator_increment_test();
iterator_decrement_test();
iterator_addition_test();
iterator_subtraction_test();
iterator_element_access_test();
iterator_comparison_test();
iterator_invalidation_test();
exception_safety_test();
move_container_values_except();
move_container_values_resetting_except();
move_container_values_resetting_noexcept();
return boost::report_errors();
}
@@ -0,0 +1,316 @@
// Comparison of bounded buffers based on different containers.
// Copyright (c) 2003-2008 Jan Gaspar
// Copyright 2013 Paul A. Bristow. Added some Quickbook snippet markers.
// 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)
#include <boost/circular_buffer.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition_variable.hpp>
#include <boost/thread/thread.hpp>
#include <boost/timer/timer.hpp>
#include <boost/call_traits.hpp>
#include <boost/bind.hpp>
#include <deque>
#include <list>
#include <string>
#include <iostream>
const unsigned long QUEUE_SIZE = 1000L;
const unsigned long TOTAL_ELEMENTS = QUEUE_SIZE * 1000L;
template <class T>
class bounded_buffer {
public:
typedef boost::circular_buffer<T> container_type;
typedef typename container_type::size_type size_type;
typedef typename container_type::value_type value_type;
typedef typename boost::call_traits<value_type>::param_type param_type;
explicit bounded_buffer(size_type capacity) : m_unread(0), m_container(capacity) {}
void push_front(param_type item) {
boost::unique_lock<boost::mutex> lock(m_mutex);
m_not_full.wait(lock, boost::bind(&bounded_buffer<value_type>::is_not_full, this));
m_container.push_front(item);
++m_unread;
lock.unlock();
m_not_empty.notify_one();
}
void pop_back(value_type* pItem) {
boost::unique_lock<boost::mutex> lock(m_mutex);
m_not_empty.wait(lock, boost::bind(&bounded_buffer<value_type>::is_not_empty, this));
*pItem = m_container[--m_unread];
lock.unlock();
m_not_full.notify_one();
}
private:
bounded_buffer(const bounded_buffer&); // Disabled copy constructor
bounded_buffer& operator = (const bounded_buffer&); // Disabled assign operator
bool is_not_empty() const { return m_unread > 0; }
bool is_not_full() const { return m_unread < m_container.capacity(); }
size_type m_unread;
container_type m_container;
boost::mutex m_mutex;
boost::condition_variable m_not_empty;
boost::condition_variable m_not_full;
};
template <class T>
class bounded_buffer_space_optimized {
public:
typedef boost::circular_buffer_space_optimized<T> container_type;
typedef typename container_type::size_type size_type;
typedef typename container_type::value_type value_type;
typedef typename boost::call_traits<value_type>::param_type param_type;
explicit bounded_buffer_space_optimized(size_type capacity) : m_container(capacity) {}
void push_front(param_type item) {
boost::unique_lock<boost::mutex> lock(m_mutex);
m_not_full.wait(lock, boost::bind(&bounded_buffer_space_optimized<value_type>::is_not_full, this));
m_container.push_front(item);
lock.unlock();
m_not_empty.notify_one();
}
void pop_back(value_type* pItem) {
boost::unique_lock<boost::mutex> lock(m_mutex);
m_not_empty.wait(lock, boost::bind(&bounded_buffer_space_optimized<value_type>::is_not_empty, this));
*pItem = m_container.back();
m_container.pop_back();
lock.unlock();
m_not_full.notify_one();
}
private:
bounded_buffer_space_optimized(const bounded_buffer_space_optimized&); // Disabled copy constructor
bounded_buffer_space_optimized& operator = (const bounded_buffer_space_optimized&); // Disabled assign operator
bool is_not_empty() const { return m_container.size() > 0; }
bool is_not_full() const { return m_container.size() < m_container.capacity(); }
container_type m_container;
boost::mutex m_mutex;
boost::condition_variable m_not_empty;
boost::condition_variable m_not_full;
};
template <class T>
class bounded_buffer_deque_based {
public:
typedef std::deque<T> container_type;
typedef typename container_type::size_type size_type;
typedef typename container_type::value_type value_type;
typedef typename boost::call_traits<value_type>::param_type param_type;
explicit bounded_buffer_deque_based(size_type capacity) : m_capacity(capacity) {}
void push_front(param_type item) {
boost::unique_lock<boost::mutex> lock(m_mutex);
m_not_full.wait(lock, boost::bind(&bounded_buffer_deque_based<value_type>::is_not_full, this));
m_container.push_front(item);
lock.unlock();
m_not_empty.notify_one();
}
void pop_back(value_type* pItem) {
boost::unique_lock<boost::mutex> lock(m_mutex);
m_not_empty.wait(lock, boost::bind(&bounded_buffer_deque_based<value_type>::is_not_empty, this));
*pItem = m_container.back();
m_container.pop_back();
lock.unlock();
m_not_full.notify_one();
}
private:
bounded_buffer_deque_based(const bounded_buffer_deque_based&); // Disabled copy constructor
bounded_buffer_deque_based& operator = (const bounded_buffer_deque_based&); // Disabled assign operator
bool is_not_empty() const { return m_container.size() > 0; }
bool is_not_full() const { return m_container.size() < m_capacity; }
const size_type m_capacity;
container_type m_container;
boost::mutex m_mutex;
boost::condition_variable m_not_empty;
boost::condition_variable m_not_full;
};
template <class T>
class bounded_buffer_list_based {
public:
typedef std::list<T> container_type;
typedef typename container_type::size_type size_type;
typedef typename container_type::value_type value_type;
typedef typename boost::call_traits<value_type>::param_type param_type;
explicit bounded_buffer_list_based(size_type capacity) : m_capacity(capacity) {}
void push_front(param_type item) {
boost::unique_lock<boost::mutex> lock(m_mutex);
m_not_full.wait(lock, boost::bind(&bounded_buffer_list_based<value_type>::is_not_full, this));
m_container.push_front(item);
lock.unlock();
m_not_empty.notify_one();
}
void pop_back(value_type* pItem) {
boost::unique_lock<boost::mutex> lock(m_mutex);
m_not_empty.wait(lock, boost::bind(&bounded_buffer_list_based<value_type>::is_not_empty, this));
*pItem = m_container.back();
m_container.pop_back();
lock.unlock();
m_not_full.notify_one();
}
private:
bounded_buffer_list_based(const bounded_buffer_list_based&); // Disabled copy constructor
bounded_buffer_list_based& operator = (const bounded_buffer_list_based&); // Disabled assign operator
bool is_not_empty() const { return m_container.size() > 0; }
bool is_not_full() const { return m_container.size() < m_capacity; }
const size_type m_capacity;
container_type m_container;
boost::mutex m_mutex;
boost::condition_variable m_not_empty;
boost::condition_variable m_not_full;
};
template<class Buffer>
class Consumer {
typedef typename Buffer::value_type value_type;
Buffer* m_container;
value_type m_item;
public:
Consumer(Buffer* buffer) : m_container(buffer) {}
void operator()() {
for (unsigned long i = 0L; i < TOTAL_ELEMENTS; ++i) {
m_container->pop_back(&m_item);
}
}
};
template<class Buffer>
class Producer {
typedef typename Buffer::value_type value_type;
Buffer* m_container;
public:
Producer(Buffer* buffer) : m_container(buffer) {}
void operator()() {
for (unsigned long i = 0L; i < TOTAL_ELEMENTS; ++i) {
m_container->push_front(value_type());
}
}
};
template<class Buffer>
void fifo_test(Buffer* buffer) {
// Start of measurement
boost::timer::auto_cpu_timer progress;
// Initialize the buffer with some values before launching producer and consumer threads.
for (unsigned long i = QUEUE_SIZE / 2L; i > 0; --i) {
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x581))
buffer->push_front(Buffer::value_type());
#else
buffer->push_front(BOOST_DEDUCED_TYPENAME Buffer::value_type());
#endif
}
Consumer<Buffer> consumer(buffer);
Producer<Buffer> producer(buffer);
// Start the threads.
boost::thread consume(consumer);
boost::thread produce(producer);
// Wait for completion.
consume.join();
produce.join();
// End of measurement
}
int main(int /*argc*/, char* /*argv*/[]) {
bounded_buffer<int> bb_int(QUEUE_SIZE);
std::cout << "bounded_buffer<int> ";
fifo_test(&bb_int);
bounded_buffer_space_optimized<int> bb_space_optimized_int(QUEUE_SIZE);
std::cout << "bounded_buffer_space_optimized<int> ";
fifo_test(&bb_space_optimized_int);
bounded_buffer_deque_based<int> bb_deque_based_int(QUEUE_SIZE);
std::cout << "bounded_buffer_deque_based<int> ";
fifo_test(&bb_deque_based_int);
bounded_buffer_list_based<int> bb_list_based_int(QUEUE_SIZE);
std::cout << "bounded_buffer_list_based<int> ";
fifo_test(&bb_list_based_int);
bounded_buffer<std::string> bb_string(QUEUE_SIZE);
std::cout << "bounded_buffer<std::string> ";
fifo_test(&bb_string);
bounded_buffer_space_optimized<std::string> bb_space_optimized_string(QUEUE_SIZE);
std::cout << "bounded_buffer_space_optimized<std::string> ";
fifo_test(&bb_space_optimized_string);
bounded_buffer_deque_based<std::string> bb_deque_based_string(QUEUE_SIZE);
std::cout << "bounded_buffer_deque_based<std::string> ";
fifo_test(&bb_deque_based_string);
bounded_buffer_list_based<std::string> bb_list_based_string(QUEUE_SIZE);
std::cout << "bounded_buffer_list_based<std::string> ";
fifo_test(&bb_list_based_string);
return 0;
}
/*
//[bounded_buffer_comparison_output
Description: Autorun "J:\Cpp\Misc\Debug\bounded_buffer_comparison.exe"
bounded_buffer<int> 5.15 s
bounded_buffer_space_optimized<int> 5.71 s
bounded_buffer_deque_based<int> 15.57 s
bounded_buffer_list_based<int> 17.33 s
bounded_buffer<std::string> 24.49 s
bounded_buffer_space_optimized<std::string> 28.33 s
bounded_buffer_deque_based<std::string> 29.45 s
bounded_buffer_list_based<std::string> 31.29 s
//] //[bounded_buffer_comparison_output]
*/
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,182 @@
// Special tests for erase_begin, erase_end and clear methods.
// Copyright (c) 2009 Jan Gaspar
// 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)
#include "test.hpp"
int MyInteger::ms_exception_trigger = 0;
int InstanceCounter::ms_count = 0;
void erase_begin_test() {
circular_buffer<int> cb1(5);
cb1.push_back(1);
cb1.push_back(2);
cb1.push_back(3);
cb1.push_back(4);
cb1.push_back(5);
cb1.push_back(6);
circular_buffer<int>::pointer p = &cb1[0];
cb1.erase_begin(2);
BOOST_TEST(cb1.size() == 3);
BOOST_TEST(cb1[0] == 4);
BOOST_TEST(cb1[1] == 5);
BOOST_TEST(cb1[2] == 6);
cb1.erase_begin(3);
BOOST_TEST(cb1.empty());
BOOST_TEST(*p == 2);
BOOST_TEST(*(p + 1) == 3);
BOOST_TEST(*(p + 2) == 4);
cb1.push_back(10);
cb1.push_back(11);
cb1.push_back(12);
BOOST_TEST(cb1.size() == 3);
BOOST_TEST(cb1[0] == 10);
BOOST_TEST(cb1[1] == 11);
BOOST_TEST(cb1[2] == 12);
circular_buffer<InstanceCounter> cb2(5, InstanceCounter());
BOOST_TEST(cb2.size() == 5);
BOOST_TEST(InstanceCounter::count() == 5);
cb2.erase_begin(2);
BOOST_TEST(cb2.size() == 3);
BOOST_TEST(InstanceCounter::count() == 3);
circular_buffer<MyInteger> cb3(5);
cb3.push_back(1);
cb3.push_back(2);
cb3.push_back(3);
cb3.push_back(4);
cb3.push_back(5);
cb3.push_back(6);
cb3.erase_begin(2);
BOOST_TEST(cb3.size() == 3);
BOOST_TEST(cb3[0] == 4);
BOOST_TEST(cb3[1] == 5);
BOOST_TEST(cb3[2] == 6);
}
void erase_end_test() {
circular_buffer<int> cb1(5);
cb1.push_back(1);
cb1.push_back(2);
cb1.push_back(3);
cb1.push_back(4);
cb1.push_back(5);
cb1.push_back(6);
circular_buffer<int>::pointer p = &cb1[3];
cb1.erase_end(2);
BOOST_TEST(cb1.size() == 3);
BOOST_TEST(cb1[0] == 2);
BOOST_TEST(cb1[1] == 3);
BOOST_TEST(cb1[2] ==4);
cb1.erase_end(3);
BOOST_TEST(cb1.empty());
BOOST_TEST(*p == 5);
BOOST_TEST(*(p - 1) == 4);
BOOST_TEST(*(p - 2) == 3);
cb1.push_back(10);
cb1.push_back(11);
cb1.push_back(12);
BOOST_TEST(cb1.size() == 3);
BOOST_TEST(cb1[0] == 10);
BOOST_TEST(cb1[1] == 11);
BOOST_TEST(cb1[2] == 12);
circular_buffer<InstanceCounter> cb2(5, InstanceCounter());
BOOST_TEST(cb2.size() == 5);
BOOST_TEST(InstanceCounter::count() == 5);
cb2.erase_end(2);
BOOST_TEST(cb2.size() == 3);
BOOST_TEST(InstanceCounter::count() == 3);
circular_buffer<MyInteger> cb3(5);
cb3.push_back(1);
cb3.push_back(2);
cb3.push_back(3);
cb3.push_back(4);
cb3.push_back(5);
cb3.push_back(6);
cb3.erase_end(2);
BOOST_TEST(cb3.size() == 3);
BOOST_TEST(cb3[0] == 2);
BOOST_TEST(cb3[1] == 3);
BOOST_TEST(cb3[2] == 4);
}
void clear_test() {
circular_buffer<int> cb1(5);
cb1.push_back(1);
cb1.push_back(2);
cb1.push_back(3);
cb1.push_back(4);
cb1.push_back(5);
cb1.push_back(6);
circular_buffer<int>::pointer p = &cb1[0];
cb1.clear();
BOOST_TEST(cb1.empty());
BOOST_TEST(*p == 2);
BOOST_TEST(*(p + 1) == 3);
BOOST_TEST(*(p + 2) == 4);
BOOST_TEST(*(p + 3) == 5);
BOOST_TEST(*(p - 1) == 6);
circular_buffer<InstanceCounter> cb2(5, InstanceCounter());
BOOST_TEST(cb2.size() == 5);
BOOST_TEST(InstanceCounter::count() == 5);
cb2.clear();
BOOST_TEST(cb2.empty());
BOOST_TEST(InstanceCounter::count() == 0);
circular_buffer<MyInteger> cb3(5);
cb3.push_back(1);
cb3.push_back(2);
cb3.push_back(3);
cb3.push_back(4);
cb3.push_back(5);
cb3.push_back(6);
cb3.clear();
BOOST_TEST(cb3.empty());
}
// test main
int main()
{
erase_begin_test();
erase_end_test();
clear_test();
return boost::report_errors();
}
@@ -0,0 +1,742 @@
// Demonstration of rules when an iterator is considered to be valid if the soft
// iterator invalidation definition is applied.
// Note: The soft iterator invalidation definition CAN NOT be applied
// to the space optimized circular buffer.
// Copyright (c) 2003-2008 Jan Gaspar
// 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)
#include "test.hpp"
// test of the example (introduced in the documentation)
void validity_example_test() {
circular_buffer<int> cb(3);
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);
circular_buffer<int>::iterator it = cb.begin();
BOOST_TEST(*it == 1);
cb.push_back(4);
BOOST_TEST(*it == 4);
}
void validity_insert_test() {
int array[] = { 1, 2, 3 };
// memory placement: { 1, 2, 3 }
// circular buffer: { 1, 2, 3 }
circular_buffer<int> cb(4, array, array + 3);
// it1 -> 1, it2 -> 2, it3 -> 3
circular_buffer<int>::iterator it1 = cb.begin();
circular_buffer<int>::iterator it2 = cb.begin() + 1;
circular_buffer<int>::iterator it3 = cb.begin() + 2;
cb.insert(cb.begin() + 1, 4);
// memory placement: { 1, 4, 2, 3 }
// circular buffer: { 1, 4, 2, 3 }
BOOST_TEST(*it1 == 1);
BOOST_TEST(*it2 == 4);
BOOST_TEST(*it3 == 2);
BOOST_TEST(cb[0] == 1);
BOOST_TEST(cb[1] == 4);
BOOST_TEST(cb[2] == 2);
BOOST_TEST(cb[3] == 3);
// it4 -> 3
circular_buffer<int>::iterator it4 = it1 + 3;
cb.insert(cb.begin() + 1, 5);
// memory placement: { 3, 5, 4, 2 }
// circular buffer: { 5, 4, 2, 3 }
BOOST_TEST(*it1 == 3);
BOOST_TEST(*it2 == 5);
BOOST_TEST(*it3 == 4);
BOOST_TEST(*it4 == 2);
BOOST_TEST(cb[0] == 5);
BOOST_TEST(cb[1] == 4);
BOOST_TEST(cb[2] == 2);
BOOST_TEST(cb[3] == 3);
}
void validity_insert_n_test() {
// memory placement: { 1, 2, 3 }
// circular buffer: { 1, 2, 3 }
circular_buffer<int> cb(5);
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);
// it1 -> 1, it2 -> 2, it3 -> 3
circular_buffer<int>::iterator it1 = cb.begin();
circular_buffer<int>::iterator it2 = cb.begin() + 1;
circular_buffer<int>::iterator it3 = cb.begin() + 2;
cb.insert(cb.begin() + 1, 2, 4);
// memory placement: { 1, 4, 4, 2, 3 }
// circular buffer: { 1, 4, 4, 2, 3 }
BOOST_TEST(*it1 == 1);
BOOST_TEST(*it2 == 4);
BOOST_TEST(*it3 == 4);
BOOST_TEST(cb[0] == 1);
BOOST_TEST(cb[1] == 4);
BOOST_TEST(cb[2] == 4);
BOOST_TEST(cb[3] == 2);
BOOST_TEST(cb[4] == 3);
// it4 -> 2, it5 -> 3
circular_buffer<int>::iterator it4 = it1 + 3;
circular_buffer<int>::iterator it5 = it1 + 4;
cb.insert(cb.begin() + 1, 2, 5);
// memory placement: { 3, 5, 4, 4, 2 } - 5 inserted only once
// circular buffer: { 5, 4, 4, 2, 3 }
BOOST_TEST(*it1 == 3);
BOOST_TEST(*it2 == 5);
BOOST_TEST(*it3 == 4);
BOOST_TEST(*it4 == 4);
BOOST_TEST(*it5 == 2);
BOOST_TEST(cb[0] == 5);
BOOST_TEST(cb[1] == 4);
BOOST_TEST(cb[2] == 4);
BOOST_TEST(cb[3] == 2);
BOOST_TEST(cb[4] == 3);
}
void validity_insert_range_test() {
vector<int> v1;
v1.push_back(4);
v1.push_back(5);
vector<int> v2;
v2.push_back(6);
v2.push_back(7);
// memory placement: { 1, 2, 3 }
// circular buffer: { 1, 2, 3 }
circular_buffer<int> cb1(5);
cb1.push_back(1);
cb1.push_back(2);
cb1.push_back(3);
// it11 -> 1, it12 -> 2, it13 -> 3
circular_buffer<int>::iterator it11 = cb1.begin();
circular_buffer<int>::iterator it12 = cb1.begin() + 1;
circular_buffer<int>::iterator it13 = cb1.begin() + 2;
cb1.insert(cb1.begin() + 1, v1.begin(), v1.end());
// memory placement: { 1, 4, 5, 2, 3 }
// circular buffer: { 1, 4, 5, 2, 3 }
BOOST_TEST(*it11 == 1);
BOOST_TEST(*it12 == 4);
BOOST_TEST(*it13 == 5);
BOOST_TEST(cb1[0] == 1);
BOOST_TEST(cb1[1] == 4);
BOOST_TEST(cb1[2] == 5);
BOOST_TEST(cb1[3] == 2);
BOOST_TEST(cb1[4] == 3);
// it14 -> 2, it15 -> 3
circular_buffer<int>::iterator it14 = it11 + 3;
circular_buffer<int>::iterator it15 = it11 + 4;
cb1.insert(cb1.begin() + 1, v2.begin(), v2.end());
// memory placement: { 3, 7, 4, 5, 2 } - 7 inserted only
// circular buffer: { 7, 4, 5, 2, 3 }
BOOST_TEST(*it11 == 3);
BOOST_TEST(*it12 == 7);
BOOST_TEST(*it13 == 4);
BOOST_TEST(*it14 == 5);
BOOST_TEST(*it15 == 2);
BOOST_TEST(cb1[0] == 7);
BOOST_TEST(cb1[1] == 4);
BOOST_TEST(cb1[2] == 5);
BOOST_TEST(cb1[3] == 2);
BOOST_TEST(cb1[4] == 3);
// memory placement: { 1, 2, 3 }
// circular buffer: { 1, 2, 3 }
circular_buffer<int> cb2(5);
cb2.push_back(1);
cb2.push_back(2);
cb2.push_back(3);
// it21 -> 1, it22 -> 2, it23 -> 3
circular_buffer<int>::iterator it21 = cb2.begin();
circular_buffer<int>::iterator it22 = cb2.begin() + 1;
circular_buffer<int>::iterator it23 = cb2.begin() + 2;
cb2.insert(cb2.begin() + 1, MyInputIterator(v1.begin()), MyInputIterator(v1.end()));
// memory placement: { 1, 4, 5, 2, 3 }
// circular buffer: { 1, 4, 5, 2, 3 }
BOOST_TEST(*it21 == 1);
BOOST_TEST(*it22 == 4);
BOOST_TEST(*it23 == 5);
BOOST_TEST(cb2[0] == 1);
BOOST_TEST(cb2[1] == 4);
BOOST_TEST(cb2[2] == 5);
BOOST_TEST(cb2[3] == 2);
BOOST_TEST(cb2[4] == 3);
// it24 -> 2, it25 -> 3
circular_buffer<int>::iterator it24 = it21 + 3;
circular_buffer<int>::iterator it25 = it21 + 4;
cb2.insert(cb2.begin() + 1, MyInputIterator(v2.begin()), MyInputIterator(v2.end()));
// memory placement: { 2, 3, 7, 4, 5 } - using input iterator inserts all items even if they are later replaced
// circular buffer: { 7, 4, 5, 2, 3 }
BOOST_TEST(*it21 == 2);
BOOST_TEST(*it22 == 3);
BOOST_TEST(*it23 == 7);
BOOST_TEST(*it24 == 4);
BOOST_TEST(*it25 == 5);
BOOST_TEST(cb2[0] == 7);
BOOST_TEST(cb2[1] == 4);
BOOST_TEST(cb2[2] == 5);
BOOST_TEST(cb2[3] == 2);
BOOST_TEST(cb2[4] == 3);
}
void validity_rinsert_test() {
int array[] = { 1, 2, 3 };
// memory placement: { 1, 2, 3 }
// circular buffer: { 1, 2, 3 }
circular_buffer<int> cb(4, array, array + 3);
// it1 -> 1, it2 -> 2, it3 -> 3
circular_buffer<int>::iterator it1 = cb.begin();
circular_buffer<int>::iterator it2 = cb.begin() + 1;
circular_buffer<int>::iterator it3 = cb.begin() + 2;
cb.rinsert(cb.begin() + 2, 4);
// memory placement: { 2, 4, 3, 1 }
// circular buffer: { 1, 2, 4, 3 }
BOOST_TEST(*it1 == 2);
BOOST_TEST(*it2 == 4);
BOOST_TEST(*it3 == 3);
BOOST_TEST(cb[0] == 1);
BOOST_TEST(cb[1] == 2);
BOOST_TEST(cb[2] == 4);
BOOST_TEST(cb[3] == 3);
// it4 -> 1
circular_buffer<int>::iterator it4 = it1 - 1;
cb.rinsert(cb.begin() + 2, 5);
// memory placement: { 5, 4, 1, 2 }
// circular buffer: { 1, 2, 5, 4 }
BOOST_TEST(*it1 == 5);
BOOST_TEST(*it2 == 4);
BOOST_TEST(*it3 == 1);
BOOST_TEST(*it4 == 2);
BOOST_TEST(cb[0] == 1);
BOOST_TEST(cb[1] == 2);
BOOST_TEST(cb[2] == 5);
BOOST_TEST(cb[3] == 4);
}
void validity_rinsert_n_test() {
// memory placement: { 1, 2, 3 }
// circular buffer: { 1, 2, 3 }
circular_buffer<int> cb(5);
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);
// it1 -> 1, it2 -> 2, it3 -> 3
circular_buffer<int>::iterator it1 = cb.begin();
circular_buffer<int>::iterator it2 = cb.begin() + 1;
circular_buffer<int>::iterator it3 = cb.begin() + 2;
cb.rinsert(cb.begin() + 2, 2, 4);
// memory placement: { 4, 4, 3, 1, 2 }
// circular buffer: { 1, 2, 4, 4, 3 }
BOOST_TEST(*it1 == 4);
BOOST_TEST(*it2 == 4);
BOOST_TEST(*it3 == 3);
BOOST_TEST(cb[0] == 1);
BOOST_TEST(cb[1] == 2);
BOOST_TEST(cb[2] == 4);
BOOST_TEST(cb[3] == 4);
BOOST_TEST(cb[4] == 3);
// it4 -> 1, it5 -> 2
circular_buffer<int>::iterator it4 = it1 - 2;
circular_buffer<int>::iterator it5 = it1 - 1;
cb.rinsert(cb.begin() + 4, 2, 5);
// memory placement: { 4, 5, 1, 2, 4 } - 5 inserted only once
// circular buffer: { 1, 2, 4, 4, 5 }
BOOST_TEST(*it1 == 4);
BOOST_TEST(*it2 == 5);
BOOST_TEST(*it3 == 1);
BOOST_TEST(*it4 == 2);
BOOST_TEST(*it5 == 4);
BOOST_TEST(cb[0] == 1);
BOOST_TEST(cb[1] == 2);
BOOST_TEST(cb[2] == 4);
BOOST_TEST(cb[3] == 4);
BOOST_TEST(cb[4] == 5);
}
void validity_rinsert_range_test() {
vector<int> v1;
v1.push_back(4);
v1.push_back(5);
vector<int> v2;
v2.push_back(6);
v2.push_back(7);
// memory placement: { 1, 2, 3 }
// circular buffer: { 1, 2, 3 }
circular_buffer<int> cb1(5);
cb1.push_back(1);
cb1.push_back(2);
cb1.push_back(3);
// it1 -> 1, it2 -> 2, it3 -> 3
circular_buffer<int>::iterator it11 = cb1.begin();
circular_buffer<int>::iterator it12 = cb1.begin() + 1;
circular_buffer<int>::iterator it13 = cb1.begin() + 2;
cb1.rinsert(cb1.begin() + 2, v1.begin(), v1.end());
// memory placement: { 4, 5, 3, 1, 2 }
// circular buffer: { 1, 2, 4, 5, 3 }
BOOST_TEST(*it11 == 4);
BOOST_TEST(*it12 == 5);
BOOST_TEST(*it13 == 3);
BOOST_TEST(cb1[0] == 1);
BOOST_TEST(cb1[1] == 2);
BOOST_TEST(cb1[2] == 4);
BOOST_TEST(cb1[3] == 5);
BOOST_TEST(cb1[4] == 3);
// it14 -> 1, it15 -> 2
circular_buffer<int>::iterator it14 = it11 - 2;
circular_buffer<int>::iterator it15 = it11 - 1;
cb1.rinsert(cb1.begin() + 4, v2.begin(), v2.end());
// memory placement: { 5, 6, 1, 2, 4 } - 6 inserted only
// circular buffer: { 1, 2, 4, 5, 6 }
BOOST_TEST(*it11 == 5);
BOOST_TEST(*it12 == 6);
BOOST_TEST(*it13 == 1);
BOOST_TEST(*it14 == 2);
BOOST_TEST(*it15 == 4);
BOOST_TEST(cb1[0] == 1);
BOOST_TEST(cb1[1] == 2);
BOOST_TEST(cb1[2] == 4);
BOOST_TEST(cb1[3] == 5);
BOOST_TEST(cb1[4] == 6);
// memory placement: { 1, 2, 3 }
// circular buffer: { 1, 2, 3 }
circular_buffer<int> cb2(5);
cb2.push_back(1);
cb2.push_back(2);
cb2.push_back(3);
// it1 -> 1, it2 -> 2, it3 -> 3
circular_buffer<int>::iterator it21 = cb2.begin();
circular_buffer<int>::iterator it22 = cb2.begin() + 1;
circular_buffer<int>::iterator it23 = cb2.begin() + 2;
cb2.rinsert(cb2.begin() + 2, MyInputIterator(v1.begin()), MyInputIterator(v1.end()));
// memory placement: { 4, 5, 3, 1, 2 }
// circular buffer: { 1, 2, 4, 5, 3 }
BOOST_TEST(*it21 == 4);
BOOST_TEST(*it22 == 5);
BOOST_TEST(*it23 == 3);
BOOST_TEST(cb2[0] == 1);
BOOST_TEST(cb2[1] == 2);
BOOST_TEST(cb2[2] == 4);
BOOST_TEST(cb2[3] == 5);
BOOST_TEST(cb2[4] == 3);
// it24 -> 1, it25 -> 2
circular_buffer<int>::iterator it24 = it21 - 2;
circular_buffer<int>::iterator it25 = it21 - 1;
cb2.rinsert(cb2.begin() + 4, MyInputIterator(v2.begin()), MyInputIterator(v2.end()));
// memory placement: { 5, 6, 1, 2, 4 }
// circular buffer: { 1, 2, 4, 5, 6 }
BOOST_TEST(*it21 == 5);
BOOST_TEST(*it22 == 6);
BOOST_TEST(*it23 == 1);
BOOST_TEST(*it24 == 2);
BOOST_TEST(*it25 == 4);
BOOST_TEST(cb2[0] == 1);
BOOST_TEST(cb2[1] == 2);
BOOST_TEST(cb2[2] == 4);
BOOST_TEST(cb2[3] == 5);
BOOST_TEST(cb2[4] == 6);
}
void validity_erase_test() {
// memory placement: { 4, 5, 1, 2, 3 }
// circular buffer: { 1, 2, 3, 4, 5 }
circular_buffer<int> cb(5);
cb.push_back(-1);
cb.push_back(0);
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);
cb.push_back(4);
cb.push_back(5);
// it1 -> 1, it2 -> 2, it3 -> 3, it4 -> 4
circular_buffer<int>::iterator it1 = cb.begin();
circular_buffer<int>::iterator it2 = cb.begin() + 1;
circular_buffer<int>::iterator it3 = cb.begin() + 2;
circular_buffer<int>::iterator it4 = cb.begin() + 3;
cb.erase(cb.begin() + 1);
// memory placement: { 5, X, 1, 3, 4 }
// circular buffer: { 1, 3, 4, 5 }
BOOST_TEST(*it1 == 1);
BOOST_TEST(*it2 == 3);
BOOST_TEST(*it3 == 4);
BOOST_TEST(*it4 == 5);
BOOST_TEST(cb[0] == 1);
BOOST_TEST(cb[1] == 3);
BOOST_TEST(cb[2] == 4);
BOOST_TEST(cb[3] == 5);
}
void validity_erase_range_test() {
// memory placement: { 4, 5, 6, 1, 2, 3 }
// circular buffer: { 1, 2, 3, 4, 5, 6 }
circular_buffer<int> cb(6);
cb.push_back(-2);
cb.push_back(-1);
cb.push_back(0);
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);
cb.push_back(4);
cb.push_back(5);
cb.push_back(6);
// it1 -> 1, it2 -> 2, it3 -> 3, it4 -> 4
circular_buffer<int>::iterator it1 = cb.begin();
circular_buffer<int>::iterator it2 = cb.begin() + 1;
circular_buffer<int>::iterator it3 = cb.begin() + 2;
circular_buffer<int>::iterator it4 = cb.begin() + 3;
cb.erase(cb.begin() + 2, cb.begin() + 4);
// memory placement: { 6, X, X, 1, 2, 5 }
// circular buffer: { 1, 2, 5, 6 }
BOOST_TEST(*it1 == 1);
BOOST_TEST(*it2 == 2);
BOOST_TEST(*it3 == 5);
BOOST_TEST(*it4 == 6);
BOOST_TEST(cb[0] == 1);
BOOST_TEST(cb[1] == 2);
BOOST_TEST(cb[2] == 5);
BOOST_TEST(cb[3] == 6);
}
void validity_rerase_test() {
// memory placement: { 4, 5, 1, 2, 3 }
// circular buffer: { 1, 2, 3, 4, 5 }
circular_buffer<int> cb(5);
cb.push_back(-1);
cb.push_back(0);
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);
cb.push_back(4);
cb.push_back(5);
// it1 -> 2, it2 -> 3, it3 -> 4, it4 -> 5
circular_buffer<int>::iterator it1 = cb.begin() + 1;
circular_buffer<int>::iterator it2 = cb.begin() + 2;
circular_buffer<int>::iterator it3 = cb.begin() + 3;
circular_buffer<int>::iterator it4 = cb.begin() + 4;
cb.rerase(cb.begin() + 1);
// memory placement: { 4, 5, X, 1, 3 }
// circular buffer: { 1, 3, 4, 5 }
BOOST_TEST(*it1 == 1);
BOOST_TEST(*it2 == 3);
BOOST_TEST(*it3 == 4);
BOOST_TEST(*it4 == 5);
BOOST_TEST(cb[0] == 1);
BOOST_TEST(cb[1] == 3);
BOOST_TEST(cb[2] == 4);
BOOST_TEST(cb[3] == 5);
}
void validity_rerase_range_test() {
// memory placement: { 4, 5, 6, 1, 2, 3 }
// circular buffer: { 1, 2, 3, 4, 5, 6 }
circular_buffer<int> cb(6);
cb.push_back(-2);
cb.push_back(-1);
cb.push_back(0);
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);
cb.push_back(4);
cb.push_back(5);
cb.push_back(6);
// it1 -> 3, it2 -> 4, it3 -> 5, it4 -> 6
circular_buffer<int>::iterator it1 = cb.begin() + 2;
circular_buffer<int>::iterator it2 = cb.begin() + 3;
circular_buffer<int>::iterator it3 = cb.begin() + 4;
circular_buffer<int>::iterator it4 = cb.begin() + 5;
cb.rerase(cb.begin() + 2, cb.begin() + 4);
// memory placement: { 2, 5, 6, X, X, 1 }
// circular buffer: { 1, 2, 5, 6 }
BOOST_TEST(*it1 == 1);
BOOST_TEST(*it2 == 2);
BOOST_TEST(*it3 == 5);
BOOST_TEST(*it4 == 6);
BOOST_TEST(cb[0] == 1);
BOOST_TEST(cb[1] == 2);
BOOST_TEST(cb[2] == 5);
BOOST_TEST(cb[3] == 6);
}
void validity_linearize_test() {
// memory placement: { 3, 1, 2 }
// circular buffer: { 1, 2, 3 }
circular_buffer<int> cb(3);
cb.push_back(0);
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);
// it1 -> 1, it2 -> 2, it3 -> 3
circular_buffer<int>::iterator it1 = cb.begin();
circular_buffer<int>::iterator it2 = cb.begin() + 1;
circular_buffer<int>::iterator it3 = cb.begin() + 2;
cb.linearize();
// memory placement: { 1, 2, 3 }
// circular buffer: { 1, 2, 3 }
BOOST_TEST(*it1 == 2);
BOOST_TEST(*it2 == 3);
BOOST_TEST(*it3 == 1);
BOOST_TEST(cb[0] == 1);
BOOST_TEST(cb[1] == 2);
BOOST_TEST(cb[2] == 3);
}
void validity_swap_test() {
// memory placement: { 3, 1, 2 }
// circular buffer: { 1, 2, 3 }
circular_buffer<int> cb1(3);
cb1.push_back(0);
cb1.push_back(1);
cb1.push_back(2);
cb1.push_back(3);
// it11 -> 1, it12 -> 2, it13 -> 3
circular_buffer<int>::iterator it11 = cb1.begin();
circular_buffer<int>::iterator it12 = cb1.begin() + 1;
circular_buffer<int>::iterator it13 = cb1.begin() + 2;
// memory placement: { 4, 5, 6 }
// circular buffer: { 4, 5, 6 }
circular_buffer<int> cb2(5);
cb2.push_back(4);
cb2.push_back(5);
cb2.push_back(6);
// it21 -> 4, it22 -> 5, it23 -> 6
circular_buffer<int>::iterator it21 = cb2.begin();
circular_buffer<int>::iterator it22 = cb2.begin() + 1;
circular_buffer<int>::iterator it23 = cb2.begin() + 2;
cb1.swap(cb2);
// Although iterators refer to the original elements,
// their internal state is inconsistent and no other operation
// (except dereferencing) can be invoked on them any more.
BOOST_TEST(*it11 == 1);
BOOST_TEST(*it12 == 2);
BOOST_TEST(*it13 == 3);
BOOST_TEST(*it21 == 4);
BOOST_TEST(*it22 == 5);
BOOST_TEST(*it23 == 6);
BOOST_TEST(cb1[0] == 4);
BOOST_TEST(cb1[1] == 5);
BOOST_TEST(cb1[2] == 6);
BOOST_TEST(cb2[0] == 1);
BOOST_TEST(cb2[1] == 2);
BOOST_TEST(cb2[2] == 3);
}
void validity_push_back_test() {
// memory placement: { 3, 1, 2 }
// circular buffer: { 1, 2, 3 }
circular_buffer<int> cb(3);
cb.push_back(0);
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);
// it1 -> 1, it2 -> 2, it3 -> 3
circular_buffer<int>::iterator it1 = cb.begin();
circular_buffer<int>::iterator it2 = cb.begin() + 1;
circular_buffer<int>::iterator it3 = cb.begin() + 2;
cb.push_back(4);
// memory placement: { 3, 4, 2 }
// circular buffer: { 2, 3, 4 }
BOOST_TEST(*it1 == 4);
BOOST_TEST(*it2 == 2);
BOOST_TEST(*it3 == 3);
BOOST_TEST(cb[0] == 2);
BOOST_TEST(cb[1] == 3);
BOOST_TEST(cb[2] == 4);
}
void validity_push_front_test() {
// memory placement: { 3, 1, 2 }
// circular buffer: { 1, 2, 3 }
circular_buffer<int> cb(3);
cb.push_back(0);
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);
// it1 -> 1, it2 -> 2, it3 -> 3
circular_buffer<int>::iterator it1 = cb.begin();
circular_buffer<int>::iterator it2 = cb.begin() + 1;
circular_buffer<int>::iterator it3 = cb.begin() + 2;
cb.push_front(4);
// memory placement: { 4, 1, 2 }
// circular buffer: { 4, 1, 2 }
BOOST_TEST(*it1 == 1);
BOOST_TEST(*it2 == 2);
BOOST_TEST(*it3 == 4);
BOOST_TEST(cb[0] == 4);
BOOST_TEST(cb[1] == 1);
BOOST_TEST(cb[2] == 2);
}
void validity_pop_back_test() {
// memory placement: { 3, 1, 2 }
// circular buffer: { 1, 2, 3 }
circular_buffer<int> cb(3);
cb.push_back(0);
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);
// it1 -> 1, it2 -> 2
circular_buffer<int>::iterator it1 = cb.begin();
circular_buffer<int>::iterator it2 = cb.begin() + 1;
cb.pop_back();
// memory placement: { X, 1, 2 }
// circular buffer: { 1, 2 }
BOOST_TEST(*it1 == 1);
BOOST_TEST(*it2 == 2);
BOOST_TEST(cb[0] == 1);
BOOST_TEST(cb[1] == 2);
}
void validity_pop_front_test() {
// memory placement: { 3, 1, 2 }
// circular buffer: { 1, 2, 3 }
circular_buffer<int> cb(3);
cb.push_back(0);
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);
// it1 -> 2, it2 -> 3
circular_buffer<int>::iterator it1 = cb.begin() + 1;
circular_buffer<int>::iterator it2 = cb.begin() + 2;
cb.pop_front();
// memory placement: { 3, X, 2 }
// circular buffer: { 2, 3 }
BOOST_TEST(*it1 == 2);
BOOST_TEST(*it2 == 3);
BOOST_TEST(cb[0] == 2);
BOOST_TEST(cb[1] == 3);
}
// test main
int main()
{
validity_example_test();
validity_insert_test();
validity_insert_n_test();
validity_insert_range_test();
validity_rinsert_test();
validity_rinsert_n_test();
validity_rinsert_range_test();
validity_erase_test();
validity_erase_range_test();
validity_rerase_test();
validity_rerase_range_test();
validity_linearize_test();
validity_swap_test();
validity_push_back_test();
validity_push_front_test();
validity_pop_back_test();
validity_pop_front_test();
return boost::report_errors();
}
@@ -0,0 +1,193 @@
// Test of the space optimized adaptor of the circular buffer.
// Copyright (c) 2003-2008 Jan Gaspar
// 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)
#include "test.hpp"
#define CB_CONTAINER circular_buffer_space_optimized
#include "common.ipp"
typedef circular_buffer_space_optimized<MyInteger> cb_space_optimized;
typedef cb_space_optimized::capacity_type capacity_ctrl;
// min_capacity test (it is useful to use a debug tool)
void min_capacity_test() {
vector<int> v;
v.push_back(1);
v.push_back(2);
v.push_back(3);
v.push_back(4);
v.push_back(5);
cb_space_optimized cb1(capacity_ctrl(10, 10));
cb_space_optimized cb2(capacity_ctrl(10, 5), 1);
cb_space_optimized cb3(capacity_ctrl(20, 10), v.begin(), v.end());
BOOST_TEST(cb1.size() == 0);
BOOST_TEST(cb1.capacity().capacity() == 10);
BOOST_TEST(cb1.capacity().min_capacity() == 10);
BOOST_TEST(cb2[0] == 1);
BOOST_TEST(cb2.size() == 10);
BOOST_TEST(cb2.capacity() == 10);
BOOST_TEST(cb2.capacity().min_capacity() == 5);
BOOST_TEST(cb3[0] == 1);
BOOST_TEST(cb3.size() == 5);
BOOST_TEST(cb3.capacity() == 20);
BOOST_TEST(cb3.capacity().min_capacity() == 10);
BOOST_TEST(cb1.capacity().min_capacity() <= cb1.internal_capacity());
BOOST_TEST(cb2.capacity().min_capacity() <= cb2.internal_capacity());
BOOST_TEST(cb3.capacity().min_capacity() <= cb3.internal_capacity());
cb2.erase(cb2.begin() + 2, cb2.end());
BOOST_TEST(cb2.size() == 2);
BOOST_TEST(cb2.capacity().min_capacity() <= cb2.internal_capacity());
cb2.clear();
cb3.clear();
BOOST_TEST(cb2.empty());
BOOST_TEST(cb3.empty());
BOOST_TEST(cb2.capacity().min_capacity() <= cb2.internal_capacity());
BOOST_TEST(cb3.capacity().min_capacity() <= cb3.internal_capacity());
}
void capacity_control_test() {
circular_buffer_space_optimized<int>::capacity_type c1 = 10;
circular_buffer_space_optimized<int>::capacity_type c2 =
circular_buffer_space_optimized<int>::capacity_type(20, 5);
circular_buffer_space_optimized<int>::capacity_type c3 = c2;
BOOST_TEST(c1.capacity() == 10);
BOOST_TEST(c1.min_capacity() == 0);
BOOST_TEST(c2.capacity() == 20);
BOOST_TEST(c2.min_capacity() == 5);
BOOST_TEST(c3.capacity() == 20);
BOOST_TEST(c3.min_capacity() == 5);
c1 = c2;
BOOST_TEST(c1.capacity() == 20);
BOOST_TEST(c1.min_capacity() == 5);
}
void specific_constructors_test() {
cb_space_optimized cb1;
BOOST_TEST(cb1.capacity() == 0);
BOOST_TEST(cb1.capacity().min_capacity() == 0);
BOOST_TEST(cb1.internal_capacity() == 0);
BOOST_TEST(cb1.size() == 0);
cb1.push_back(1);
cb1.push_back(2);
cb1.push_back(3);
BOOST_TEST(cb1.size() == 0);
BOOST_TEST(cb1.capacity() == 0);
vector<int> v;
v.push_back(1);
v.push_back(2);
v.push_back(3);
cb_space_optimized cb2(v.begin(), v.end());
BOOST_TEST(cb2.capacity() == 3);
BOOST_TEST(cb2.capacity().min_capacity() == 0);
BOOST_TEST(cb2.size() == 3);
}
void shrink_to_fit_test() {
cb_space_optimized cb(1000);
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);
BOOST_TEST(cb.size() == 3);
BOOST_TEST(cb.capacity() == 1000);
size_t internal_capacity = cb.internal_capacity();
cb_space_optimized(cb).swap(cb);
BOOST_TEST(cb.size() == 3);
BOOST_TEST(cb.capacity() == 1000);
BOOST_TEST(internal_capacity >= cb.internal_capacity());
}
void iterator_invalidation_test() {
#if BOOST_CB_ENABLE_DEBUG
cb_space_optimized cb1(10, 1);
cb1.push_back(2);
cb1.push_back(3);
cb1.push_back(4);
cb_space_optimized::iterator it1 = cb1.end();
cb_space_optimized::const_iterator it2 = cb1.begin();
cb_space_optimized::iterator it3 = cb1.begin() + 6;
cb1.set_capacity(10);
BOOST_TEST(it1.is_valid(&cb1));
BOOST_TEST(!it2.is_valid(&cb1));
BOOST_TEST(!it3.is_valid(&cb1));
it1 = cb1.end();
it2 = cb1.begin();
it3 = cb1.begin() + 6;
cb1.rset_capacity(10);
BOOST_TEST(it1.is_valid(&cb1));
BOOST_TEST(!it2.is_valid(&cb1));
BOOST_TEST(!it3.is_valid(&cb1));
it1 = cb1.end();
it2 = cb1.begin();
it3 = cb1.begin() + 6;
cb1.resize(10);
BOOST_TEST(it1.is_valid(&cb1));
BOOST_TEST(!it2.is_valid(&cb1));
BOOST_TEST(!it3.is_valid(&cb1));
it1 = cb1.end();
it2 = cb1.begin();
it3 = cb1.begin() + 6;
cb1.rresize(10);
BOOST_TEST(it1.is_valid(&cb1));
BOOST_TEST(!it2.is_valid(&cb1));
BOOST_TEST(!it3.is_valid(&cb1));
{
cb_space_optimized cb2(10, 1);
cb2.push_back(2);
cb2.push_back(3);
cb2.push_back(4);
it1 = cb2.end();
it2 = cb2.begin();
it3 = cb2.begin() + 6;
}
BOOST_TEST(!it1.is_valid(&cb1));
BOOST_TEST(!it2.is_valid(&cb1));
BOOST_TEST(!it3.is_valid(&cb1));
#endif // #if BOOST_CB_ENABLE_DEBUG
}
// test main
int main()
{
run_common_tests();
min_capacity_test();
capacity_control_test();
specific_constructors_test();
shrink_to_fit_test();
iterator_invalidation_test();
return boost::report_errors();
}
@@ -0,0 +1,147 @@
// Header file for the test of the circular buffer library.
// Copyright (c) 2003-2008 Jan Gaspar
// 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)
#if !defined(BOOST_CIRCULAR_BUFFER_TEST_HPP)
#define BOOST_CIRCULAR_BUFFER_TEST_HPP
#if defined(_MSC_VER) && _MSC_VER >= 1200
#pragma once
#endif
#define BOOST_CB_TEST
#include <boost/circular_buffer.hpp>
#include <boost/core/lightweight_test.hpp>
#include <iterator>
#include <numeric>
#include <vector>
#if !defined(BOOST_NO_EXCEPTIONS)
#include <exception>
#endif
// Integer (substitute for int) - more appropriate for testing
class MyInteger {
private:
int* m_pValue;
static int ms_exception_trigger;
void check_exception() {
if (ms_exception_trigger > 0) {
if (--ms_exception_trigger == 0) {
delete m_pValue;
m_pValue = 0;
#if !defined(BOOST_NO_EXCEPTIONS)
throw std::exception();
#endif
}
}
}
public:
MyInteger() : m_pValue(new int(0)) { check_exception(); }
MyInteger(int i) : m_pValue(new int(i)) { check_exception(); }
MyInteger(const MyInteger& src) : m_pValue(new int(src)) { check_exception(); }
~MyInteger() { delete m_pValue; }
MyInteger& operator = (const MyInteger& src) {
if (this == &src)
return *this;
check_exception();
delete m_pValue;
m_pValue = new int(src);
return *this;
}
operator int () const { return *m_pValue; }
static void set_exception_trigger(int n) { ms_exception_trigger = n; }
};
// default constructible class
class MyDefaultConstructible
{
public:
MyDefaultConstructible() : m_n(1) {}
MyDefaultConstructible(int n) : m_n(n) {}
int m_n;
};
// class counting instances of self
class InstanceCounter {
public:
InstanceCounter() { increment(); }
InstanceCounter(const InstanceCounter& y) { y.increment(); }
InstanceCounter& operator=(const InstanceCounter& y) {
decrement();
y.increment();
return *this;
}
~InstanceCounter() { decrement(); }
static int count() { return ms_count; }
private:
void increment() const { ++ms_count; }
void decrement() const { --ms_count; }
static int ms_count;
};
// dummy class suitable for iterator referencing test
class Dummy {
public:
enum DummyEnum {
eVar,
eFnc,
eConst,
eVirtual
};
Dummy() : m_n(eVar) {}
virtual ~Dummy() {}
DummyEnum fnc() { return eFnc; }
DummyEnum const_fnc() const { return eConst; }
virtual DummyEnum virtual_fnc() { return eVirtual; }
DummyEnum m_n;
};
// simulator of an input iterator
struct MyInputIterator {
typedef std::vector<int>::iterator vector_iterator;
typedef std::input_iterator_tag iterator_category;
typedef int value_type;
typedef int* pointer;
typedef int& reference;
typedef size_t size_type;
typedef ptrdiff_t difference_type;
explicit MyInputIterator(const vector_iterator& it) : m_it(it) {}
// Default assignment operator
reference operator * () const { return *m_it; }
pointer operator -> () const { return &(operator*()); }
MyInputIterator& operator ++ () {
++m_it;
return *this;
}
MyInputIterator operator ++ (int) {
MyInputIterator tmp = *this;
++*this;
return tmp;
}
bool operator == (const MyInputIterator& it) const { return m_it == it.m_it; }
bool operator != (const MyInputIterator& it) const { return m_it != it.m_it; }
private:
vector_iterator m_it;
};
#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR)
inline std::input_iterator_tag iterator_category(const MyInputIterator&) {
return std::input_iterator_tag();
}
inline int* value_type(const MyInputIterator&) { return 0; }
inline ptrdiff_t* distance_type(const MyInputIterator&) { return 0; }
#endif // #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR)
using namespace boost;
using namespace std;
#endif // #if !defined(BOOST_CIRCULAR_BUFFER_TEST_HPP)
@@ -0,0 +1,180 @@
# Use, modification, and distribution are
# 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)
#
# Copyright Antony Polukhin 2014.
# Copyright Adam Wulkiewicz 2015-2018.
general:
branches:
only:
- master
- develop
- test
machine:
environment:
# define tests list, if parallelism is enabled they are run in parallel
TESTS: test index/test
TESTS0: test/core test/concepts test/geometries test/arithmetic test/algorithms test/formulas test/iterators
TESTS1: test/srs test/strategies test/policies test/io test/util test/views index/test
# this is not fully bulletproof, ideally one should check
# if the current branch originates in master or develop
# but it's good enough
# test library using corresponding branch of Boost repository
BOOST_BRANCH: $([[ "$CIRCLE_BRANCH" = "master" ]] && echo master || echo develop)
# required directories
BOOST_DIR: boost-local
COVERAGE_DIR: coverage-local
# helper variables
PROJECT_ROOT: $HOME/$CIRCLE_PROJECT_REPONAME
BOOST_ROOT: $PROJECT_ROOT/$BOOST_DIR
COVERAGE_ROOT: $PROJECT_ROOT/$COVERAGE_DIR
#COVERAGE_ROOT: $CIRCLE_ARTIFACTS
dependencies:
pre:
- sudo apt-get update || true
# gcc, g++, gcov
- sudo apt-get install gcc-4.9 g++-4.9 build-essential
#- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 10
#- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 10
- sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-4.9 10
#- sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 20
#- sudo update-alternatives --set cc /usr/bin/gcc
#- sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 20
#- sudo update-alternatives --set c++ /usr/bin/g++
#- sudo update-alternatives --config gcc
#- sudo update-alternatives --config g++
- sudo update-alternatives --config gcov
# coveralls-lcov for lcov *.info to JSON conversion
- gem install coveralls-lcov
# jq for JSON handling
- sudo apt-get install jq
# curl for HTTP
- sudo apt-get install curl
# clone boost repository
- mkdir $BOOST_ROOT
- cd $BOOST_ROOT && git init .
- cd $BOOST_ROOT && git remote add --no-tags -t $BOOST_BRANCH origin https://github.com/boostorg/boost.git
- cd $BOOST_ROOT && git fetch --depth=1
- cd $BOOST_ROOT && git checkout $BOOST_BRANCH
- cd $BOOST_ROOT && git submodule update --init --merge
- cd $BOOST_ROOT && git remote set-branches --add origin $BOOST_BRANCH
- cd $BOOST_ROOT && git pull --recurse-submodules
- cd $BOOST_ROOT && git submodule update --init
- cd $BOOST_ROOT && git checkout $BOOST_BRANCH
- cd $BOOST_ROOT && git submodule foreach "git reset --quiet --hard; git clean -fxd"
- cd $BOOST_ROOT && git reset --hard; git clean -fxd
- cd $BOOST_ROOT && git status
# replace the content of the library with the currently tested repo
- cd $BOOST_ROOT && rm -rf libs/geometry/
- mkdir $BOOST_ROOT/libs/geometry
- cp -R `ls -A | grep -v $BOOST_DIR` $BOOST_ROOT/libs/geometry/
# build b2 and create headers
- cd $BOOST_ROOT && ./bootstrap.sh
- cd $BOOST_ROOT && ./b2 headers
# wait with the modifications of the project directory until now
# to avoid copying into the $BOOST_ROOT/libs/geometry/
# download and install the latest lcov
# do not use the old one from sources
- curl -fLO https://sourceforge.net/projects/ltp/files/Coverage%20Analysis/LCOV-1.12/lcov-1.12.tar.gz || curl -fLO https://downloads.sourceforge.net/project/ltp/Coverage%20Analysis/LCOV-1.12/lcov-1.12.tar.gz || wget http://sourceforge.mirrorservice.org/l/project/lt/ltp/Coverage%20Analysis/LCOV-1.12/lcov-1.12.tar.gz || wget -O lcov-1.12.tar.gz http://launchpad.net/ubuntu/+archive/primary/+files/lcov_1.12.orig.tar.gz
- tar xvzf lcov-1.12.tar.gz
- cd lcov-1.12 && sudo make install
# create a direcotry for temporary coverage data
- if [ ! -d $COVERAGE_ROOT ]; then mkdir $COVERAGE_ROOT; fi
test:
override:
# `--coverage` flags required to generate coverage info for Coveralls
# temporary for test purposes
#- cd $BOOST_ROOT/libs/geometry && ../../b2 cxxflags="--coverage" linkflags="--coverage" test/algorithms
#- cd $BOOST_ROOT/libs/geometry && ../../b2 cxxflags="--coverage" linkflags="--coverage" test/algorithms/detail
#- cd $BOOST_ROOT/libs/geometry && ../../b2 cxxflags="--coverage" linkflags="--coverage" test/algorithms/relational_operations
#- cd $BOOST_ROOT/libs/geometry && ../../b2 cxxflags="--coverage" linkflags="--coverage" test
#- cd $BOOST_ROOT/libs/geometry && ../../b2 cxxflags="--coverage" linkflags="--coverage" index/test/algorithms
#- cd $BOOST_ROOT/libs/geometry && ../../b2 cxxflags="--coverage" linkflags="--coverage" index/test/rtree/exceptions
# this is the first step of the first approach to automatic balancing
# the problem is that first the upper-level dir is handled
# then the tests from lower dir are executed, so the tests in various containers overlap
#- cd $BOOST_ROOT/libs/geometry && index=0 ; run_tests() { for i in "$1"/* ; do if [ -f "$i"/Jamfile* ] ; then ((index++)) ; echo "$index - $i" ; ../../b2 cxxflags="--coverage" linkflags="--coverage" "$i" ; run_tests "$i" ; fi ; done } ; run_tests test
# so for now just run the tests from the list
#- cd $BOOST_ROOT/libs/geometry && status=0; index=0 ; for t in ${TESTS[@]} ; do if [ $(((index++)%CIRCLE_NODE_TOTAL)) == $CIRCLE_NODE_INDEX ] ; then ../../b2 -j2 cxxflags="--coverage" linkflags="--coverage" $t ; fi || status=$? ; done ; exit $status :
# parallel: true
# so for now just run the tests from 2 lists
- cd $BOOST_ROOT/libs/geometry && status=0; case $CIRCLE_NODE_INDEX in 0) for t in ${TESTS0[@]} ; do ../../b2 -j2 cxxflags="--coverage" linkflags="--coverage" $t || status=$? ; done ;; 1) for t in ${TESTS1[@]} ; do ../../b2 -j2 cxxflags="--coverage" linkflags="--coverage" $t || status=$? ; done ;; esac ; exit $status :
parallel: true
post:
## Copying Coveralls data to a separate folder
#- find $BOOST_ROOT/bin.v2/ -name "*.gcda" -exec mv "{}" $COVERAGE_ROOT \;
#- find $BOOST_ROOT/bin.v2/ -name "*.gcno" -exec mv "{}" $COVERAGE_ROOT \;
# upgraded version - change the file name if exists
- find $BOOST_ROOT/bin.v2/ -name "*.gcda" -exec bash -c 'filen=$(basename $1) ; filen=${filen%.*} ; dirn=$(dirname $1) ; dstfilen=$filen ; while [ -f $COVERAGE_ROOT/$dstfilen.gcda ]; do dstfilen=$filen.$RANDOM ; done ; mv $dirn/$filen.gcda $COVERAGE_ROOT/$dstfilen.gcda ; mv $dirn/$filen.gcno $COVERAGE_ROOT/$dstfilen.gcno ; echo $dstfilen' bash "{}" \; :
parallel: true
## Preparing Coveralls data by
## ... changind data format to a readable one
- cd $BOOST_ROOT/libs/geometry && lcov --directory $COVERAGE_ROOT --base-directory ./ --capture --output-file $COVERAGE_ROOT/coverage.info :
parallel: true
## ... erasing /usr and unneeded directories data
- lcov --remove $COVERAGE_ROOT/coverage.info "/usr*" "*/libs/geometry/*" -o $COVERAGE_ROOT/coverage.info :
parallel: true
## ... erasing data that is not related to this project directly
- ls $BOOST_ROOT/boost | sed -r '/(geometry.*)/d' | sed -r 's/(.+)/"*\/boost\/\1\/*"/g' | sed -r 's/(.+\.hpp)\/\*/\1/g' | sed ':a;N;$!ba;s/\n/ /g' | xargs lcov --remove $COVERAGE_ROOT/coverage.info -o $COVERAGE_ROOT/coverage.info :
parallel: true
## ... sanity check
- ls -lah $COVERAGE_ROOT :
parallel: true
## Sending data to Coveralls
## ... gather all files in one container
- if [ $CIRCLE_NODE_INDEX = 0 ]; then mv $COVERAGE_ROOT/coverage.info $COVERAGE_ROOT/coverage0.info ; else scp $COVERAGE_ROOT/coverage.info node0:$COVERAGE_ROOT/coverage$CIRCLE_NODE_INDEX.info ; fi :
parallel: true
## ... merge info files
- lcov `ls $COVERAGE_ROOT/coverage*.info | sed -r 's/(.+)/--add-tracefile \1/g'` -o $COVERAGE_ROOT/coverage.info
## ... handle sending manually
## ... convert data with coveralls-lcov
- coveralls-lcov --repo-token=$COVERALLS_REPO_TOKEN -v -n $COVERAGE_ROOT/coverage.info > $COVERAGE_ROOT/coverage.json #:
#parallel: true
## ... alter the json file
- jq -c ".service_name = \"circle-ci\" | .service_number = \"$CIRCLE_BUILD_NUM\" | .git .branch =\"$CIRCLE_BRANCH\"" $COVERAGE_ROOT/coverage.json > $COVERAGE_ROOT/processed.json
#- jq -c ".service_name = \"circle-ci\" | .service_number = \"$CIRCLE_BUILD_NUM\" | .parallel = true | .git .branch =\"$CIRCLE_BRANCH\"" $COVERAGE_ROOT/coverage.json > $COVERAGE_ROOT/processed.json #:
#parallel: true
## ... send it to Coveralls
- curl --retry 3 -F "json_file=@$COVERAGE_ROOT/processed.json" 'https://coveralls.io/api/v1/jobs' #:
#parallel: true
## ... notify Coveralls that the parallel build has ended
# this doesn't work - Coveralls returns an error
#- echo "{\"payload\":{\"build_num\":\"$CIRCLE_BUILD_NUM\",\"status\":\"done\"}}" > $COVERAGE_ROOT/payload.json && curl --retry 3 -F "json_file=@$COVERAGE_ROOT/payload.json" "https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN"
#- echo "{\"payload\":{\"build_num\":\"$CIRCLE_BUILD_NUM\",\"status\":\"done\"}}" > $COVERAGE_ROOT/payload.json && curl --retry 3 -d "@$COVERAGE_ROOT/payload.json" "https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN"
## This doesn't work - no effect
#notify:
# webhooks:
# Notify Coveralls that the build has ended
#- url: https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN
@@ -0,0 +1,692 @@
##############################################################################
# CircleCI 2.0 for Boost.Geometry
#
# Copyright (c) 2018 Mateusz Loskot <mateusz@loskot.net>
# Copyright (c) 2018-2021 Adam Wulkiewicz, Lodz, Poland
#
# This file was modified by Oracle on 2023.
# Modifications copyright (c) 2023 Oracle and/or its affiliates.
# Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
#
# 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)
##############################################################################
version: 2
# Environment variables
environment: &environment
environment:
BOOST_DIR: shared-boost
COVERAGE_DIR: shared-coverage
# Docker image
docker: &docker
docker:
# gcc-9.3, ruby-2.3, sudo, curl
- image: cimg/base:stable-20.04
# Build configuration
config: &config
<<: *docker
<<: *environment
# Workspace
attach_workspace: &attach_workspace
attach_workspace:
at: ~/project
persist_boost_coverage: &persist_boost_coverage
persist_to_workspace:
root: ~/project
paths:
- shared-boost
- shared-coverage
#persist_coverage: &persist_coverage
# persist_to_workspace:
# root: ~/project
# paths:
# - shared-coverage
jobs:
bootstrap:
<<: *config
steps:
- checkout
- run:
name: Checkout Boost
command: |
git clone -b `[[ "$CIRCLE_BRANCH" = "master" ]] && echo master || echo develop` --depth 1 https://github.com/boostorg/boost.git $BOOST_DIR
rm -rf $BOOST_DIR/libs/geometry/*
mv -t $BOOST_DIR/libs/geometry/ `ls -A | grep -v $BOOST_DIR`
cd $BOOST_DIR
git submodule update --init tools/build
git submodule update --init libs/config
git submodule update --init tools/boostdep
python3 tools/boostdep/depinst/depinst.py geometry -I index/test
./bootstrap.sh
./b2 headers
- run: mkdir $COVERAGE_DIR
- *persist_boost_coverage
algorithms:
<<: *config
steps:
- *attach_workspace
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh algorithms test/algorithms//boost-geometry-algorithms
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/algorithms
algorithms_area:
<<: *config
steps:
- *attach_workspace
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh algorithms_area test/algorithms/area
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/algorithms_area
algorithms_buffer:
<<: *config
steps:
- *attach_workspace
# 1 test at a time to avoid fatal error: ... No space left on device
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh algorithms_buffer test/algorithms/buffer 1
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/algorithms_buffer
algorithms_closest_points:
<<: *config
steps:
- *attach_workspace
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh algorithms_closest_points test/algorithms/closest_points 1
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/algorithms_closest_points
algorithms_convex_hull:
<<: *config
steps:
- *attach_workspace
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh algorithms_convex_hull test/algorithms/convex_hull
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/algorithms_convex_hull
algorithms_covered_by:
<<: *config
steps:
- *attach_workspace
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh algorithms_covered_by test/algorithms/covered_by
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/algorithms_covered_by
algorithms_crosses:
<<: *config
steps:
- *attach_workspace
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh algorithms_crosses test/algorithms/crosses
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/algorithms_crosses
algorithms_detail:
<<: *config
steps:
- *attach_workspace
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh algorithms_detail test/algorithms/detail
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/algorithms_detail
algorithms_disjoint:
<<: *config
steps:
- *attach_workspace
# 1 test at a time to decrease memory consumption causing gcc internal error
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh algorithms_disjoint test/algorithms/disjoint 1
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/algorithms_disjoint
algorithms_distance:
<<: *config
steps:
- *attach_workspace
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh algorithms_distance test/algorithms/distance
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/algorithms_distance
algorithms_envelope:
<<: *config
steps:
- *attach_workspace
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh algorithms_envelope test/algorithms/envelope_expand
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/algorithms_envelope
algorithms_equals:
<<: *config
steps:
- *attach_workspace
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh algorithms_equals test/algorithms/equals
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/algorithms_equals
algorithms_intersects:
<<: *config
steps:
- *attach_workspace
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh algorithms_intersects test/algorithms/intersects
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/algorithms_intersects
algorithms_length:
<<: *config
steps:
- *attach_workspace
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh algorithms_length test/algorithms/length
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/algorithms_length
algorithms_overlaps:
<<: *config
steps:
- *attach_workspace
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh algorithms_overlaps test/algorithms/overlaps
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/algorithms_overlaps
algorithms_overlay:
<<: *config
steps:
- *attach_workspace
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh algorithms_overlay test/algorithms/overlay
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/algorithms_overlay
algorithms_perimeter:
<<: *config
steps:
- *attach_workspace
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh algorithms_perimeter test/algorithms/perimeter
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/algorithms_perimeter
algorithms_relate:
<<: *config
steps:
- *attach_workspace
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh algorithms_relate test/algorithms/relate
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/algorithms_relate
algorithms_set:
<<: *config
steps:
- *attach_workspace
# 1 test at a time to decrease memory consumption causing gcc internal error
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh algorithms_set test/algorithms/set_operations 1
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/algorithms_set
algorithms_similarity:
<<: *config
steps:
- *attach_workspace
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh algorithms_similarity test/algorithms/similarity
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/algorithms_similarity
algorithms_touches:
<<: *config
steps:
- *attach_workspace
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh algorithms_touches test/algorithms/touches
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/algorithms_touches
algorithms_within:
<<: *config
steps:
- *attach_workspace
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh algorithms_within test/algorithms/within
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/algorithms_within
arithmetic:
<<: *config
steps:
- *attach_workspace
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh arithmetic test/arithmetic
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/arithmetic
concepts:
<<: *config
steps:
- *attach_workspace
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh concepts test/concepts
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/concepts
core:
<<: *config
steps:
- *attach_workspace
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh core test/core
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/core
cs_undefined:
<<: *config
steps:
- *attach_workspace
# 1 test at a time to decrease memory consumption causing gcc internal error
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh cs_undefined test/cs_undefined 1
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/cs_undefined
formulas:
<<: *config
steps:
- *attach_workspace
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh formulas test/formulas
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/formulas
geometries:
<<: *config
steps:
- *attach_workspace
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh geometries test/geometries
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/geometries
io:
<<: *config
steps:
- *attach_workspace
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh io test/io
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/io
iterators:
<<: *config
steps:
- *attach_workspace
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh iterators test/iterators
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/iterators
policies:
<<: *config
steps:
- *attach_workspace
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh policies test/policies
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/policies
robustness:
<<: *config
steps:
- *attach_workspace
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh robustness test/robustness
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/robustness
srs:
<<: *config
steps:
- *attach_workspace
# 1 test at a time to decrease memory consumption causing gcc internal error
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh srs test/srs 1
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/srs
strategies:
<<: *config
steps:
- *attach_workspace
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh strategies test/strategies
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/strategies
util:
<<: *config
steps:
- *attach_workspace
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh util test/util
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/util
views:
<<: *config
steps:
- *attach_workspace
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh views test/views
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/views
index_algorithms:
<<: *config
steps:
- *attach_workspace
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh index_algorithms index/test/algorithms
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/index_algorithms
index_rtree:
<<: *config
steps:
- *attach_workspace
# 1 test at a time to decrease memory consumption causing gcc internal error
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh index_rtree index/test/rtree//boost-geometry-index-rtree 1
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/index_rtree
index_rtree_b2d:
<<: *config
steps:
- *attach_workspace
# 1 test at a time to decrease memory consumption causing gcc internal error
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh index_rtree_b2d index/test/rtree/generated/b2d 1
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/index_rtree_b2d
index_rtree_exceptions:
<<: *config
steps:
- *attach_workspace
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh index_rtree_exceptions index/test/rtree/exceptions
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/index_rtree_exceptions
index_detail:
<<: *config
steps:
- *attach_workspace
- run: ./$BOOST_DIR/libs/geometry/.circleci/run_test.sh index_detail index/test//boost-geometry-index-detail
- persist_to_workspace:
root: ~/project
paths:
- shared-coverage/index_detail
coverage:
<<: *config
steps:
- *attach_workspace
- run: ls -lah $COVERAGE_DIR
- run: sudo apt-get update
- run: sudo apt-get install lcov
- run: lcov --directory $COVERAGE_DIR --base-directory $BOOST_DIR --capture --output-file $COVERAGE_DIR/coverage.info
- run: lcov --extract $COVERAGE_DIR/coverage.info "*/boost/geometry/*" "*/libs/geometry/include/*" --output-file $COVERAGE_DIR/coverage.info
- run: sed -i 's/SF:.*boost\/geometry/SF:boost\/geometry/g' $COVERAGE_DIR/coverage.info
#Coveralls
- run: sudo apt-get install rubygems
- run: sudo gem install coveralls-lcov
- run: sudo apt-get install jq
- run: cd $BOOST_DIR/libs/geometry/include && coveralls-lcov --repo-token=$COVERALLS_REPO_TOKEN -v -n ../../../../$COVERAGE_DIR/coverage.info > ../../../../$COVERAGE_DIR/coverage.json
- run: jq -c ".service_name = \"circle-ci\" | .service_number = \"$CIRCLE_BUILD_NUM\" | .git .branch =\"$CIRCLE_BRANCH\"" $COVERAGE_DIR/coverage.json > $COVERAGE_DIR/processed.json
- run: curl --retry 3 -F "json_file=@$COVERAGE_DIR/processed.json" 'https://coveralls.io/api/v1/jobs'
#Codecov
- run: curl -s https://codecov.io/bash > .codecov
- run: chmod +x .codecov
- run: cd $BOOST_DIR/libs/geometry/include && ../../../../.codecov -t $CODECOV_TOKEN -f ../../../../$COVERAGE_DIR/coverage.info -x gcov
minimal:
<<: *config
steps:
- *attach_workspace
- run: cd $BOOST_DIR && ./b2 libs/geometry/test//boost-geometry-minimal
requires_0: &requires_0
requires:
- bootstrap
requires_1: &requires_1
requires:
- concepts
- core
- geometries
- util
requires_2: &requires_2
requires:
- algorithms_detail
- arithmetic
- formulas
- io
- iterators
- policies
- robustness
- strategies
- views
requires_3: &requires_3
requires:
- algorithms
- algorithms_area
- algorithms_buffer
- algorithms_closest_points
- algorithms_convex_hull
- algorithms_covered_by
- algorithms_crosses
- algorithms_disjoint
- algorithms_distance
- algorithms_envelope
- algorithms_equals
- algorithms_intersects
- algorithms_length
- algorithms_overlaps
- algorithms_overlay
- algorithms_perimeter
- algorithms_relate
- algorithms_set
- algorithms_similarity
- algorithms_touches
- algorithms_within
- srs
- index_algorithms
requires_4: &requires_4
requires:
- index_rtree
- index_rtree_b2d
- index_rtree_exceptions
- index_detail
- cs_undefined
only_master_develop: &only_master_develop
filters:
branches:
only:
- develop
- master
ignore_master_develop: &ignore_master_develop
filters:
branches:
ignore:
- develop
- master
workflows:
version: 2
workflow:
jobs:
# all branches: level 0, bootstrap
- bootstrap
# master, develop: level 1
- concepts:
<<: *requires_0
<<: *only_master_develop
- core:
<<: *requires_0
<<: *only_master_develop
- geometries:
<<: *requires_0
<<: *only_master_develop
- util:
<<: *requires_0
<<: *only_master_develop
# master, develop: level 2
- algorithms_detail:
<<: *requires_1
<<: *only_master_develop
- arithmetic:
<<: *requires_1
<<: *only_master_develop
- formulas:
<<: *requires_1
<<: *only_master_develop
- io:
<<: *requires_1
<<: *only_master_develop
- iterators:
<<: *requires_1
<<: *only_master_develop
- policies:
<<: *requires_1
<<: *only_master_develop
- robustness:
<<: *requires_1
<<: *only_master_develop
- strategies:
<<: *requires_1
<<: *only_master_develop
- views:
<<: *requires_1
<<: *only_master_develop
# master, develop: level 3
- algorithms:
<<: *requires_2
<<: *only_master_develop
- algorithms_area:
<<: *requires_2
<<: *only_master_develop
- algorithms_buffer:
<<: *requires_2
<<: *only_master_develop
- algorithms_closest_points:
<<: *requires_2
<<: *only_master_develop
- algorithms_convex_hull:
<<: *requires_2
<<: *only_master_develop
- algorithms_covered_by:
<<: *requires_2
<<: *only_master_develop
- algorithms_crosses:
<<: *requires_2
<<: *only_master_develop
- algorithms_disjoint:
<<: *requires_2
<<: *only_master_develop
- algorithms_distance:
<<: *requires_2
<<: *only_master_develop
- algorithms_envelope:
<<: *requires_2
<<: *only_master_develop
- algorithms_equals:
<<: *requires_2
<<: *only_master_develop
- algorithms_intersects:
<<: *requires_2
<<: *only_master_develop
- algorithms_length:
<<: *requires_2
<<: *only_master_develop
- algorithms_overlaps:
<<: *requires_2
<<: *only_master_develop
- algorithms_overlay:
<<: *requires_2
<<: *only_master_develop
- algorithms_perimeter:
<<: *requires_2
<<: *only_master_develop
- algorithms_relate:
<<: *requires_2
<<: *only_master_develop
- algorithms_set:
<<: *requires_2
<<: *only_master_develop
- algorithms_similarity:
<<: *requires_2
<<: *only_master_develop
- algorithms_touches:
<<: *requires_2
<<: *only_master_develop
- algorithms_within:
<<: *requires_2
<<: *only_master_develop
- srs:
<<: *requires_2
<<: *only_master_develop
- index_algorithms:
<<: *requires_2
<<: *only_master_develop
# master, develop: level 4
- index_rtree:
<<: *requires_3
<<: *only_master_develop
- index_rtree_b2d:
<<: *requires_3
<<: *only_master_develop
- index_rtree_exceptions:
<<: *requires_3
<<: *only_master_develop
- index_detail:
<<: *requires_3
<<: *only_master_develop
- cs_undefined:
<<: *requires_3
<<: *only_master_develop
# master, develop: level 5, coverage
- coverage:
<<: *requires_4
<<: *only_master_develop
# other branches: level 1, minimal
- minimal:
<<: *requires_0
<<: *ignore_master_develop
@@ -0,0 +1,42 @@
#!/bin/bash
if [ "$#" -lt 2 ]; then
echo 'Intended usage'
echo ' run_test TEST_NAME TEST_DIR [NPARALLEL]'
echo ''
echo '$BOOST_DIR and $COVERAGE_DIR must be defined.'
exit
fi
TEST_NAME=$1
TEST_DIR=$2
TEST_NPARALLEL=2
if [ "$#" -ge 3 ]; then
TEST_NPARALLEL=$3
fi
cd $BOOST_DIR
./b2 -j$TEST_NPARALLEL toolset=gcc cxxflags="--coverage" linkflags="--coverage" libs/geometry/$TEST_DIR
EXIT_STATUS=$?
cd ..
mkdir $COVERAGE_DIR/$TEST_NAME
files=$(find $BOOST_DIR/bin.v2/ -name "*.gcda")
for file in $files; do
filen=${file##*/}
filen=${filen%.*}
dirn=${file%/*}
dstfilen=$filen
while [ -f $COVERAGE_DIR/$dstfilen.gcda ]; do
dstfilen=$filen.$RANDOM
done
mv $dirn/$filen.gcda $COVERAGE_DIR/$TEST_NAME/$dstfilen.gcda
mv $dirn/$filen.gcno $COVERAGE_DIR/$TEST_NAME/$dstfilen.gcno
done
exit $EXIT_STATUS
@@ -0,0 +1,96 @@
* text=auto !eol svneol=native#text/plain
*.gitattributes text svneol=native#text/plain
# Scriptish formats
*.bat text svneol=native#text/plain
*.bsh text svneol=native#text/x-beanshell
*.cgi text svneol=native#text/plain
*.cmd text svneol=native#text/plain
*.js text svneol=native#text/javascript
*.php text svneol=native#text/x-php
*.pl text svneol=native#text/x-perl
*.pm text svneol=native#text/x-perl
*.py text svneol=native#text/x-python
*.sh eol=lf svneol=LF#text/x-sh
configure eol=lf svneol=LF#text/x-sh
# Image formats
*.bmp binary svneol=unset#image/bmp
*.gif binary svneol=unset#image/gif
*.ico binary svneol=unset#image/ico
*.jpeg binary svneol=unset#image/jpeg
*.jpg binary svneol=unset#image/jpeg
*.png binary svneol=unset#image/png
*.tif binary svneol=unset#image/tiff
*.tiff binary svneol=unset#image/tiff
*.svg text svneol=native#image/svg%2Bxml
# Data formats
*.pdf binary svneol=unset#application/pdf
*.avi binary svneol=unset#video/avi
*.doc binary svneol=unset#application/msword
*.dsp text svneol=crlf#text/plain
*.dsw text svneol=crlf#text/plain
*.eps binary svneol=unset#application/postscript
*.gz binary svneol=unset#application/gzip
*.mov binary svneol=unset#video/quicktime
*.mp3 binary svneol=unset#audio/mpeg
*.ppt binary svneol=unset#application/vnd.ms-powerpoint
*.ps binary svneol=unset#application/postscript
*.psd binary svneol=unset#application/photoshop
*.rdf binary svneol=unset#text/rdf
*.rss text svneol=unset#text/xml
*.rtf binary svneol=unset#text/rtf
*.sln text svneol=native#text/plain
*.swf binary svneol=unset#application/x-shockwave-flash
*.tgz binary svneol=unset#application/gzip
*.vcproj text svneol=native#text/xml
*.vcxproj text svneol=native#text/xml
*.vsprops text svneol=native#text/xml
*.wav binary svneol=unset#audio/wav
*.xls binary svneol=unset#application/vnd.ms-excel
*.zip binary svneol=unset#application/zip
# Text formats
.htaccess text svneol=native#text/plain
*.bbk text svneol=native#text/xml
*.cmake text svneol=native#text/plain
*.css text svneol=native#text/css
*.dtd text svneol=native#text/xml
*.htm text svneol=native#text/html
*.html text svneol=native#text/html
*.ini text svneol=native#text/plain
*.log text svneol=native#text/plain
*.mak text svneol=native#text/plain
*.qbk text svneol=native#text/plain
*.rst text svneol=native#text/plain
*.sql text svneol=native#text/x-sql
*.txt text svneol=native#text/plain
*.xhtml text svneol=native#text/xhtml%2Bxml
*.xml text svneol=native#text/xml
*.xsd text svneol=native#text/xml
*.xsl text svneol=native#text/xml
*.xslt text svneol=native#text/xml
*.xul text svneol=native#text/xul
*.yml text svneol=native#text/plain
boost-no-inspect text svneol=native#text/plain
CHANGES text svneol=native#text/plain
COPYING text svneol=native#text/plain
INSTALL text svneol=native#text/plain
Jamfile text svneol=native#text/plain
Jamroot text svneol=native#text/plain
Jamfile text svneol=native#text/plain
Jamrules text svneol=native#text/plain
Makefile* text svneol=native#text/plain
README text svneol=native#text/plain
TODO text svneol=native#text/plain
# Code formats
*.c text svneol=native#text/plain
*.cpp text svneol=native#text/plain
*.h text svneol=native#text/plain
*.hpp text svneol=native#text/plain
*.ipp text svneol=native#text/plain
*.tpp text svneol=native#text/plain
*.jam text svneol=native#text/plain
*.java text svneol=native#text/plain
@@ -0,0 +1,20 @@
*~
*.swp
# Boost.Build
stdcerr
# Visual Studio (Code)
/.vs
.vscode
# CMake
/*build*
/cmake-build-debug/
/cmake-build-release/
/CMakeSettings.json
# JetBrains
/.idea
!build.jam
@@ -0,0 +1,134 @@
# Originally generated by `boostdep --cmake geometry`
# Adapted manually
# Copyright 2020, 2021 Peter Dimov
# Copyright (c) 2024 Barend Gehrels, Amsterdam, the Netherlands.
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt
cmake_minimum_required(VERSION 3.8...3.20)
project(boost_geometry VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
add_library(boost_geometry INTERFACE)
add_library(Boost::geometry ALIAS boost_geometry)
target_include_directories(boost_geometry INTERFACE include)
target_compile_features(boost_geometry INTERFACE cxx_std_14)
target_link_libraries(boost_geometry
INTERFACE
Boost::algorithm
Boost::any
Boost::array
Boost::assert
Boost::concept_check
Boost::config
Boost::core
Boost::crc
Boost::function_types
Boost::iterator
Boost::lexical_cast
Boost::math
Boost::move
Boost::mpl
Boost::multiprecision
Boost::numeric_conversion
Boost::program_options
Boost::qvm
Boost::range
Boost::rational
Boost::static_assert
Boost::throw_exception
Boost::tokenizer
Boost::tuple
Boost::type_traits
Boost::utility
Boost::variant
)
# Required for Boost.Geometry Index
target_link_libraries(boost_geometry
INTERFACE
Boost::container
Boost::serialization
)
# Optional requirements (for example, for adaptations)
if(BOOST_GEOMETRY_BUILD_OPTIONAL)
target_link_libraries(boost_geometry
INTERFACE
Boost::fusion
Boost::integer
Boost::polygon
Boost::variant2
)
# Mentioned in SRS Shared_grids_boost (which is optional)
target_link_libraries(boost_geometry
INTERFACE
Boost::thread
)
# Requirements for extensions
target_link_libraries(boost_geometry
INTERFACE
Boost::endian
Boost::predef
)
endif()
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
if (${PROJECT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
# Project is root. Find Boost source.
set(BOOST_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../.." CACHE STRING "Boost source dir to use when running CMake from this directory")
if (NOT IS_ABSOLUTE ${BOOST_SRC_DIR})
set(BOOST_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${BOOST_SRC_DIR}")
endif()
set(BOOST_SRC_DIR_IS_VALID ON)
foreach (PATH "CMakeLists.txt" "Jamroot" "boost-build.jam" "libs")
if (NOT EXISTS "${BOOST_SRC_DIR}/${PATH}")
message(STATUS "${BOOST_SRC_DIR}/${PATH} does not exist. Fallback to find_package.")
set(BOOST_SRC_DIR_IS_VALID OFF)
break()
endif()
endforeach()
# Create Boost targets from source dir or boost package.
# These are the direct dependencies currently used in unit tests.
set(BOOST_INCLUDE_LIBRARIES
config
algorithm
any
crc
lexical_cast
math
multiprecision
program_options
qvm
rational
serialization
tokenizer
variant
test)
if (BOOST_SRC_DIR_IS_VALID)
set(BOOST_EXCLUDE_LIBRARIES ${PROJECT_NAME})
add_subdirectory(${BOOST_SRC_DIR} deps_/boost EXCLUDE_FROM_ALL)
else()
find_package(Boost 1.81.0 REQUIRED)
foreach (BOOST_INCLUDE_LIBRARY ${BOOST_INCLUDE_LIBRARIES})
add_library(Boost::${BOOST_INCLUDE_LIBRARY} ALIAS Boost::headers)
endforeach ()
endif()
endif()
enable_testing()
add_subdirectory(test EXCLUDE_FROM_ALL)
add_subdirectory(index/test EXCLUDE_FROM_ALL)
endif()
@@ -0,0 +1,14 @@
# Contributing to Boost.Geometry
Boost.Geometry is a member of [Boost](https://www.boost.org) libraries.
## Table of Contents
* [**Contribution Tutorial**](http://github.com/boostorg/geometry/wiki/Contribution-Tutorial)
* [**Guidelines for Developers**](http://github.com/boostorg/geometry/wiki/Guidelines-for-Developers)
* [**Generating and Improving Documentation**](https://github.com/boostorg/geometry/wiki/Generating-and-Improving-Documentation)
### Resources
* [**Debugging**](http://github.com/boostorg/geometry/wiki/Debugging)
* [**Talks**](http://github.com/boostorg/geometry/wiki/Talks)
@@ -0,0 +1,23 @@
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,26 @@
# ![Boost.Geometry](doc/other/logo/logo_bkg.png)
Boost.Geometry, part of collection of the [Boost C++ Libraries](http://github.com/boostorg), defines concepts, primitives and algorithms for solving geometry problems. Boost.Geometry is a C++14 header-only library.
[![Licence](https://img.shields.io/badge/license-boost-4480cc.png)](http://www.boost.org/LICENSE_1_0.txt)
[![Documentation](https://img.shields.io/badge/-documentation-4480cc.png)](http://boost.org/libs/geometry)
[![Wiki](https://img.shields.io/badge/-wiki-4480cc.png)](https://github.com/boostorg/geometry/wiki)
[![Mailing List](https://img.shields.io/badge/-mailing%20list-4eb899.png)](http://lists.boost.org/geometry/)
[![Chat](https://badges.gitter.im/boostorg/geometry.png)](https://gitter.im/boostorg/geometry?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
### Test results
Branch | Build | Coverage | Regression | Documentation
------------|---------------|----------------|------------|--------------
**develop** | [![circleci](https://circleci.com/gh/boostorg/geometry/tree/develop.svg?style=shield)](https://circleci.com/gh/boostorg/geometry/tree/develop) <br> [![minimal](https://github.com/boostorg/geometry/workflows/minimal/badge.svg?branch=develop)](https://github.com/boostorg/geometry/actions?query=branch:develop+workflow:minimal) | [![coveralls](https://coveralls.io/repos/github/boostorg/geometry/badge.svg?branch=develop)](https://coveralls.io/github/boostorg/geometry?branch=develop) <br> [![codecov](https://codecov.io/gh/boostorg/geometry/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/geometry/branch/develop) | [![geometry](https://img.shields.io/badge/-geometry-4480cc.png)](http://www.boost.org/development/tests/develop/developer/geometry.html) [![index](https://img.shields.io/badge/-index-4480cc.png)](http://www.boost.org/development/tests/develop/developer/geometry-index.html) [![extensions](https://img.shields.io/badge/-extensions-4480cc.png)](http://www.boost.org/development/tests/develop/developer/geometry-extensions.html) | [![documentation](https://github.com/boostorg/geometry/workflows/documentation/badge.svg?branch=develop)](https://github.com/boostorg/geometry/actions?query=branch:develop+workflow:documentation)
**master** | [![circleci](https://circleci.com/gh/boostorg/geometry/tree/master.svg?style=shield)](https://circleci.com/gh/boostorg/geometry/tree/master) <br> [![minimal](https://github.com/boostorg/geometry/workflows/minimal/badge.svg?branch=master)](https://github.com/boostorg/geometry/actions?query=branch:master+workflow:minimal) | [![coveralls](https://coveralls.io/repos/github/boostorg/geometry/badge.svg?branch=master)](https://coveralls.io/github/boostorg/geometry?branch=master) <br> [![codecov](https://codecov.io/gh/boostorg/geometry/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/geometry/branch/master) | [![geometry](https://img.shields.io/badge/-geometry-4480cc.png)](http://www.boost.org/development/tests/master/developer/geometry.html) [![index](https://img.shields.io/badge/-index-4480cc.png)](http://www.boost.org/development/tests/master/developer/geometry-index.html) | [![documentation](https://github.com/boostorg/geometry/workflows/documentation/badge.svg?branch=master)](https://github.com/boostorg/geometry/actions?query=branch:master+workflow:documentation)
### Directories
* **doc** - QuickBook documentation sources
* **example** - Boost.Geometry examples
* **_extensions_** - examples and tests for the extensions - _develop branch_
* **include** - the sourcecode of Boost.Geometry
* **index** - examples and tests for the Spatial Index
* **meta** - library metadata
* **test** - Boost.Geometry unit tests
@@ -0,0 +1,63 @@
# Copyright René Ferdinand Rivera Morell 2024
# 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)
require-b2 5.2 ;
import-search /boost/config/checks ;
import config : requires ;
constant boost_dependencies :
/boost/algorithm//boost_algorithm
/boost/any//boost_any
/boost/array//boost_array
/boost/assert//boost_assert
/boost/concept_check//boost_concept_check
/boost/config//boost_config
/boost/container//boost_container
/boost/core//boost_core
/boost/endian//boost_endian
/boost/function_types//boost_function_types
/boost/fusion//boost_fusion
/boost/integer//boost_integer
/boost/iterator//boost_iterator
/boost/lexical_cast//boost_lexical_cast
/boost/math//boost_math_tr1
/boost/mpl//boost_mpl
/boost/multiprecision//boost_multiprecision
/boost/numeric_conversion//boost_numeric_conversion
/boost/polygon//boost_polygon
/boost/predef//boost_predef
/boost/qvm//boost_qvm
/boost/range//boost_range
/boost/rational//boost_rational
/boost/serialization//boost_serialization
/boost/static_assert//boost_static_assert
/boost/thread//boost_thread
/boost/throw_exception//boost_throw_exception
/boost/tokenizer//boost_tokenizer
/boost/tuple//boost_tuple
/boost/type_traits//boost_type_traits
/boost/variant//boost_variant
/boost/variant2//boost_variant2 ;
project /boost/geometry
: common-requirements
<include>include
: requirements
[ requires
cxx14_constexpr
cxx14_return_type_deduction
]
<toolset>msvc:<asynch-exceptions>on
;
explicit
[ alias boost_geometry : : : : <library>$(boost_dependencies) ]
[ alias all : boost_geometry test example doc/src/examples index extensions ]
;
call-if : boost-library geometry
;
@@ -0,0 +1,63 @@
# Boost.Geometry (aka GGL, Generic Geometry Library)
#
# Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
# Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
# Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
# 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)
project geometry/doc ;
# Auto-index, experimental. Commented otherwise does not build without.
#using auto-index ;
using quickbook ;
using python ;
path-constant here : . ;
path-constant images_location : html ;
import testing ;
testing.make-test run-pyd :
$(here)/make_qbk.py
:
<pythonpath>$(here)
<dependency>src/docutils/tools/doxygen_xml2qbk//doxygen_xml2qbk
<dependency>doxy/Doxyfile
<testing.arg>"--release-build --doxygen-xml2qbk"
<testing.input-file>src/docutils/tools/doxygen_xml2qbk//doxygen_xml2qbk
:
make_qbk ;
explicit make_qbk ;
boostbook geometry
: geometry.qbk
: <dependency>Jamfile
<dependency>quickref.xml
# <dependency>generated/point.qbk
<xsl:param>chunk.section.depth=4
# <auto-index>off
# <auto-index-internal>on
# <auto-index-verbose>off
# <xsl:param>index.on.type=1
# <format>html
<xsl:param>chunk.first.sections=1
<xsl:param>toc.section.depth=3
<xsl:param>toc.max.depth=2
<xsl:param>generate.section.toc.level=4
<xsl:param>boost.root=../../../..
<quickbook-define>enable_index
<include>$(here)
<format>pdf:<xsl:param>img.src.path=$(images_location)/
<dependency>make_qbk
;
install pdfinstall : geometry/<format>pdf : <location>. <name>geometry.pdf <install-type>PDF ;
explicit pdfinstall ;
###############################################################################
alias boostdoc ;
explicit boostdoc ;
alias boostrelease : geometry ;
explicit boostrelease ;
@@ -0,0 +1,43 @@
[/============================================================================
Boost.Geometry (aka GGL, Generic Geometry Library)
Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
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)
=============================================================================/]
[section Acknowledgments]
We like to thank all the people who helped to develop this library.
First of all we are grateful to Hartmut Kaiser for managing the formal review
of this library. Hartmut is an excellent review manager, who intervented when
necessary and produced the review report quickly.
We thank the 14 reviewers of our library, reviewed from November 5, 2009 to
November 22, 2009. Reviews have been written by: Brandon Kohn, Christophe
Henry, Fabio Fracassi, Gordon Woodhull, Joachim Faulhaber, Jonathan Franklin,
Jose, Lucanus Simonson, Michael Caisse, Michael Fawcett, Paul Bristow, Phil
Endecott, Thomas Klimpel, Tom Brinkman.
We also thank all people who discussed on the mailing lists (either at boost,
or at osgeo) about __boost_geometry__, in preview stage, or in review stage,
or after that.
Furthermore we are thankful to people supplying patches: Arnold Metselaar,
Aleksey Tulinov, Christophe Henry
Finally I (Barend) would like to thank my former employer, Geodan. They
allowed me to start a geographic library in 1995, which after a number of
incarnations, redesigns, refactorings, previews, a review and even more
refactorings have led to the now released __boost_geometry__. And with them I
want to thank the team initially involved in developing the library, Valik
Solorzano Barboza, Maarten Hilferink, Anne Blankert, and later Sjoerd
Schreuder, Steven Fruijtier, Paul den Dulk, and Joris Sierman.
[endsect]
@@ -0,0 +1,121 @@
[/==============================================================================
Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
Copyright (c) 2009-2012 Mateusz Loskot, London, UK., London, UK
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)
===============================================================================/]
[section Compilation]
[def __msvc__ MSVC]
[def __stlport__ [@http://sourceforge.net/projects/stlport STLport]]
[caution Boost.Geometry in Boost 1.73 deprecates support for the C++03 and will require C++14 from Boost 1.75 onwards]
__boost_geometry__ is a headers-only library. Users only need to include the
library headers in their programs in order to be able to access definitions
and algorithms provided by the __boost_geometry__ library. No linking against
any binaries is required.
__boost_geometry__ is only dependant on headers-only __boost__ libraries.
It does not introduce indirect dependencies on any binary libraries.
In order to be able to use __boost_geometry__, the only thing users need to do
is to download and/or install Boost and specify location to include
directories, so `include` directives of this scheme will work:
#include <boost/...>
[heading Supported Compilers]
__boost_geometry__ library source code should successfully compile using any compiler with complete C++14 support.
For the actual list of currently tested compilers, check results of the library CI builds linked
from the [@https://github.com/boostorg/geometry/blob/develop/README.md README.md]
or inspect the CI services configuration files in the [@https://github.com/boostorg/geometry/tree/develop develop branch]
of the library repository.
__boost_geometry__ uses __boost_bb__, a text-based system for developing and
testing software, to configure, build and execute unit tests and example
programs. The build configuration is provided as a collection of `Jamfile`
files.
For gcc, flag [^-Wno-long-long] can be used to surpress some warnings
originating from Boost.
[heading Includes]
The most convenient headerfile including all algorithms and strategies is
`geometry.hpp`:
#include <boost/geometry.hpp>
This is the main header of the __boost_geometry__ library and it is
recommended to include this file.
Alternatively, it is possible to include __boost_geometry__ header files
separately. However, this may be inconvenient as header files might be renamed
or moved occasionaly in future.
Another often used header is `geometries.hpp`:
#include <boost/geometry/geometries/geometries.hpp>
This includes definitions of all provided geometry types:
* point,
* linestring,
* polygon,
* ring,
* multi_point,
* multi_linestring,
* multi_polygon,
* box,
* segment.
The file `geometries.hpp` is not included in
the `geometry.hpp` headerfile because users should be given the liberty to use
their own geometries and not the provided ones. However, for the
__boost_geometry__ users who want to use the provided geometries it is useful
to include.
[heading Advanced Includes]
Users who have their own geometries and want to use algorithms from
__boost_geometry__ might include the files containing registration
macro's, like:
#include <boost/geometry/geometries/register/point.hpp>
[heading Performance]
The enumeration below is not exhaustive but can contain hints to improve the
performance:
* For Microsoft __msvc__, set define `_SECURE_SCL=0` for preprocessor.
* For Microsoft __msvc__, set define `_HAS_ITERATOR_DEBUGGING=0` for preprocessor.
* Use of __stlport__, a popular open-source implementation of the STL, may result in
significantly faster code than use of the C++ standard library provided by __msvc__.
* Turn on compiler optimizations, compile in release mode.
[heading Problems with Intellisense]
Both versions of __msvc__, 2005 and 2008 (including Express Editions) can hang
trying to resolve symbols and give [@http://en.wikipedia.org/wiki/IntelliSense
IntelliSense] suggestions while typing in a bracket or angle bracket.
This is not directly related to __boost_geometry__, but is caused by problems
with handling by this IDE large C++ code base with intensively used templates,
such as Boost and __boost_geometry__. If this is inconvenient, IntelliSense
can be turned off:
[:['["(...)disabling IntelliSense in VC++. There is a file called `feacp.dll` in
`<VS8INSTALL>/VC/vcpackages` folder. Renaming this file will disable Intellisense feature.]]
-- [@http://blogs.msdn.com/yash/archive/2007/09/19/intellisense-issues-in-visual-c-2005.aspx Intellisense issues in Visual C++ 2005]
]
[endsect] [/ end of Compilation]
@@ -0,0 +1,42 @@
[/============================================================================
Boost.Geometry (aka GGL, Generic Geometry Library)
Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
Copyright (c) 2009-2012 Barend Gehrels, Amsterdam, the Netherlands.
Copyright (c) 2009-2012 Bruno Lalande, Paris, France.
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)
=============================================================================/]
[section:concept_box Box Concept]
[heading Description]
[concept Box..box]
A box is a geometry with (usually) two or three dimensions, having its axis aligned to the coordinate system.
The box is not one of the basic types in Boost.Geometry (point, linestring, polygon) but it is a ['helper type].
The main reasons for the box existance are its usefulness for indexing (a spatial index, or splitting a geometry
into monotonic sections) and it is the output of the [link geometry.reference.algorithms.envelope envelope] algorithm.
Therefore, a box is axis aligned (the envelope is also called aabb, axis aligned bounding box).
[heading Concept Definition]
The Box Concept is defined as following:
* there must be a specialization of `traits::tag`, defining `box_tag` as type
* there must be a specialization of `traits::point_type` to define the underlying point type
(even if it does not consist of points, it should define this type, to indicate the points it can work with)
* there must be a specialization of `traits::indexed_access`, per index (`min_corner`, `max_corner`) and per dimension, with two functions:
* `get` to get a coordinate value
* `set` to set a coordinate value (this one is not checked for ConstBox)
[heading Available Models]
* [link geometry.reference.models.model_box model::box]
[endsect]
@@ -0,0 +1,45 @@
[/============================================================================
Boost.Geometry (aka GGL, Generic Geometry Library)
Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
Copyright (c) 2009-2012 Barend Gehrels, Amsterdam, the Netherlands.
Copyright (c) 2009-2012 Bruno Lalande, Paris, France.
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)
=============================================================================/]
[section:concept_linestring Linestring Concept]
[heading Description]
[concept Linestring..linestring]
A linestring is ['a Curve with linear interpolation between Points].
(__ogc_sf__).
[heading Concept Definition]
The Linestring Concept is defined as following:
* there must be a specialization of `traits::tag` defining `linestring_tag` as type
* it must behave like a Boost.Range Random Access Range
* The type defined by the metafunction `range_value<...>::type` must fulfill
the [link geometry.reference.concepts.concept_point Point Concept]
[heading Rules]
Besides the Concepts, which are checks on compile-time, there are rules that
valid linestrings must fulfill. Most algorithms work on any linestring, so either
self-crossing or not. However, for correct results using the overlay algorithms
(intersection and difference algorithms in combination with a polygon)
self-intersections can disturb the process and result in incorrect results.
[heading Available Models]
* [link geometry.reference.models.model_linestring model::linestring]
* a std::vector (requires registration)
* a std::deque (requires registration)
[see_boost_range_sample Linestring]
[endsect]
@@ -0,0 +1,31 @@
[/============================================================================
Boost.Geometry (aka GGL, Generic Geometry Library)
Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
Copyright (c) 2009-2012 Barend Gehrels, Amsterdam, the Netherlands.
Copyright (c) 2009-2012 Bruno Lalande, Paris, France.
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)
=============================================================================/]
[section:concept_multi_linestring MultiLinestring Concept]
[heading Description]
[concept MultiLinestring..multi linestring]
[heading Concept Definition]
The MultiLinestring Concept is defined as following:
* There must be a specialization of the metafunction `traits::tag`, defining `multi_linestring_tag` as type
* It must behave like a Boost.Range Random Access Range
* The type defined by the metafunction `range_value<...>::type` must fulfill
the [link geometry.reference.concepts.concept_linestring Linestring Concept]
[heading Available Models]
* [link geometry.reference.models.model_multi_linestring model::multi_linestring]
[endsect]
@@ -0,0 +1,31 @@
[/============================================================================
Boost.Geometry (aka GGL, Generic Geometry Library)
Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
Copyright (c) 2009-2012 Barend Gehrels, Amsterdam, the Netherlands.
Copyright (c) 2009-2012 Bruno Lalande, Paris, France.
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)
=============================================================================/]
[section:concept_multi_point MultiPoint Concept]
[heading Description]
[concept MultiPoint..multi point]
[heading Concept Definition]
The MultiPoint Concept is defined as following:
* There must be a specialization of the metafunction `traits::tag`, defining `multi_point_tag` as type
* It must behave like a Boost.Range Random Access Range
* The type defined by the metafunction `range_value<...>::type` must fulfill the [link geometry.reference.concepts.concept_point Point Concept]
[heading Available Models]
* [link geometry.reference.models.model_multi_point model::multi_point]
[endsect]
@@ -0,0 +1,44 @@
[/============================================================================
Boost.Geometry (aka GGL, Generic Geometry Library)
Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
Copyright (c) 2009-2012 Barend Gehrels, Amsterdam, the Netherlands.
Copyright (c) 2009-2012 Bruno Lalande, Paris, France.
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)
=============================================================================/]
[section:concept_multi_polygon MultiPolygon Concept]
[heading Description]
[concept MultiPolygon..multi polygon]
[heading Concept Definition]
The MultiPolygon Concept is defined as following:
* There must be a specialization of the metafunction `traits::tag`, defining `multi_polygon_tag` as type
* It must behave like a Boost.Range Random Access Range
* The type defined by the metafunction `range_value<...>::type` must fulfill
the [link geometry.reference.concepts.concept_polygon Polygon Concept]
[heading Rules]
Besides the Concepts, which are checks on compile-time, there are
rules that valid MultiPolygons must fulfill. See the
[link geometry.reference.concepts.concept_polygon Polygon Concept] for more information
on the rules a polygon (and also a multi polygon) must fulfill.
Additionally:
* Individual polygons making up a multi-polygon may not intersect each other,
but tangencies are allowed.
* One polygon might be located within the interior ring of another polygon.
[heading Available Models]
* [link geometry.reference.models.model_multi_polygon model::multi_polygon]
[endsect]
@@ -0,0 +1,75 @@
[/============================================================================
Boost.Geometry (aka GGL, Generic Geometry Library)
Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
Copyright (c) 2009-2012 Barend Gehrels, Amsterdam, the Netherlands.
Copyright (c) 2009-2012 Bruno Lalande, Paris, France.
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)
=============================================================================/]
[section:concept_point Point Concept]
[heading Description]
[concept Point..point]
A point is ['an entity that has a location in space or on a plane, but has no extent] ([@http://en.wikipedia.org/wiki/Point_(geometry) wiki]).
The point is the most basic geometry of Boost.Geometry, most other geometries consist of points.
['(Exceptions are box and segment, which might consist of two points but that is not necessarily the case.)]
[heading Concept Definition]
The Point Concept is defined as following:
* there must be a specialization of `traits::tag`, defining `point_tag` as type
* there must be a specialization of `traits::coordinate_type`, defining the type of its coordinates
* there must be a specialization of `traits::coordinate_system`, defining its coordinate system
(cartesian, spherical, etc)
* there must be a specialization of `traits::dimension`, defining its number of dimensions (2, 3, ...)
(hint: derive it conveniently from `boost::mpl::int_<X>` for X Dimensional)
* there must be a specialization of `traits::access`, per dimension, with two functions:
* `get` to get a coordinate value
* `set` to set a coordinate value (this one is not checked for ConstPoint)
[heading Example]
While you can `#include boost/geometry/geometries/adapted/std_array.hpp` to use `std::array<T, D>` to model the Point concept,
the following code spells it out in detail, as you might use for your own point types:
```
namespace boost { namespace geometry { namespace traits
{
template <typename T, std::size_t D> struct tag<std::array<T, D>> { using type = point_tag; };
template <typename T, std::size_t D> struct dimension<std::array<T, D>> : boost::mpl::int_<D> {};
template <typename T, std::size_t D> struct coordinate_type<std::array<T, D>> { using type = T; };
template <typename T, std::size_t D> struct coordinate_system<std::array<T, D>> { using type = boost::geometry::cs::cartesian; };
template <typename T, std::size_t D, std::size_t Index>
struct access<std::array<T, D>, Index> {
static_assert(Index < D, "Out of range");
using Point = std::array<T, D>;
using CoordinateType = typename coordinate_type<Point>::type;
static inline CoordinateType get(Point const& p) { return p[Index]; }
static inline void set(Point& p, CoordinateType const& value) { p[Index] = value; }
};
}}} // namespace boost::geometry::traits
```
[heading Available Models]
* [link geometry.reference.models.model_point model::point]
* [link geometry.reference.models.model_d2_point_xy model::d2::point_xy]
* a lat long point (currently in an extension)
* [link geometry.reference.adapted.c_array C array]
* [link geometry.reference.adapted.std_array C++ array container]
* [link geometry.reference.adapted.boost_array Boost.Array]
* [link geometry.reference.adapted.boost_fusion Boost.Fusion]
* [link geometry.reference.adapted.boost_polygon Boost.Polygon]
* [link geometry.reference.adapted.boost_tuple Boost.Tuple]
* other point types, adapted e.g. using one of the [link geometry.reference.adapted.register registration macro's]
[endsect]
@@ -0,0 +1,73 @@
[/============================================================================
Boost.Geometry (aka GGL, Generic Geometry Library)
Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
Copyright (c) 2009-2012 Barend Gehrels, Amsterdam, the Netherlands.
Copyright (c) 2009-2012 Bruno Lalande, Paris, France.
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)
=============================================================================/]
[section:concept_polygon Polygon Concept]
[heading Description]
[concept Polygon..polygon]
A polygon is ['A polygon is a planar surface defined by one exterior boundary and zero or more interior boundaries]
(__ogc_sf__).
So the definition of a Boost.Geometry polygon differs a bit from e.g. Wiki, where a polygon does not have holes. A
polygon of Boost.Geometry is a polygon with or without holes.
['(A polygon without holes is a ['helper geometry] within Boost.Geometry, and referred to as a ring.)]
[heading Concept Definition]
The Polygon Concept is defined as following:
* there must be a specialization of `traits::tag` defining `polygon_tag` as type
* there must be a specialization of `traits::ring_mutable_type` defining the mutable types of its exterior and interior rings as type
* there must be a specialization of `traits::ring_const_type` defining the constant types of its exterior and interior rings as type
* `traits::ring_mutable_type` and `traits::ring_const_type` must fulfill the [link geometry.reference.concepts.concept_ring Ring Concept]
* there must be a specialization of `traits::interior_mutable_type` defining the mutable type of the collection of its interior rings as type;
* there must be a specialization of `traits::interior_const_type` defining the constant type of the collection of its interior rings as type;
each of these collections itself must fulfill a Boost.Range Random Access Range Concept
* there must be a specialization of `traits::exterior_ring` with two functions named `get`, returning the exterior ring, one being const, the other being non const
* there must be a specialization of `traits::interior_rings` with two functions named `get`, returning the interior rings, one being const, the other being non const
[heading Rules]
Besides the Concepts, which are checks on compile-time, there are some other
rules that valid polygons must fulfill. This follows the opengeospatial rules (see link
above).
* Polygons are simple geometric objects (See also [@http://en.wikipedia.org/wiki/Simple_polygon wiki]
but holes are allowed in __boost_geometry__ polygons).
* If the polygons underlying `ring_type` is defined as clockwise, the exterior
ring must have the clockwise orientation, and any interior ring must be
reversed w.r.t. the defined orientation (so: counter clockwise for clockwise exterior rings).
If the `ring_type` is defined counter clockwise, it is vice versa.
* If the polygons underlying `ring_type` is defined as closed, all rings must be
closed: the first point must be spatially equal to the last point.
* The interior is a connected point set.
* There should be no self intersections, but self tangencies (between
exterior/interior rings) are allowed (as long as the interior is a connected
point set.
* There should be no cut lines, spikes or punctures.
* The interior rings should be located within the exterior ring. Interior rings
may not be located within each other.
The algorithms such as intersection, area, centroid, union, etc. do not check
validity. There will be an algorithm is_valid which checks for
validity against these rules, at runtime, and which can be called (by the library
user) before.
If the input is invalid, the output might be invalid too. For example: if a polygon
which should be closed is not closed, the area will be incorrect.
[heading Available Models]
* [link geometry.reference.models.model_polygon polygon]
* a Boost.Polygon polygon_with_holes_data (requires `#include boost/geometry/geometries/adapted/boost_polygon/polygon.hpp>`)
[endsect]
@@ -0,0 +1,44 @@
[/============================================================================
Boost.Geometry (aka GGL, Generic Geometry Library)
Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
Copyright (c) 2009-2012 Barend Gehrels, Amsterdam, the Netherlands.
Copyright (c) 2009-2012 Bruno Lalande, Paris, France.
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)
=============================================================================/]
[section:concept_ring Ring Concept]
[heading Description]
[concept Ring..ring]
[note Also called linear ring, but we explicitly refer to a filled feature here]
[heading Concept Definition]
The Ring Concept is defined as following:
* there must be a specialization of `traits::tag` defining `ring_tag` as type
* it must behave like a Boost.Range Random Access Range
* The type defined by the metafunction `range_value<...>::type` must fulfill
the [link geometry.reference.concepts.concept_point Point Concept]
* there might be a specialization of `traits::point_order` defining the order or orientation of its points, `clockwise` or `counterclockwise`
* there might be a specialization of `traits::closure` defining the closure, `open` or `closed`
[heading Rules]
Besides the Concepts, which are checks on compile-time, there are
rules that valid rings must fulfill. See the
[link geometry.reference.concepts.concept_polygon Polygon Concept] for more information
on the rules a polygon (and also a ring) must fulfill.
[heading Available Models]
* [link geometry.reference.models.model_ring ring]
* a Boost.Polygon polygon_data (requires `#include boost/geometry/geometries/adapted/boost_polygon/ring.hpp>`)
[see_boost_range_sample Ring]
[endsect]
@@ -0,0 +1,35 @@
[/============================================================================
Boost.Geometry (aka GGL, Generic Geometry Library)
Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
Copyright (c) 2009-2012 Barend Gehrels, Amsterdam, the Netherlands.
Copyright (c) 2009-2012 Bruno Lalande, Paris, France.
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)
=============================================================================/]
[section:concept_segment Segment Concept]
[heading Description]
[concept Segment..segment]
[heading Concept Definition]
* there must be a specialization of `traits::tag` defining `segment_tag` as type
* there must be a specialization of `traits::point_type` to define the underlying point type
(even if it does not consist of points, it should define this type, to indicate the points it can work with)
* there must be a specialization of `traits::indexed_access`, per index and per dimension, with two functions:
* `get` to get a coordinate value
* `set` to set a coordinate value (this one is not checked for ConstSegment)
[note The segment concept is similar to the box concept, defining using another tag.
However, the box concept assumes the index as `min_corner`, `max_corner`, while for the segment concept, there is no assumption.]
[heading Available Models]
* [link geometry.reference.models.model_segment model::segment]
* [link geometry.reference.models.model_referring_segment referring segment]
[endsect]
@@ -0,0 +1,41 @@
===========================================================================
Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
Copyright (c) 2009-2011 Mateusz Loskot, London, UK.
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)
============================================================================
The default copyright note for C++ source files reads:
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2011 Mateusz Loskot, London, UK.
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
// 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)
Exceptions:
1) Major work of any author -> might change order, change date
2) Exclusive work of one author including design -> might take sole copyright
Examples:
- adapted geometry types e.g. array, Boost.Polygon
- implemented file-format e.g. WKB
- implemented specific strategy or algorithm e.g. intersections
3) Examples -> might take sole copyright
4) Tests -> might take sole copyright
5) Docs -> might take sole copyright
6) Utilities e.g. converters -> might take sole copyright
The copyright note for other (source) files as .py, Jamfiles, etc is similar
and comments are changed accordingly.
@@ -0,0 +1,22 @@
# ===========================================================================
# Copyright (c) 2024-2024 Barend Gehrels, Amsterdam, the Netherlands.
#
# 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)
# ============================================================================
# Removes all generated output
b2 clean
rm -f index/generated/*.qbk
rm -f generated/*.qbk
rm -f generated/*.xml
rm -Rf html/geometry
rm -Rf doxy/doxygen_output/xml
rm -Rf doxy/doxygen_output/html_by_doxygen
rm -Rf index/xml
rm -Rf index/html_by_doxygen
git ls-files --others
@@ -0,0 +1,153 @@
# ===========================================================================
# Copyright (c) 2024-2024 Barend Gehrels, Amsterdam, the Netherlands. #
# 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)
# ============================================================================
# Makes the documentation without calling b2, to be able to do it in steps
# and debug the individual steps.
#
# The following software must be in your path:
# - doxygen
# - xsltproc
# - python3
# - doxygen_xml2qbk (provided by Boost.Geometry)
# - quickbook (should be made, it is referred to in a relative path)
#
# Execute the script from .../boost/libs/geometry/doc
echo "=== Generating documentation for Boost.Geometry"
base=`pwd`
boost_root=`realpath ${base}/../../..`
# Set the DocBook (and dtd and boost dtd, less relevant) versions.
# 1.75.2 is the one setup within Boost for ages.
# It reports as debug message: "Computing chunks..."
# But it currently gives the error message
# "The called template 'id.attribute' was not found."
# For all libraries (not only Boost.Geometry)
# 1.79.1 works and gives correct documentation
# It does not output any extra debug message
# 1.79.2 (with namespaces, on mac) gives empty content for sub-toc pages for Boost.Geometry
# It reports as debug message: "Note: namesp. add : added namespace before processing Geometry"
# 1.79.2 ("nons", no namespace) works and gives correct documentation
# It can be downloaded from https://www.linuxfromscratch.org/blfs/view/stable/pst/docbook-xsl.html
# Set the values with 4.2 / 1.75.2 - used by setup_boostbook.sh
docbook_dtd_version=4.2
docbook_xsl_version=1.75.2
docbook_dtd=${boost_root}/tools/boostbook/docbook-dtd-${docbook_dtd_version}
docbook_xsl=${boost_root}/tools/boostbook/docbook-xsl-${docbook_xsl_version}
# OVERRIDE the values with 4.5 / 1.79.1 - used by boostorg/release-tools/blob/develop/build_docs
docbook_dtd_version=4.5
docbook_xsl_version=1.79.1
docbook_dtd=~/data/docbook/docbook-dtd-${docbook_dtd_version}
docbook_xsl=~/data/docbook/docbook-xsl-${docbook_xsl_version}
# UNCOMMENT the values with 4.5 / 1.79.2 - for future usage, note the "nons", which is essential
# docbook_xsl_version=1.79.2
# docbook_xsl=~/data/docbook/docbook-xsl-nons-${docbook_xsl_version}
# Set other values of dtd, css, style sheets
boostbook_dtd=${boost_root}/tools/boostbook/dtd
file_css=${boost_root}/doc/src/boostbook.css
xsl_docbook=${boost_root}/tools/boostbook/xsl/docbook.xsl
xsl_html=${boost_root}/tools/boostbook/xsl/html.xsl
# Set the folder where to generate boostbook/docbook and some filenames
folder_generated=generated
file_boostbook=${folder_generated}/geometry.boostbook.xml
file_docbook=${folder_generated}/geometry.docbook.xml
# === step 1 ===
echo "=== Running Doxygen"
cd doxy
doxygen Doxyfile
cd ..
# === step 2 ===
# Note that doxygen_xml2qbk should be in your path!
echo "=== From Doxygen XML to QuickBook"
python3 make_qbk.py --skip_doxygen
# === step 3 ===
echo "=== From QuickBook to BoostBook"
${boost_root}/dist/bin/quickbook -I"${boost_root}" -I"." -D"enable_index" \
--output-file=${file_boostbook} geometry.qbk
# === step 4 ===
# To avoid using b2 and user-config.jam, the catalog has to be written locally
filename_catalog=${folder_generated}/catalog.xml
echo "=== Write ${filename_catalog} for xstlproc with ${docbook_xsl}"
cat <<EOF >${filename_catalog}
<?xml version="1.0"?>
<!DOCTYPE catalog
PUBLIC "-//OASIS/DTD Entity Resolution XML Catalog V1.0//EN"
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<rewriteURI uriStartString="http://www.boost.org/tools/boostbook/dtd/" rewritePrefix="file:///${boostbook_dtd}/"/>
<rewriteURI uriStartString="http://www.oasis-open.org/docbook/xml/${docbook_dtd_version}/" rewritePrefix="file:///${docbook_dtd}/"/>
<rewriteURI uriStartString="http://docbook.sourceforge.net/release/xsl/current/" rewritePrefix="file:///${docbook_xsl}/"/>
</catalog>
EOF
# It is necessary to publish its location in an environment variable
export XML_CATALOG_FILES=${filename_catalog}
# Set parameters shared for Boostbook -> Docbook -> HTML
params="--xinclude"
params="${params} --stringparam boost.defaults Boost"
# Set boost.root (here, it should be relative, and go one above boost root itself)
params="${params} --stringparam boost.root ../../../.."
echo "=== From BoostBook to DocBook"
xsltproc ${params} --path ${folder_generated} -o ${file_docbook} ${xsl_docbook} ${file_boostbook}
# === step 5 ===
# These parameters define behaviour for DocBook.
# See also https://www.sagehill.net/docbookxsl/TOCcontrol.html
# The parameters values should correspond with the values in Jamfile.
# Their values are currently valid for docbook-xsl-1.75.2 (the version included in Boost).
# However, the sections.xsl file currently included boost do not work for 1.75.2
# If this is encountered, remove the part "<xsl:call-template name="id.attribute">"
# Their values are currently also valid for version 1.79.1
# But for version 1.79.2 is used, the chunking is broken.
chunk_section_depth=4
chunk_first_sections=1
toc_section_depth=3
toc_max_depth=2
generate_section_toc_level=4
params="${params} --stringparam chunk.section.depth ${chunk_section_depth}"
params="${params} --stringparam chunk.first.sections ${chunk_first_sections}"
params="${params} --stringparam toc.max.depth ${toc_max_depth}"
params="${params} --stringparam toc.section.depth ${toc_section_depth}"
params="${params} --stringparam generate.section.toc.level ${generate_section_toc_level}"
echo "=== From DocBook to html"
xsltproc ${params} --path ${folder_generated} -o "html/" ${xsl_html} ${file_docbook}
echo "=== Resulting html, generated with:"
cat html/index.html| grep -w -e generator
echo "=== Resulting contents of generated 'adapted.html', there should be sections"
cat html/geometry/reference/adapted.html | grep section
@@ -0,0 +1,665 @@
[/==============================================================================
Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
Copyright (c) 2009-2012 Mateusz Loskot, London, UK., London, UK
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)
===============================================================================/]
[/ note the source code in this QBK is the only not (yet) checked by a compiler]
[section:design Design Rationale]
Suppose you need a C++ program to calculate the distance between two points.
You might define a struct:
struct mypoint
{
double x, y;
};
and a function, containing the algorithm:
double distance(mypoint const& a, mypoint const& b)
{
double dx = a.x - b.x;
double dy = a.y - b.y;
return sqrt(dx * dx + dy * dy);
}
Quite simple, and it is usable, but not generic. For a library it has to be
designed way further. The design above can only be used for 2D points, for the
struct [*mypoint] (and no other struct), in a Cartesian coordinate system. A
generic library should be able to calculate the distance:
* for any point class or struct, not on just this [*mypoint] type
* in more than two dimensions
* for other coordinate systems, e.g. over the earth or on a sphere
* between a point and a line or between other geometry combinations
* in higher precision than ['double]
* avoiding the square root: often we don't want to do that because it is a relatively expensive
function, and for comparing distances it is not necessary
In this and following sections we will make the design step by step more generic.
[heading Using Templates]
The distance function can be changed into a template function. This is trivial and allows
calculating the distance between other point types than just [*mypoint]. We add two template
parameters, allowing input of two different point types.
template <typename P1, typename P2>
double distance(P1 const& a, P2 const& b)
{
double dx = a.x - b.x;
double dy = a.y - b.y;
return std::sqrt(dx * dx + dy * dy);
}
This template version is slightly better, but not much.
Consider a C++ class where member variables are protected...
Such a class does not allow to access `x` and `y` members directly. So, this paragraph is short
and we just move on.
[heading Using Traits]
We need to take a generic approach and allow any point type as input to the distance function.
Instead of accessing `x` and `y` members, we will add a few levels of indirection, using a
traits system. The function then becomes:
template <typename P1, typename P2>
double distance(P1 const& a, P2 const& b)
{
double dx = get<0>(a) - get<0>(b);
double dy = get<1>(a) - get<1>(b);
return std::sqrt(dx * dx + dy * dy);
}
This adapted distance function uses a generic get function, with dimension as a template parameter,
to access the coordinates of a point. This get forwards to the traits system, defined as following:
namespace traits
{
template <typename P, int D>
struct access {};
}
which is then specialized for our [*mypoint] type, implementing a static method called `get`:
namespace traits
{
template <>
struct access<mypoint, 0>
{
static double get(mypoint const& p)
{
return p.x;
}
};
// same for 1: p.y
...
}
Calling `traits::access<mypoint, 0>::get(a)` now returns us our `x` coordinate. Nice, isn't it?
It is too verbose for a function like this, used so often in the library. We can shorten the syntax
by adding an extra free function:
template <int D, typename P>
inline double get(P const& p)
{
return traits::access<P, D>::get(p);
}
This enables us to call `get<0>(a)`, for any point having the traits::access specialization,
as shown in the distance algorithm at the start of this paragraph. So we wanted to enable classes
with methods like `x()`, and they are supported as long as there is a specialization of the access
`struct` with a static `get` function returning `x()` for dimension 0, and similar for 1 and `y()`.
[heading Dimension Agnosticism]
Now we can calculate the distance between points in 2D, points of any structure or class.
However, we wanted to have 3D as well. So we have to make it dimension agnostic. This complicates
our distance function. We can use a `for` loop to walk through dimensions, but for loops have
another performance than the straightforward coordinate addition which was there originally.
However, we can make more usage of templates and make the distance algorithm as following,
more complex but attractive for template fans:
template <typename P1, typename P2, int D>
struct pythagoras
{
static double apply(P1 const& a, P2 const& b)
{
double d = get<D-1>(a) - get<D-1>(b);
return d * d + pythagoras<P1, P2, D-1>::apply(a, b);
}
};
template <typename P1, typename P2 >
struct pythagoras<P1, P2, 0>
{
static double apply(P1 const&, P2 const&)
{
return 0;
}
};
The distance function is calling that `pythagoras` structure, specifying the number of dimensions:
template <typename P1, typename P2>
double distance(P1 const& a, P2 const& b)
{
BOOST_STATIC_ASSERT(( dimension<P1>::value == dimension<P2>::value ));
return sqrt(pythagoras<P1, P2, dimension<P1>::value>::apply(a, b));
}
The dimension which is referred to is defined using another traits class:
``
namespace traits
{
template <typename P>
struct dimension {};
}
``
which has to be specialized again for the `struct mypoint`.
Because it only has to publish a value, we conveniently derive it from the
__boost_mpl__ `class boost::mpl::int_`:
``
namespace traits
{
template <>
struct dimension<mypoint> : boost::mpl::int_<2>
{};
}
``
Like the free get function, the library also contains a dimension meta-function.
template <typename P>
struct dimension : traits::dimension<P>
{};
Below is explained why the extra declaration is useful. Now we have agnosticism in the number of
dimensions. Our more generic distance function now accepts points of three or more dimensions.
The compile-time assertion will prevent point a having two dimension and point b having
three dimensions.
[heading Coordinate Type]
We assumed double above. What if our points are in integer?
We can easily add a traits class, and we will do that. However, the distance between two integer
coordinates can still be a fractionized value. Besides that, a design goal was to avoid square
roots. We handle these cases below, in another paragraph. For the moment we keep returning double,
but we allow integer coordinates for our point types. To define the coordinate type, we add
another traits class, `coordinate_type`, which should be specialized by the library user:
namespace traits
{
template <typename P>
struct coordinate_type{};
// specialization for our mypoint
template <>
struct coordinate_type<mypoint>
{
typedef double type;
};
}
Like the access function, where we had a free get function, we add a proxy here as well.
A longer version is presented later on, the short function would look like this:
template <typename P>
struct coordinate_type : traits::coordinate_type<P> {};
We now can modify our distance algorithm again. Because it still returns double, we only
modify the `pythagoras` computation class. It should return the coordinate type of its input.
But, it has two input, possibly different, point types. They might also differ in their
coordinate types. Not that that is very likely, but we’re designing a generic library and we
should handle those strange cases. We have to choose one of the coordinate types and of course
we select the one with the highest precision. This is not worked out here, it would be too long,
and it is not related to geometry. We just assume that there is a meta-function `select_most_precise`
selecting the best type.
So our computation class becomes:
template <typename P1, typename P2, int D>
struct pythagoras
{
typedef typename select_most_precise
<
typename coordinate_type<P1>::type,
typename coordinate_type<P2>::type
>::type computation_type;
static computation_type apply(P1 const& a, P2 const& b)
{
computation_type d = get<D-1>(a) - get<D-1>(b);
return d * d + pythagoras <P1, P2, D-1> ::apply(a, b);
}
};
[heading Different Geometries]
We have designed a dimension agnostic system supporting any point type of any
coordinate type. There are still some tweaks but they will be worked out later.
Now we will see how we calculate the distance between a point and a polygon, or
between a point and a line-segment. These formulae are more complex, and the
influence on design is even larger. We don’t want to add a function with another
name:
template <typename P, typename S>
double distance_point_segment(P const& p, S const& s)
We want to be generic, the distance function has to be called from code not
knowing the type of geometry it handles, so it has to be named distance. We also
cannot create an overload because that would be ambiguous, having the same
template signature. There are two solutions:
* tag dispatching
* SFINAE
We select tag dispatching because it fits into the traits system. The earlier
versions (previews) of Boost.Geometry used SFINAE but we found it had several
drawbacks for such a big design, so the switch to tag dispatching was made.
With tag dispatching the distance algorithm inspects the type of geometry of the
input parameters. The distance function will be changed into this:
template <typename G1, typename G2>
double distance(G1 const& g1, G2 const& g2)
{
return dispatch::distance
<
typename tag<G1>::type,
typename tag<G2>::type,
G1, G2
>::apply(g1, g2);
}
It is referring to the tag meta-function and forwarding the call to the [*apply] method of
a ['dispatch::distance] structure. The [*tag] meta-function is another traits class, and should
be specialized for per point type, both shown here:
namespace traits
{
template <typename G>
struct tag {};
// specialization
template <>
struct tag<mypoint>
{
typedef point_tag type;
};
}
Free meta-function, like coordinate_system and get:
template <typename G>
struct tag : traits::tag<G> {};
[*Tags] (`point_tag`, `segment_tag`, etc) are empty structures with the purpose to specialize a
dispatch struct. The dispatch struct for distance, and its specializations, are all defined
in a separate namespace and look like the following:
namespace dispatch {
template < typename Tag1, typename Tag2, typename G1, typename G2 >
struct distance
{};
template <typename P1, typename P2>
struct distance < point_tag, point_tag, P1, P2 >
{
static double apply(P1 const& a, P2 const& b)
{
// here we call pythagoras
// exactly like we did before
...
}
};
template <typename P, typename S>
struct distance
<
point_tag, segment_tag, P, S
>
{
static double apply(P const& p, S const& s)
{
// here we refer to another function
// implementing point-segment
// calculations in 2 or 3
// dimensions...
...
}
};
// here we might have many more
// specializations,
// for point-polygon, box-circle, etc.
} // namespace
So yes, it is possible; the distance algorithm is generic now in the sense that it also
supports different geometry types. One drawback: we have to define two dispatch specializations
for point - segment and for segment - point separately. That will also be solved, in the paragraph
reversibility below. The example below shows where we are now: different point types,
geometry types, dimensions.
point a(1,1);
point b(2,2);
std::cout << distance(a,b) << std::endl;
segment s1(0,0,5,3);
std::cout << distance(a, s1) << std::endl;
rgb red(255, 0, 0);
rbc orange(255, 128, 0);
std::cout << "color distance: " << distance(red, orange) << std::endl;
[heading Kernel Revisited]
We described above that we had a traits class `coordinate_type`, defined in namespace traits,
and defined a separate `coordinate_type` class as well. This was actually not really necessary
before, because the only difference was the namespace clause. But now that we have another
geometry type, a segment in this case, it is essential. We can call the `coordinate_type`
meta-function for any geometry type, point, segment, polygon, etc, implemented again by tag dispatching:
template <typename G>
struct coordinate_type
{
typedef typename dispatch::coordinate_type
<
typename tag<G>::type, G
>::type type;
};
Inside the dispatch namespace this meta-function is implemented twice: a generic version and
one specialization for points. The specialization for points calls the traits class.
The generic version calls the point specialization, as a sort of recursive meta-function definition:
namespace dispatch
{
// Version for any geometry:
template <typename GeometryTag, typename G>
struct coordinate_type
{
typedef typename point_type
<
GeometryTag, G
>::type point_type;
// Call specialization on point-tag
typedef typename coordinate_type < point_tag, point_type >::type type;
};
// Specialization for point-type:
template <typename P>
struct coordinate_type<point_tag, P>
{
typedef typename
traits::coordinate_type<P>::type
type;
};
}
So it calls another meta-function point_type. This is not elaborated in here but realize that it
is available for all geometry types, and typedefs the point type which makes up the geometry,
calling it type.
The same applies for the meta-function dimension and for the upcoming meta-function coordinate system.
[heading Coordinate System]
Until here we assumed a Cartesian system. But we know that the Earth is not flat.
Calculating a distance between two GPS-points with the system above would result in nonsense.
So we again extend our design. We define for each point type a coordinate system type
using the traits system again. Then we make the calculation dependant on that coordinate system.
Coordinate system is similar to coordinate type, a meta-function, calling a dispatch function
to have it for any geometry-type, forwarding to its point specialization, and finally calling
a traits class, defining a typedef type with a coordinate system. We don’t show that all here again.
We only show the definition of a few coordinate systems:
struct cartesian {};
template<typename DegreeOrRadian>
struct geographic
{
typedef DegreeOrRadian units;
};
So Cartesian is simple, for geographic we can also select if its coordinates are stored in degrees
or in radians.
The distance function will now change: it will select the computation method for the corresponding
coordinate system and then call the dispatch struct for distance. We call the computation method
specialized for coordinate systems a strategy. So the new version of the distance function is:
template <typename G1, typename G2>
double distance(G1 const& g1, G2 const& g2)
{
typedef typename strategy_distance
<
typename coordinate_system<G1>::type,
typename coordinate_system<G2>::type,
typename point_type<G1>::type,
typename point_type<G2>::type,
dimension<G1>::value
>::type strategy;
return dispatch::distance
<
typename tag<G1>::type,
typename tag<G2>::type,
G1, G2, strategy
>::apply(g1, g2, strategy());
}
The strategy_distance mentioned here is a struct with specializations for different coordinate
systems.
template <typename T1, typename T2, typename P1, typename P2, int D>
struct strategy_distance
{
typedef void type;
};
template <typename P1, typename P2, int D>
struct strategy_distance<cartesian, cartesian, P1, P2, D>
{
typedef pythagoras<P1, P2, D> type;
};
So, here is our `pythagoras` again, now defined as a strategy. The distance dispatch function just
calls its apply method.
So this is an important step: for spherical or geographical coordinate systems, another
strategy (computation method) can be implemented. For spherical coordinate systems
have the haversine formula. So the dispatching traits struct is specialized like this
template <typename P1, typename P2, int D = 2>
struct strategy_distance<spherical, spherical, P1, P2, D>
{
typedef haversine<P1, P2> type;
};
// struct haversine with apply function
// is omitted here
For geography, we have some alternatives for distance calculation. There is the Andoyer method,
fast and precise, and there is the Vincenty method, slower and more precise, and there are some
less precise approaches as well.
Per coordinate system, one strategy is defined as the default strategy. To be able to use
another strategy as well, we modify our design again and add an overload for the distance
algorithm, taking a strategy object as a third parameter.
This new overload distance function also has the advantage that the strategy can be constructed
outside the distance function. Because it was constructed inside above, it could not have
construction parameters. But for Andoyer or Vincenty, or the haversine formula, it certainly
makes sense to have a constructor taking the radius of the earth as a parameter.
So, the distance overloaded function is:
template <typename G1, typename G2, typename S>
double distance(G1 const& g1, G2 const& g2, S const& strategy)
{
return dispatch::distance
<
typename tag<G1>::type,
typename tag<G2>::type,
G1, G2, S
>::apply(g1, g2, strategy);
}
The strategy has to have a method apply taking two points as arguments (for points). It is not
required that it is a static method. A strategy might define a constructor, where a configuration
value is passed and stored as a member variable. In those cases a static method would be
inconvenient. It can be implemented as a normal method (with the const qualifier).
We do not list all implementations here, Vincenty would cover half a page of mathematics,
but you will understand the idea. We can call distance like this:
distance(c1, c2)
where `c1` and `c2` are Cartesian points, or like this:
distance(g1, g2)
where `g1` and `g2` are Geographic points, calling the default strategy for Geographic
points (e.g. Andoyer), and like this:
distance(g1, g2, vincenty<G1, G2>(6275))
where a strategy is specified explicitly and constructed with a radius.
[/ 'TODO: What to do with this section? We have concepts already --mloskot]
[heading Point Concept]
The five traits classes mentioned in the previous sections form together the
Point Concept. Any point type for which specializations are implemented in
the traits namespace should be accepted as a valid type. So the Point Concept
consists of:
* a specialization for `traits::tag`
* a specialization for `traits::coordinate_system`
* a specialization for `traits::coordinate_type`
* a specialization for `traits::dimension`
* a specialization for `traits::access`
The last one is a class, containing the method get and the (optional) method
set, the first four are metafunctions, either defining type or declaring a
value (conform MPL conventions).
So we now have agnosticism for the number of dimensions, agnosticism for
coordinate systems; the design can handle any coordinate type, and it can
handle different geometry types. Furthermore we can specify our own
strategies, the code will not compile in case of two points with different
dimensions (because of the assertion), and it will not compile for two points
with different coordinate systems (because there is no specialization).
A library can check if a point type fulfills the requirements imposed by the
concepts. This is handled in the upcoming section Concept Checking.
[heading Return Type]
We promised that calling `std::sqrt` was not always necessary. So we define a distance result `struct`
that contains the squared value and is convertible to a double value. This, however, only has to
be done for `pythagoras`. The spherical distance functions do not take the square root so for them
it is not necessary to avoid the expensive square root call; they can just return their distance.
So the distance result struct is dependant on strategy, therefore made a member type of
the strategy. The result struct looks like this:
template<typename T = double>
struct cartesian_distance
{
T sq;
explicit cartesian_distance(T const& v) : sq (v) {}
inline operator T() const
{
return std::sqrt(sq);
}
};
It also has operators defined to compare itself to other results without taking the square root.
Each strategy should define its return type, within the strategy class, for example:
typedef cartesian_distance<T> return_type;
or:
typedef double return_type;
for cartesian (pythagoras) and spherical, respectively.
Again our distance function will be modified, as expected, to reflect the new return type.
For the overload with a strategy it is not complex:
template < typename G1, typename G2, typename Strategy >
typename Strategy::return_type distance( G1 const& G1 , G2 const& G2 , S const& strategy)
But for the one without strategy we have to select strategy, coordinate type, etc.
It would be spacious to do it in one line so we add a separate meta-function:
template <typename G1, typename G2 = G1>
struct distance_result
{
typedef typename point_type<G1>::type P1;
typedef typename point_type<G2>::type P2;
typedef typename strategy_distance
<
typename cs_tag<P1>::type,
typename cs_tag<P2>::type,
P1, P2
>::type S;
typedef typename S::return_type type;
};
and modify our distance function:
template <typename G1, typename G2>
inline typename distance_result<G1, G2>::type distance(G1 const& g1, G2 const& g2)
{
// ...
}
Of course also the apply functions in the dispatch specializations will return a result like this.
They have a strategy as a template parameter everywhere, making the less verbose version possible.
[heading Axis Order]
This is an important note for users who develop GIS applications, require compliance with OGC
standards or use variety of coordinate reference systems (CRS).
Boost.Geometry convention is that coordinate values of 2D tuple is always given according to
mathematical axis order: X,Y. Considering GIS applications, that always means easting,northing or,
in terms of geographic coordinate system: longitude,latitude.
Boost.Geometry does not allow or respect coordinate values listed in the axis order as
specified by coordinate reference system (CRS).
In practice, users may easily adapt point types with alternate axis ordering and
specify coordinate access in order as expected by Boost.Geometry.
[heading Summary]
In this design rationale, __boost_geometry__ is step by step designed using tag dispatching,
concepts, traits, and metaprogramming. We used the well-known distance function
to show the design.
__boost_geometry__ is designed like described here, with
some more techniques as automatically reversing template arguments, tag casting,
and reusing implementation classes or dispatch classes as policies in other
dispatch classes.
[endsect] [/ end of section Design Rationale]
@@ -0,0 +1,350 @@
# Doxyfile 1.5.5
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "Boost.Geometry (aka GGL)"
PROJECT_NUMBER =
OUTPUT_DIRECTORY = ./doxygen_output
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF =
ALWAYS_DETAILED_SEC = YES
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = YES
STRIP_FROM_PATH = c:/_svn/boost/trunk/boost/geometry \
c:/_svn/boost/trunk/libs/geometry/doc/doxygen_input/pages
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 8
# The aliases are shortcuts for Doxygen documentation.
# Within Boost.Geometry they are used in the top section, so for both
# Doxygen documentation and QuickBook documentation.
# They avoid repetations and make the documentation more structured.
# There are also qbk expressions, which might qbk defines and templates.
# There are sections for
# \brief* for various brief descriptions
# \tparam* for various template parameters
# \param* for various parameters
# \return* for various return cases
ALIASES = qbk{1}="\xmlonly <qbk>\1</qbk> \endxmlonly" \
qbk{2}="\xmlonly <qbk.\1>\2</qbk.\1> \endxmlonly" \
wkt="WKT" \
well_known_text="Well-Known Text" \
brief_calc{1}="Calculates the \1 of a geometry" \
brief_calc2{1}="Calculate the \1 of two geometries" \
brief_calc2{2}="Calculate the \1 \2 two geometries" \
brief_check{1}="Checks if a geometry \1" \
brief_check2{1}="Checks if two geometries \1" \
brief_check12{1}="Checks if the first geometry \1 the second geometry" \
brief_strategy="using the specified strategy" \
brief_macro{1}="Macro to register a \1" \
brief_macro_const=" (const version)" \
brief_macro_getset=" (having separate get/set methods)" \
brief_meta{3}="Metafunction defining [*\1] as the \2 of the \3" \
tparam_allocator="container-allocator-type" \
tparam_box="Any type fulfilling a Box Concept" \
tparam_box_or_segment="Any type fulfilling a Box Concept or a Segment Concept" \
tparam_calculation="numeric type for calculation (e.g. high precision); if [*void] then it is extracted automatically from the coordinate type and (if necessary) promoted to floating point" \
tparam_radius="numeric type for radius (of sphere, earth)" \
tparam_radius_or_sphere="numeric type for radius (of sphere, earth) or sphere model" \
tparam_container="container type, for example std::vector, std::deque" \
tparam_dimension_required="Dimension, this template parameter is required. Should contain \\[0 .. n-1\\] for an n-dimensional geometry" \
tparam_functor="Function or class with operator()" \
tparam_output_collection="output collection, either a multi-geometry, or a std::vector<Geometry> / std::deque<Geometry> etc" \
tparam_geometry="Any type fulfilling a Geometry Concept" \
tparam_geometry{1}="A type fulfilling the \1 Concept" \
tparam_index_required="Index, this template parameter is required. For a Box: either min_corner or max_corner. For a Segment: either 0 or 1 for first or last point." \
tparam_numeric="numerical type (int, double, ttmath, ...)" \
tparam_out{1}="A valid output iterator type, accepting geometries of \1 Concept" \
tparam_point="Any type fulfilling a Point Concept" \
tparam_range_point="Any type fulfilling a Range Concept where it range_value type fulfills the Point Concept" \
tparam_first_point="first point type" \
tparam_first_box="first box type" \
tparam_second_point="second point type" \
tparam_second_box="second box type" \
tparam_segment_point="segment point type" \
tparam_strategy{1}="Any type fulfilling a \1 Strategy Concept" \
tparam_strategy_overlay="Compound strategy for segment intersection" \
param_box="A model of the specified Box Concept" \
param_box_or_segment="A box modelling the specified Box Concept or segment modelling the specified Segment Concept" \
param_geometry="A model of the specified concept" \
param_out{1}="The output iterator, to which \1 geometries are feeded" \
param_point="A model of the specified Point Concept" \
param_set{1}="which is set to the \1" \
param_strategy{1}="The strategy which will be used for \1 calculations" \
param_macro_type{1}="\1 type to be registered" \
param_macro_coortype{1}="Type of the coordinates of the \1 (e.g. double)" \
param_macro_coorsystem="Coordinate system (e.g. cs::cartesian)" \
param_macro_member{1}="Member containing \1 coordinate" \
param_macro_getset{2}="Method to \1 the \2 coordinate" \
param_range_point="A range containg points fulfilling range and point concepts" \
param_x="First coordinate (usually x-coordinate)" \
param_y="Second coordinate (usually y-coordinate)" \
param_z="Third coordinate (usually z-coordinate)" \
constructor_default_no_init="Default constructor, no initialization" \
constructor_default{1}="Default constructor, creating an empty \1" \
constructor_begin_end{1}="Constructor with begin and end, filling the \1" \
constructor_initializer_list{1}="Constructor taking std::initializer_list, filling the \1" \
assignment_initializer_list{1}="Assignment operator taking std::initializer_list, assigning values to the \1" \
details_calc{2}="The free function \1 calculates the \2 of a geometry" \
details_calc{1}="The free function \1 calculates the \1 of a geometry" \
details_calc2{2}="The free function \1 calculates the \2 of two geometries" \
details_calc2{1}="The free function \1 calculates the \1 of two geometries" \
details_free_function{3}="The free function [^\1] calculates the \2 \3 two geometries" \
details_check12{2}="The free function \1 checks if the first geometry \2 the second geometry" \
details_macro{2}="The macro \1 registers a \2 such that it is recognized by Boost.Geometry and that Boost.Geometry functionality can used with the specified type." \
details_macro_const="The const version registers only read access to the fields, the point type is therefore read-only." \
details_macro_getset="The get/set version registers get and set methods separately and can be used for classes with protected member variables and get/set methods to change coordinates." \
details_macro_templated{2}="The type must have one template parameter, which should be a \2 type, and should not be specified. Boost.Geometry takes care of inserting the template parameter. Hence all types of this templated \1 are registered, regardless of their point type." \
details_macro_lola="For geographic coordinate systems, be sure to specify first longitude and then latitude, to be able to use the strategies included in the library." \
details_default_strategy="It uses the default strategy, based on the coordinate system of the geometry." \
details_strategy_reasons="Reasons to specify a strategy include: use another coordinate system for calculations; construct the strategy beforehand (e.g. with the radius of the Earth); select a strategy when there are more than one available for a calculation." \
details_return{1}="This version with the return_ prefix returns the \1, and a template parameter must therefore be specified in the call." \
details_insert{1}="This version with the _insert suffix outputs the \1 to an output iterator, and a template parameter must therefore be specified in the call." \
details_get_set="The free functions [*get] and [*set] are two of the most important functions of Boost.Geometry, both within the library, as also for the library user. With these two functions you normally get and set coordinate values from and for a point, box, segment or sphere." \
details_make="Boost.Geometry uses concepts for all its geometries. It does not rely on constructors. The "make" functions are object generators creating geometries. There are overloads, currently with two or three coordinate values or ranges, to construct geometry instances" \
return_calc{1}="The calculated \1" \
return_check{1}="Returns true if the geometry \1" \
return_check2{1}="Returns true if two geometries \1" \
return_out="The output iterator" \
meta_geometry_type="specified geometry type" \
meta_point_type="point type making up the specified geometry type" \
brf_for_each{1}="Applies function [*f] to each \1" \
det_envelope="envelope (also known as axis aligned bounding box, aabb, or minimum bounding rectangle, mbr)" \
det_buffer="buffer (a polygon being the spatial point set collection within a specified maximum distance from a geometry)" \
det_for_each{1}="Applies a function [*f] (functor, having operator() defined) to each \1 making up the geometry" \
par_for_each_f{1}="Unary function, taking a \1 as argument" \
macro_x="first (usually x)" \
macro_y="second (usually y)" \
macro_z="third (usually z)" \
macro_x_lon="first (usually x, or longitude)" \
macro_y_lat="second (usually y, or latitude)" \
p_l_or_c="Point, LineString or Polygon"
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
BUILTIN_STL_SUPPORT = YES
CPP_CLI_SUPPORT = NO
SIP_SUPPORT = NO
DISTRIBUTE_GROUP_DOC = NO
SUBGROUPING = YES
TYPEDEF_HIDES_STRUCT = NO
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = YES
EXTRACT_PRIVATE = NO
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = NO
EXTRACT_LOCAL_METHODS = NO
EXTRACT_ANON_NSPACES = NO
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = NO
HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = NO
INLINE_INFO = NO
SORT_MEMBER_DOCS = NO
SORT_BRIEF_DOCS = YES
SORT_GROUP_NAMES = YES
SORT_BY_SCOPE_NAME = YES
GENERATE_TODOLIST = NO
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = NO
FILE_VERSION_FILTER =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = YES
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = . .. ../../../../boost/geometry/core \
../../../../boost/geometry/algorithms \
../../../../boost/geometry/algorithms/detail \
../../../../boost/geometry/algorithms/detail/buffer \
../../../../boost/geometry/algorithms/detail/closest_points \
../../../../boost/geometry/algorithms/detail/comparable_distance \
../../../../boost/geometry/algorithms/detail/convex_hull \
../../../../boost/geometry/algorithms/detail/covered_by \
../../../../boost/geometry/algorithms/detail/disjoint \
../../../../boost/geometry/algorithms/detail/distance \
../../../../boost/geometry/algorithms/detail/envelope \
../../../../boost/geometry/algorithms/detail/equals \
../../../../boost/geometry/algorithms/detail/expand \
../../../../boost/geometry/algorithms/detail/intersection \
../../../../boost/geometry/algorithms/detail/intersects \
../../../../boost/geometry/algorithms/detail/is_simple \
../../../../boost/geometry/algorithms/detail/is_valid \
../../../../boost/geometry/algorithms/detail/overlaps \
../../../../boost/geometry/algorithms/detail/overlay \
../../../../boost/geometry/algorithms/detail/relate \
../../../../boost/geometry/algorithms/detail/relation \
../../../../boost/geometry/algorithms/detail/sections \
../../../../boost/geometry/algorithms/detail/touches \
../../../../boost/geometry/algorithms/detail/turns \
../../../../boost/geometry/algorithms/detail/within \
../../../../boost/geometry/arithmetic \
../../../../boost/geometry/geometries/concepts \
../../../../boost/geometry/geometries \
../../../../boost/geometry/geometries/adapted \
../../../../boost/geometry/geometries/register \
../../../../boost/geometry/iterators \
../../../../boost/geometry/io/dsv \
../../../../boost/geometry/io/wkt \
../../../../boost/geometry/io/svg \
../../../../boost/geometry/policies \
../../../../boost/geometry/policies/relate \
../../../../boost/geometry/srs \
../../../../boost/geometry/strategies \
../../../../boost/geometry/strategies/concepts \
../../../../boost/geometry/strategies/agnostic \
../../../../boost/geometry/strategies/cartesian \
../../../../boost/geometry/strategies/spherical \
../../../../boost/geometry/strategies/geographic \
../../../../boost/geometry/strategies/transform \
../../../../boost/geometry/strategy/cartesian \
../../../../boost/geometry/strategy/geographic \
../../../../boost/geometry/strategy/spherical \
../../../../boost/geometry/util \
../../../../boost/geometry/views \
./doxygen_input/groups
INPUT_ENCODING = UTF-8
FILE_PATTERNS = *.hpp
RECURSIVE = NO
EXCLUDE = ../../../../boost/geometry/util/builder.hpp \
../../../../boost/geometry/algorithms/parse.hpp \
../../../../boost/geometry/algorithms/point_on_line.hpp \
../../../../boost/geometry/strategies/cartesian/cart_intersect.hpp \
../../../../boost/geometry/util/distance_sort.hpp \
./doxygen_extension_examples.hpp
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXCLUDE_SYMBOLS =
EXAMPLE_PATH = . .. ../../example ../../example/with_external_libs \
doxygen_input/sourcecode \
../../../../boost/geometry/geometries \
../../../../boost/geometry/strategies \
../../../../boost/geometry/strategies/cartesian \
../../../../boost/geometry/algorithms
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
IMAGE_PATH = doxygen_input/images
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = NO
REFERENCES_RELATION = NO
REFERENCES_LINK_SOURCE = NO
USE_HTAGS = NO
VERBATIM_HEADERS = NO
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
COLS_IN_ALPHA_INDEX = 3
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
# This is only for debug purposes. For the final documentation, XML output is
# converted to QuickBook and then to BoostBook and DocBook and html
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html_by_doxygen
HTML_FILE_EXTENSION = .html
HTML_HEADER = doxygen_input/ggl_doxygen_header.html
HTML_FOOTER = doxygen_input/ggl_doxygen_footer.html
HTML_STYLESHEET =
GENERATE_HTMLHELP = NO
GENERATE_DOCSET = NO
DOCSET_FEEDNAME = "Generated documentation, by Doxygen"
DOCSET_BUNDLE_ID = org.doxygen.Project
HTML_DYNAMIC_SECTIONS = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
BINARY_TOC = NO
TOC_EXPAND = NO
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = NO
TREEVIEW_WIDTH = 250
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = YES
XML_OUTPUT = xml
XML_PROGRAMLISTING = NO
#---------------------------------------------------------------------------
# Configuration options turned off
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
GENERATE_MAN = NO
GENERATE_RTF = NO
GENERATE_AUTOGEN_DEF = NO
GENERATE_PERLMOD = NO
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = YES
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED = BOOST_CONCEPT_REQUIRES(x) \
BOOST_CONCEPT_ASSERT(x) \
BOOST_STATIC_ASSERT(x) \
DOXYGEN_SHOULD_SKIP_THIS \
DOXYGEN_NO_DISPATCH \
DOXYGEN_NO_IMPL \
DOXYGEN_NO_DETAIL \
DOXYGEN_NO_CONCEPT_MEMBERS \
DOXYGEN_NO_TRAITS_SPECIALIZATIONS \
DOXYGEN_NO_STRATEGY_SPECIALIZATIONS \
DOXYGEN_NO_SPECIALIZATIONS \
DOXYGEN_INVOKED
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO
HAVE_DOT = NO
@@ -0,0 +1,23 @@
<hr size="1">
<table width="100%">
<tbody>
<tr>
<td align="left"><small>
<p>April 2, 2011</p>
</small></td>
<td align="right">
<small>
Copyright &copy; 2007-2011 Barend Gehrels, Amsterdam, the Netherlands<br>
Copyright &copy; 2008-2011 Bruno Lalande, Paris, France<br>
Copyright &copy; 2009-2010 Mateusz Loskot, London, UK<br>
</small>
</td>
</tr>
</tbody>
</table>
<address style="text-align: right;"><small>
Documentation is generated by&nbsp;<a href="http://www.doxygen.org/index.html">Doxygen</a>
</small></address>
</body>
</html>
@@ -0,0 +1,24 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Boost.Geometry (aka GGL, Generic Geometry Library)</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head>
<table cellpadding="2" width="100%">
<tbody>
<tr>
<td valign="top">
<img alt="Boost.Geometry" src="images/ggl-logo-big.png" height="80" width="200">
&nbsp;&nbsp;
</td>
<td valign="top" align="right">
<a href="http://www.boost.org">
<img alt="Boost C++ Libraries" src="images/accepted_by_boost.png" height="80" width="230" border="0">
</a>
</td>
</tr>
</tbody>
</table>
@@ -0,0 +1,89 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
//
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2018-2021.
// Modifications copyright (c) 2018-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// 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)
// File defining groups for Doxygen.
// Note that group descriptions are (currently) not used.
/*!
\defgroup access access: get/set coordinate values, make objects, clear geometries, append point(s)
\defgroup append append: append points to geometries
\defgroup area area: calculate area of a Geometry
\defgroup arithmetic arithmetic: arithmetic operations on points
\defgroup assign assign: assign values to geometries
\defgroup azimuth azimuth: calculate azimuth of a segment defined by a pair of points
\defgroup buffer buffer: calculate buffer of a geometry
\defgroup centroid centroid: calculate centroid (center of gravity) of a geometry
\defgroup clear clear: clear geometries
\defgroup closest_points closest points: compute closest points between two geometries
\defgroup compare compare: define compare functors for points
\defgroup concepts geometry concepts: defines and checks concepts for geometries
\defgroup convert convert: convert geometries from one type to another
\defgroup convex_hull convex hull: calculate the convex hull of a geometry
\defgroup core core: meta-functions for geometry types
\defgroup correct correct: correct geometries
\defgroup covered_by covered_by: detect if a geometry is inside or on the border of another geometry, a.o. point-in-polygon (border included)
\defgroup crosses crosses: detect if two geometries crosses each other
\defgroup cs coordinate systems
\defgroup densify densify: add points to geometry, keeping shape
\defgroup difference difference: difference of two geometries
\defgroup discrete_frechet_distance discrete_frechet_distance : calculate discrete frechet distance between two geometries
\defgroup discrete_hausdorff_distance discrete_hausdorff_distance : calculate discrete hausdorff distance between two geometries
\defgroup disjoint disjoint: detect if geometries are not spatially related
\defgroup distance distance: calculate distance between two geometries
\defgroup dsv: stream DSV (Delimiter-Separated Values)
\defgroup enum enum: enumerations
\defgroup envelope envelope: calculate envelope (minimum bounding rectangle) of a geometry
\defgroup equals equals: detect if two geometries are spatially equal
\defgroup expand expand: add a geometry to a bounding box
\defgroup exterior_ring exterior_ring: exterior_ring
\defgroup for_each for_each: apply a functor to each point or segment of a geometry
\defgroup geometries geometries: geometries provided by default
\defgroup get get: get geometries
\defgroup interior_rings interior_rings: interior_rings
\defgroup intersection intersection: calculate new geometry
\defgroup intersects intersects: detect if a geometry self-intersects or if two geometries intersect
\defgroup is_empty is_empty: detect if a geometry is the empty set
\defgroup is_simple is_simple: detect if a geometry is simple
\defgroup is_valid is_valid: detect if a geometry is valid
\defgroup iterators iterators: iterators
\defgroup length length: calculate length of a linear geometry
\defgroup line_interpolate line_interpolate: interpolates points on a linestring
\defgroup make make: construct geometries
\defgroup num_geometries number of geometries: calculate the number of geometries in a multi-geometry
\defgroup num_interior_rings number of interior rings: calculate the number of interior rings
\defgroup num_points number of points: calculate number of points of a geometry
\defgroup num_segments number of segments: calculate number of segments of a geometry
\defgroup overlaps overlaps: detect overlap between two geometries
\defgroup perimeter perimeter: calculate perimeter of a geometry
\defgroup projection projection: Projection struct's, classes
\defgroup projections projections: Projections
\defgroup ranges ranges: ranges
\defgroup register register: Macros for registration
\defgroup relate relate: check spatial relation between two geometries
\defgroup relation relation: calculate spatial relation between two geometries
\defgroup reverse reverse: reverse a geometry
\defgroup selected selection: check if a geometry is "selected" by a point
\defgroup set set: set geometries
\defgroup simplify simplify: remove points from a geometry, keeping shape (simplification or generalization)
\defgroup srs srs: Spatial Reference System definition
\defgroup strategies strategies: strategies
\defgroup svg svg: Stream SVG (Scalable Vector Graphics)
\defgroup sym_difference sym_difference: sym_difference of two geometries
\defgroup touches touches: detect if a geometry self-touches or if two geometries touch
\defgroup traits traits: adapt geometries
\defgroup transform transform: apply transformations on geometries
\defgroup union union: calculate new geometry containing geometries A or B
\defgroup unique unique: make a geometry unique w.r.t. points,
\defgroup within within: detect if a geometry is inside another geometry, a.o. point-in-polygon
\defgroup wkt wkt: parse and stream WKT (Well-Known Text)
*/
Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

@@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="354.33069"
height="354.33069"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.46"
version="1.0"
sodipodi:docbase="c:\svn\geolib\trunk\src\cpp\library\gl\geometry\doc"
sodipodi:docname="centroid_polygon.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
inkscape:export-filename="c:\svn\geolib\trunk\src\cpp\library\gl\geometry\doc\geometry\images\centroid_polygon.png"
inkscape:export-xdpi="200"
inkscape:export-ydpi="200">
<defs
id="defs4">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 177.16534 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="354.33069 : 177.16534 : 1"
inkscape:persp3d-origin="177.16534 : 118.11023 : 1"
id="perspective14" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
gridtolerance="50"
guidetolerance="10"
objecttolerance="10"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="7.2048876"
inkscape:cx="130.8455"
inkscape:cy="65.287038"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
width="10cm"
height="10cm"
showgrid="true"
gridanglex="8.4666669mm"
gridanglez="8.4666669mm"
grid_units="mm"
inkscape:grid-bbox="false"
inkscape:window-width="1280"
inkscape:window-height="774"
inkscape:window-x="0"
inkscape:window-y="0"
units="cm">
<inkscape:grid
id="GridFromPre046Settings"
type="xygrid"
originx="0px"
originy="0px"
spacingx="1mm"
spacingy="1mm"
color="#0000ff"
empcolor="#0000ff"
opacity="0.2"
empopacity="0.4"
empspacing="5" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-38.639912,-633.95635)">
<path
style="opacity:0.56687897;fill:#fff900;fill-opacity:1;stroke:#121518;stroke-opacity:1;stroke-width:0.9992126;stroke-miterlimit:4;stroke-dasharray:none;stroke-linejoin:round"
d="M 184,882 L 159,918 L 170,932 L 159,946 L 137.84854,924.45625 L 123.69708,928.09125 L 109.97083,942.15146 L 142,964 L 212,960 L 229,946 L 227,896 L 184,882 z M 194,910 L 209,921 L 187,939 L 180,917 L 194,910 z "
id="path2161"
sodipodi:nodetypes="ccccccccccccccccc"
inkscape:export-xdpi="300.36429"
inkscape:export-ydpi="300.36429" />
<path
sodipodi:type="arc"
style="opacity:0.60352423;fill:#ff000b;fill-opacity:1;stroke:#000000;stroke-opacity:1"
id="path2232"
sodipodi:cx="72.000801"
sodipodi:cy="699.51318"
sodipodi:rx="1.7753623"
sodipodi:ry="1.9726247"
d="M 73.776163,699.51318 A 1.7753623,1.9726247 0 1 1 70.225439,699.51318 A 1.7753623,1.9726247 0 1 1 73.776163,699.51318 z"
transform="translate(108.37139,230.51026)" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.7 KiB

@@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="354.33069"
height="354.33069"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.46"
version="1.0"
sodipodi:docbase="c:\svn\geolib\trunk\src\cpp\library\gl\geometry\doc"
sodipodi:docname="centroid_ring.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
inkscape:export-filename="c:\svn\geolib\trunk\src\cpp\library\gl\geometry\doc\geometry\images\centroid_ring.png"
inkscape:export-xdpi="200"
inkscape:export-ydpi="200">
<defs
id="defs4">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 177.16534 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="354.33069 : 177.16534 : 1"
inkscape:persp3d-origin="177.16534 : 118.11023 : 1"
id="perspective14" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
gridtolerance="50"
guidetolerance="10"
objecttolerance="10"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="7.2048876"
inkscape:cx="121.5635"
inkscape:cy="65.287038"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
width="10cm"
height="10cm"
showgrid="true"
gridanglex="8.4666669mm"
gridanglez="8.4666669mm"
grid_units="mm"
inkscape:grid-bbox="false"
inkscape:window-width="1280"
inkscape:window-height="774"
inkscape:window-x="0"
inkscape:window-y="0"
units="cm">
<inkscape:grid
id="GridFromPre046Settings"
type="xygrid"
originx="0px"
originy="0px"
spacingx="1mm"
spacingy="1mm"
color="#0000ff"
empcolor="#0000ff"
opacity="0.2"
empopacity="0.4"
empspacing="5" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-38.639912,-633.95635)">
<path
style="opacity:0.56687897;fill:#fff900;fill-opacity:1;stroke:#121518;stroke-opacity:1;stroke-width:0.9992126;stroke-miterlimit:4;stroke-dasharray:none;stroke-linejoin:round"
d="M 184,882 L 159,918 L 170,932 L 159,946 L 137.84854,924.45625 L 123.69708,928.09125 L 109.97083,942.15146 L 142,964 L 212,960 L 229,946 L 227,896 L 184,882 z"
id="path2161"
sodipodi:nodetypes="cccccccccccc" />
<path
sodipodi:type="arc"
style="opacity:0.60352423;fill:#ff000b;fill-opacity:1;stroke:#000000;stroke-opacity:1;stroke-width:0.70866141999999999;stroke-miterlimit:4;stroke-dasharray:none"
id="path2232"
sodipodi:cx="72.000801"
sodipodi:cy="699.51318"
sodipodi:rx="1.7753623"
sodipodi:ry="1.9726247"
d="M 73.776163,699.51318 A 1.7753623,1.9726247 0 1 1 70.225439,699.51318 A 1.7753623,1.9726247 0 1 1 73.776163,699.51318 z"
transform="translate(108.37139,230.10832)" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.6 KiB

@@ -0,0 +1,132 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="354.33069"
height="354.33069"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.46"
version="1.0"
sodipodi:docbase="c:\svn\geolib\trunk\src\cpp\library\gl\geometry\doc\geometry\images"
sodipodi:docname="clip_linestring.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
inkscape:export-filename="c:\svn\geolib\trunk\src\cpp\library\gl\geometry\doc\geometry\images\clip_linestring.png"
inkscape:export-xdpi="200"
inkscape:export-ydpi="200">
<defs
id="defs4">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 177.16534 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="354.33069 : 177.16534 : 1"
inkscape:persp3d-origin="177.16534 : 118.11023 : 1"
id="perspective12" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
gridtolerance="50"
guidetolerance="10"
objecttolerance="10"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="8.7985531"
inkscape:cx="106.64411"
inkscape:cy="74.188153"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
width="10cm"
height="10cm"
showgrid="true"
gridanglex="8.4666669mm"
gridanglez="8.4666669mm"
grid_units="mm"
inkscape:grid-bbox="false"
inkscape:window-width="1280"
inkscape:window-height="778"
inkscape:window-x="0"
inkscape:window-y="0"
units="cm">
<inkscape:grid
id="GridFromPre046Settings"
type="xygrid"
originx="0px"
originy="0px"
spacingx="1mm"
spacingy="1mm"
color="#0000ff"
empcolor="#0000ff"
opacity="0.2"
empopacity="0.4"
empspacing="5" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-38.639912,-633.95635)">
<path
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#fffd01;stroke-width:2.12598425;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
d="M 77.875125,949.43639 L 127.09591,913.61656 L 148.44123,878.87028 L 211.8907,949.65413 L 148.63089,920.85381"
id="linestring"
sodipodi:nodetypes="ccccc"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517" />
<rect
style="opacity:0.35031846;fill:#0092ff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.46545494px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
id="rect2234"
width="106.77697"
height="35.16954"
x="108.55672"
y="899.84406"
transform="matrix(1,0,-1.8627311e-2,0.9998265,0,0)"
inkscape:export-filename="c:\svn\geolib\trunk\src\cpp\library\gl\geometry\doc\geometry\images\intersection_linestring_example.png"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517" />
<path
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.53149605;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 97.769224,935.05 L 126.66298,914.05939 L 135.62394,899.70437"
id="path2163"
sodipodi:nodetypes="ccc"
inkscape:export-filename="c:\svn\geolib\trunk\src\cpp\library\gl\geometry\doc\geometry\images\intersection_linestring_example.png"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517" />
<path
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.53149605;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 167.04355,899.69241 L 198.34254,934.68557"
id="path2165"
sodipodi:nodetypes="cc"
inkscape:export-filename="c:\svn\geolib\trunk\src\cpp\library\gl\geometry\doc\geometry\images\intersection_linestring_example.png"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517" />
<path
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.53149611;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 180.38949,935.15059 L 148.72841,920.86884"
id="path2167"
sodipodi:nodetypes="cc"
inkscape:export-filename="c:\svn\geolib\trunk\src\cpp\library\gl\geometry\doc\geometry\images\intersection_linestring_example.png"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.3 KiB

@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="354.33069"
height="354.33069"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.46"
version="1.0"
sodipodi:docbase="c:\svn\geolib\trunk\src\cpp\library\gl\geometry\doc\geometry\images"
sodipodi:docname="clip_polygon.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
inkscape:export-filename="c:\svn\geolib\trunk\src\cpp\library\gl\geometry\doc\geometry\images\clip_polygon.png"
inkscape:export-xdpi="199.51997"
inkscape:export-ydpi="199.51997">
<defs
id="defs4">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 177.16534 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="354.33069 : 177.16534 : 1"
inkscape:persp3d-origin="177.16534 : 118.11023 : 1"
id="perspective13" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
gridtolerance="50"
guidetolerance="10"
objecttolerance="10"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="5.1707054"
inkscape:cx="151.57677"
inkscape:cy="65.287038"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
width="10cm"
height="10cm"
showgrid="true"
gridanglex="8.4666669mm"
gridanglez="8.4666669mm"
grid_units="mm"
inkscape:grid-bbox="false"
inkscape:window-width="1280"
inkscape:window-height="774"
inkscape:window-x="0"
inkscape:window-y="0"
units="cm">
<inkscape:grid
id="GridFromPre046Settings"
type="xygrid"
originx="0px"
originy="0px"
spacingx="1mm"
spacingy="1mm"
color="#0000ff"
empcolor="#0000ff"
opacity="0.2"
empopacity="0.4"
empspacing="5" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-38.639912,-633.95635)">
<rect
style="opacity:0.35031846;fill:#0092ff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.46545494px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
id="rect2234"
width="106.77697"
height="35.16954"
x="108.55672"
y="899.84406"
transform="matrix(1,0,-1.8627311e-2,0.9998265,0,0)"
inkscape:export-xdpi="311.54001"
inkscape:export-ydpi="311.54001" />
<path
style="opacity:0.56687897;fill:#fff900;fill-opacity:1;stroke:#121518;stroke-opacity:1;stroke-width:0.9992126;stroke-miterlimit:4;stroke-dasharray:none;stroke-linejoin:round"
d="M 184,882 L 159,918 L 170,932 L 159,946 L 137.84854,924.45625 L 123.69708,928.09125 L 109.97083,942.15146 L 142,964 L 212,960 L 229,946 L 227,896 L 184,882 z M 194,910 L 209,921 L 187,939 L 180,917 L 194,910 z "
id="path2161"
sodipodi:nodetypes="ccccccccccccccccc"
inkscape:export-filename="c:\svn\geolib\trunk\src\cpp\library\gl\geometry\doc\geometry\images\rect2234.png"
inkscape:export-xdpi="311.54001"
inkscape:export-ydpi="311.54001" />
<path
style="opacity:0.60352418;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#ff0000;stroke-width:2.12598419;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 171.68397,899.63498 L 158.96522,917.94748 L 169.96522,931.94748 L 167.71522,934.82248 L 185.65272,934.82248 L 179.96522,916.94748 L 193.96522,909.94748 L 198.27772,913.10373 L 198.52772,899.63498 L 171.68397,899.63498 z M 137.80897,924.41623 L 123.65272,928.04123 L 117.02773,934.82248 L 148.02772,934.82248 L 137.80897,924.41623 z M 197.96522,929.94748 L 191.99647,934.82248 L 197.87147,934.82248 L 197.96522,929.94748 z"
id="path2183"
inkscape:export-filename="c:\svn\geolib\trunk\src\cpp\library\gl\geometry\doc\geometry\images\rect2234.png"
inkscape:export-xdpi="311.54001"
inkscape:export-ydpi="311.54001" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.6 KiB

@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="354.33069"
height="354.33069"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.45.1"
version="1.0"
sodipodi:docbase="c:\svn\geolib\trunk\src\cpp\library\gl\geometry\doc\geometry\images"
sodipodi:docname="clip_polygon_2.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
inkscape:export-filename="c:\svn\geolib\trunk\src\cpp\library\gl\geometry\doc\geometry\images\clip_polygon_example.png"
inkscape:export-xdpi="311.54001"
inkscape:export-ydpi="311.54001">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
gridtolerance="50"
guidetolerance="10"
objecttolerance="10"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="5.1707054"
inkscape:cx="164.93056"
inkscape:cy="66.088471"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
width="10cm"
height="10cm"
showgrid="true"
gridspacingx="1mm"
gridspacingy="1mm"
gridanglex="8.4666669mm"
gridanglez="8.4666669mm"
grid_units="mm"
inkscape:grid-bbox="false"
inkscape:window-width="1280"
inkscape:window-height="774"
inkscape:window-x="0"
inkscape:window-y="0"
units="cm" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-38.639912,-633.95635)">
<path
transform="matrix(0.9999775,-6.7081431e-3,-1.1919911e-2,0.999929,0,0)"
style="opacity:0.35031846;fill:#0092ff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.46545497px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 102.42033,900.9873 L 208.81047,900.9873 C 208.72652,901.17943 209.0039,901.07357 209.0039,901.18074 L 209.0039,935.96341 C 209.0039,936.07057 209.11796,936.73842 209.0108,936.73842 L 102.42033,936.15684 C 102.31317,936.15684 102.2269,936.07057 102.2269,935.96341 L 102.2269,901.18074 C 102.2269,901.07357 102.31317,900.9873 102.42033,900.9873 z "
id="rect2234"
sodipodi:nodetypes="ccccccccc" />
<path
style="opacity:0.56687897;fill:#fff900;fill-opacity:1;stroke:#121518;stroke-width:0.99921262;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 145.375 248.625 L 120.375 284.625 L 131.375 298.625 L 120.375 312.625 L 99.21875 291.09375 L 85.0625 294.71875 L 71.34375 308.78125 L 103.375 330.625 L 173.375 326.625 L 190.375 312.625 L 188.375 262.625 L 145.375 248.625 z M 176.96875 269.78125 L 184.0625 276.8125 L 177.15625 284.3125 L 169.46875 276.34375 L 176.96875 269.78125 z M 155.375 276.625 L 170.375 287.625 L 148.375 305.625 L 141.375 283.625 L 155.375 276.625 z M 131.1875 280.125 L 134.625 280.21875 L 137.90625 290.53125 L 127.59375 287 L 131.1875 280.125 z M 170.03125 297.75 L 177.09375 311.8125 L 159.46875 319.03125 L 152.15625 308.78125 L 170.03125 297.75 z "
transform="translate(38.639912,633.95635)"
id="path2161" />
<path
transform="translate(38.639912,633.95635)"
style="opacity:0.75555558;fill:#f40000;fill-opacity:1;stroke:#000000;stroke-width:0.99921262;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1"
d="M 211.38314,299.79268 L 200.9365,300.63343 L 200.58326,291.1513 L 213.81172,289.59753 L 211.38314,299.79268 z "
id="path2187"
sodipodi:nodetypes="ccccc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.1 KiB

@@ -0,0 +1,114 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="354.33069"
height="354.33069"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.46"
version="1.0"
sodipodi:docbase="c:\svn\geolib\trunk\src\cpp\library\gl\geometry\doc"
sodipodi:docname="union_box_box_box.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
inkscape:export-filename="c:\svn\geolib\trunk\src\cpp\library\gl\geometry\doc\geometry\images\union_box_box_box.png"
inkscape:export-xdpi="200"
inkscape:export-ydpi="200">
<defs
id="defs4">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 177.16534 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="354.33069 : 177.16534 : 1"
inkscape:persp3d-origin="177.16534 : 118.11023 : 1"
id="perspective14" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
gridtolerance="50"
guidetolerance="10"
objecttolerance="10"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="6.1538903"
inkscape:cx="97.174303"
inkscape:cy="66.955465"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
width="10cm"
height="10cm"
showgrid="true"
gridanglex="8.4666669mm"
gridanglez="8.4666669mm"
grid_units="mm"
inkscape:grid-bbox="false"
inkscape:window-width="1280"
inkscape:window-height="774"
inkscape:window-x="0"
inkscape:window-y="0"
units="cm">
<inkscape:grid
id="GridFromPre046Settings"
type="xygrid"
originx="0px"
originy="0px"
spacingx="1mm"
spacingy="1mm"
color="#0000ff"
empcolor="#0000ff"
opacity="0.2"
empopacity="0.4"
empspacing="5" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-38.639912,-633.95635)">
<rect
style="opacity:0.75;fill:#0092ff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.70867687000000001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect2234"
width="53.801872"
height="35.451065"
x="99.877876"
y="899.72723"
transform="matrix(1,0,-9.3464798e-3,0.9999563,0,0)" />
<rect
style="opacity:0.75000000000000000;fill:#1eff00;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.70867687000000001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect3237"
width="53.801872"
height="35.451065"
x="139.34093"
y="882.00989"
transform="matrix(1,0,-9.3464804e-3,0.9999563,0,0)" />
<rect
style="opacity:0.53744495000000003;fill:#aead97;fill-opacity:1;fill-rule:evenodd;stroke:#ff0000;stroke-width:2.12604548;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect3239"
width="93.288498"
height="53.523342"
x="101.25739"
y="882.03864"
transform="matrix(1,0,-1.0734082e-2,0.9999424,0,0)" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.9 KiB

@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="354.33069"
height="354.33069"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.46"
version="1.0"
sodipodi:docbase="c:\svn\geolib\trunk\src\cpp\library\gl\geometry\doc"
sodipodi:docname="union_box_point_box.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
inkscape:export-filename="c:\svn\geolib\trunk\src\cpp\library\gl\geometry\doc\geometry\images\union_box_point_box.png"
inkscape:export-xdpi="200"
inkscape:export-ydpi="200">
<defs
id="defs4">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 177.16534 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="354.33069 : 177.16534 : 1"
inkscape:persp3d-origin="177.16534 : 118.11023 : 1"
id="perspective14" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
gridtolerance="50"
guidetolerance="10"
objecttolerance="10"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="12.314871"
inkscape:cx="95.527705"
inkscape:cy="75.995428"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
width="10cm"
height="10cm"
showgrid="true"
gridanglex="8.4666669mm"
gridanglez="8.4666669mm"
grid_units="mm"
inkscape:grid-bbox="false"
inkscape:window-width="1280"
inkscape:window-height="774"
inkscape:window-x="0"
inkscape:window-y="0"
units="cm">
<inkscape:grid
id="GridFromPre046Settings"
type="xygrid"
originx="0px"
originy="0px"
spacingx="1mm"
spacingy="1mm"
color="#0000ff"
empcolor="#0000ff"
opacity="0.2"
empopacity="0.4"
empspacing="5" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-38.639912,-633.95635)">
<path
transform="matrix(1,0,-9.3464798e-3,0.9999563,0,0)"
style="opacity:0.75;fill:#0092ff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.70867687;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1"
d="M 100.19895,899.74368 L 153.67975,899.72723 L 153.67975,935.1783 L 100.53014,935.1783 L 100.19895,899.74368 z"
id="rect2234"
sodipodi:nodetypes="ccccc" />
<path
style="opacity:0.53744495;fill:#aead97;fill-opacity:1;fill-rule:evenodd;stroke:#ff0000;stroke-width:2.12598419;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1"
d="M 92.263165,888.70424 L 177.35302,888.70367 L 176.82889,935.13743 L 92.313648,934.76666 L 92.263165,888.70424 z"
id="rect3239"
sodipodi:nodetypes="ccccc" />
<path
sodipodi:type="arc"
style="opacity:0.75;fill:#1eff00;fill-opacity:1;stroke:#140707;stroke-width:1.57480264;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path2383"
sodipodi:cx="131.10236"
sodipodi:cy="262.20471"
sodipodi:rx="3.5433071"
sodipodi:ry="3.5433071"
d="M 134.64566,262.20471 A 3.5433071,3.5433071 0 1 1 127.55905,262.20471 A 3.5433071,3.5433071 0 1 1 134.64566,262.20471 z"
transform="matrix(0.4500001,0,0,0.4500003,117.23833,772.08224)" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.1 KiB

@@ -0,0 +1,100 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="354.33069"
height="354.33069"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.46"
version="1.0"
sodipodi:docbase="c:\svn\geolib\trunk\src\cpp\library\gl\geometry\doc"
sodipodi:docname="convexhull_polygon_polygon.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
inkscape:export-filename="c:\svn\geolib\trunk\src\cpp\library\gl\geometry\doc\geometry\images\convexhull_polygon_polygon.png"
inkscape:export-xdpi="200"
inkscape:export-ydpi="200">
<defs
id="defs4">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 177.16534 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="354.33069 : 177.16534 : 1"
inkscape:persp3d-origin="177.16534 : 118.11023 : 1"
id="perspective14" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
gridtolerance="50"
guidetolerance="10"
objecttolerance="10"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="7.1077853"
inkscape:cx="131.59676"
inkscape:cy="66.127004"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
width="10cm"
height="10cm"
showgrid="true"
gridanglex="8.4666669mm"
gridanglez="8.4666669mm"
grid_units="mm"
inkscape:grid-bbox="false"
inkscape:window-width="1280"
inkscape:window-height="774"
inkscape:window-x="0"
inkscape:window-y="0"
units="cm">
<inkscape:grid
id="GridFromPre046Settings"
type="xygrid"
originx="0px"
originy="0px"
spacingx="1mm"
spacingy="1mm"
color="#0000ff"
empcolor="#0000ff"
opacity="0.2"
empopacity="0.4"
empspacing="5" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-38.639912,-633.95635)">
<path
style="opacity:0.56687897;fill:#fff900;fill-opacity:1;stroke:#121518;stroke-opacity:1;stroke-width:0.9992126;stroke-miterlimit:4;stroke-dasharray:none;stroke-linejoin:round"
d="M 184,882 L 159,918 L 170,932 L 159,946 L 137.84854,924.45625 L 123.69708,928.09125 L 109.97083,942.15146 L 142,964 L 212,960 L 229,946 L 227,896 L 184,882 z M 194,910 L 209,921 L 187,939 L 180,917 L 194,910 z "
id="path2161"
sodipodi:nodetypes="ccccccccccccccccc" />
<path
style="opacity:0.75;fill:none;fill-opacity:1;stroke:#ff0000;stroke-width:2.12598419000000010;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 184.09498,882.00774 L 123.79207,928.09899 L 110.06581,942.1592 L 142.09498,964.00774 L 212.09498,960.00774 L 229.09498,946.00774 L 227.09498,896.00774 L 184.09498,882.00774 z"
id="path2387"
sodipodi:nodetypes="cccccccc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.6 KiB

@@ -0,0 +1,100 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="354.33069"
height="354.33069"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.46"
version="1.0"
sodipodi:docbase="c:\svn\geolib\trunk\src\cpp\library\gl\geometry\doc"
sodipodi:docname="envelope_polygon.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
inkscape:export-filename="c:\svn\geolib\trunk\src\cpp\library\gl\geometry\doc\geometry\images\envelope_polygon.png"
inkscape:export-xdpi="200"
inkscape:export-ydpi="200">
<defs
id="defs4">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 177.16534 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="354.33069 : 177.16534 : 1"
inkscape:persp3d-origin="177.16534 : 118.11023 : 1"
id="perspective14" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
gridtolerance="50"
guidetolerance="10"
objecttolerance="10"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="7.1034197"
inkscape:cx="130.75063"
inkscape:cy="65.269798"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
width="10cm"
height="10cm"
showgrid="true"
gridanglex="8.4666669mm"
gridanglez="8.4666669mm"
grid_units="mm"
inkscape:grid-bbox="false"
inkscape:window-width="1280"
inkscape:window-height="774"
inkscape:window-x="0"
inkscape:window-y="0"
units="cm">
<inkscape:grid
id="GridFromPre046Settings"
type="xygrid"
originx="0px"
originy="0px"
spacingx="1mm"
spacingy="1mm"
color="#0000ff"
empcolor="#0000ff"
opacity="0.2"
empopacity="0.4"
empspacing="5" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-38.639912,-633.95635)">
<path
style="opacity:0.56687897;fill:#fff900;fill-opacity:1;stroke:#121518;stroke-opacity:1;stroke-width:0.9992126;stroke-miterlimit:4;stroke-dasharray:none;stroke-linejoin:round"
d="M 184,882 L 159,918 L 170,932 L 159,946 L 137.84854,924.45625 L 123.69708,928.09125 L 109.97083,942.15146 L 142,964 L 212,960 L 229,946 L 227,896 L 184,882 z M 194,910 L 209,921 L 187,939 L 180,917 L 194,910 z "
id="path2161"
sodipodi:nodetypes="ccccccccccccccccc" />
<path
style="opacity:0.75;fill:none;fill-opacity:1;stroke:#ff0000;stroke-width:2.12598419000000010;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 109.50605,881.98783 L 109.64674,964.04665 L 229.27504,964.04665 L 229.27504,881.98783 L 109.50605,881.98783 z"
id="path2387"
sodipodi:nodetypes="ccccc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.5 KiB

@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="354.33069"
height="354.33069"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.45.1"
version="1.0"
sodipodi:docbase="c:\svn\geolib\trunk\src\cpp\library\gl\geometry\doc\geometry\images"
sodipodi:docname="geometries.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
gridtolerance="50"
guidetolerance="10"
objecttolerance="10"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="4.5659491"
inkscape:cx="138.5704"
inkscape:cy="88.308109"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
width="10cm"
height="10cm"
showgrid="true"
gridspacingx="1mm"
gridspacingy="1mm"
gridanglex="8.4666669mm"
gridanglez="8.4666669mm"
grid_units="mm"
inkscape:grid-bbox="false"
inkscape:window-width="1280"
inkscape:window-height="774"
inkscape:window-x="0"
inkscape:window-y="0"
units="cm" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-38.639912,-633.95635)">
<path
style="opacity:0.56687897;fill:#fff900;fill-opacity:1;stroke:#121518;stroke-width:0.77897316;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 120.33185,903.34589 L 99.405785,929.4846 L 108.61325,939.64965 L 99.405785,949.81471 L 81.701116,934.17232 L 69.855741,936.8116 L 58.366285,947.02038 L 85.176065,962.88406 L 143.76904,959.97976 L 157.99877,949.81471 L 156.32468,913.51094 L 120.33185,903.34589 z M 128.70228,923.676 L 141.25791,931.66282 L 122.84298,944.73218 L 116.98368,928.75852 L 128.70228,923.676 z "
id="polygon"
sodipodi:nodetypes="ccccccccccccccccc"
inkscape:export-xdpi="358.51999"
inkscape:export-ydpi="358.51999"
inkscape:label="#polygon" />
<path
style="opacity:0.6;fill:none;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.76607335px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 53.850036,887.0878 L 94.600989,861.69708 L 112.27324,837.06735 L 164.80444,887.24214 L 112.43027,866.82717"
id="linestring"
sodipodi:nodetypes="ccccc"
inkscape:export-xdpi="321.54922"
inkscape:export-ydpi="321.54922" />
<path
id="multi_polygon"
style="opacity:0.6;fill:#ffff00;fill-opacity:1;stroke:#121518;stroke-width:0.77897316;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1"
d="M 227.42894,904.22244 L 251.55526,915.99743 L 250.31718,936.58397 L 259.52464,946.74903 L 277.22931,931.10664 L 295.42604,931.11777 L 300.56414,943.9547 L 273.75436,959.81838 L 221.29374,959.98026 L 200.93166,946.74903 L 202.60575,910.44526 L 227.42894,904.22244 z M 230.22815,920.61032 L 214.16832,934.29147 L 227.75604,934.69379 L 232.58325,947.36083 L 241.0707,929.63507 L 230.22815,920.61032 z M 273.76878,929.18869 L 255.59973,916.5631 L 253.60434,933.88422 L 261.16939,941.08381 L 273.76878,929.18869 z "
sodipodi:nodetypes="ccccccccccccccccccccccc"
inkscape:export-xdpi="358.51999"
inkscape:export-ydpi="358.51999" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.9 KiB

@@ -0,0 +1,495 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="354.33069"
height="354.33069"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.46"
version="1.0"
sodipodi:docbase="c:\svn\geolib\trunk\src\cpp\library\gl\geometry\doc\geometry\images"
sodipodi:docname="intersection_results.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
inkscape:export-filename="c:\svn\geolib\trunk\src\cpp\library\gl\geometry\doc\geometry\images\clip_segment_segment.png"
inkscape:export-xdpi="200"
inkscape:export-ydpi="200">
<defs
id="defs4">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 177.16534 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="354.33069 : 177.16534 : 1"
inkscape:persp3d-origin="177.16534 : 118.11023 : 1"
id="perspective12" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
gridtolerance="50"
guidetolerance="10"
objecttolerance="10"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.6989779"
inkscape:cx="177.16534"
inkscape:cy="177.16534"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
width="10cm"
height="10cm"
showgrid="true"
gridanglex="8.4666669mm"
gridanglez="8.4666669mm"
grid_units="mm"
inkscape:grid-bbox="false"
inkscape:window-width="1280"
inkscape:window-height="778"
inkscape:window-x="0"
inkscape:window-y="0"
units="cm">
<inkscape:grid
id="GridFromPre046Settings"
type="xygrid"
originx="0px"
originy="0px"
spacingx="1mm"
spacingy="1mm"
color="#0000ff"
empcolor="#0000ff"
opacity="0.2"
empopacity="0.4"
empspacing="5" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-38.639912,-633.95635)">
<text
xml:space="preserve"
style="font-size:8px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Century Gothic;-inkscape-font-specification:Century Gothic Bold"
x="229.9785"
y="792.94293"
id="text2434"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan2454"
x="229.9785"
y="792.94293">is_parallel</tspan></text>
<path
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#fffd01;stroke-width:2.12598419;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 84.961739,768.08993 L 134.18252,732.2701"
id="linestring"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517" />
<path
style="opacity:0.6;fill:none;fill-rule:evenodd;stroke:#0001fb;stroke-width:2.12598419;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 109.50605,775.68861 L 87.080805,742.6099"
id="path2385"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517" />
<path
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#fffd01;stroke-width:2.12598419;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 148.86795,771.89431 L 198.08873,736.07444"
id="path3157"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517" />
<path
style="opacity:0.6;fill:none;fill-rule:evenodd;stroke:#0001fb;stroke-width:2.12598443;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 201.00251,769.74382 L 174.97083,765.4223"
id="path3161"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517"
inkscape:transform-center-x="13.869227"
inkscape:transform-center-y="2.4991609" />
<path
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#fffd01;stroke-width:2.12598419;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 97.034634,852.86192 L 146.25545,817.04205"
id="path3163"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517" />
<path
style="opacity:0.6;fill:none;fill-rule:evenodd;stroke:#0001fb;stroke-width:2.12598419;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 72.231448,870.57844 L 121.4523,834.75858"
id="path3167"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517" />
<path
sodipodi:type="arc"
style="opacity:0.6;fill:#fb0000;fill-opacity:1;stroke:#000000;stroke-width:0.35771862;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path3169"
sodipodi:cx="65.551178"
sodipodi:cy="310.03934"
sodipodi:rx="1.7716535"
sodipodi:ry="1.7716535"
d="M 67.322832,310.03934 A 1.7716535,1.7716535 0 1 1 63.779524,310.03934 A 1.7716535,1.7716535 0 1 1 67.322832,310.03934 z"
transform="matrix(0.9800207,0,0,1.0011502,33.474012,448.48418)" />
<path
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#ff0000;stroke-width:1.41732287;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 96.263395,853.11381 L 121.38018,834.77167"
id="path3165"
sodipodi:nodetypes="cc"
inkscape:export-filename="c:\svn\geolib\trunk\src\cpp\library\gl\geometry\doc\geometry\images\intersection_linestring_example.png"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517" />
<path
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#fffd01;stroke-width:2.12598419;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 226.82071,771.89431 L 276.04149,736.07444"
id="path2388"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517" />
<path
style="opacity:0.6;fill:none;fill-rule:evenodd;stroke:#0001fb;stroke-width:2.12598443;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 276.04149,746.70436 L 251.23834,764.4209"
id="path2390"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517"
inkscape:transform-center-x="13.869227"
inkscape:transform-center-y="2.4991609" />
<path
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#fffd01;stroke-width:2.12598419;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 192.9155,838.94058 L 217.71865,821.22405"
id="path2392"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517" />
<path
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#fffd01;stroke-width:2.12598419;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 200.80004,833.50115 L 215.80527,822.36374"
id="path2398"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517" />
<path
style="opacity:0.6;fill:none;fill-rule:evenodd;stroke:#0001fb;stroke-width:2.12598419;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 169.23694,858.13778 L 192.9155,838.94058"
id="path2400"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517" />
<path
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#fffd01;stroke-width:2.12598419;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 264.53846,847.45911 L 296.42823,854.54572"
id="path2402"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517" />
<path
style="opacity:0.6;fill:none;fill-rule:evenodd;stroke:#0001fb;stroke-width:2.12598419;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 242.51523,864.01531 L 283.85147,833.63492"
id="path2404"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517" />
<path
sodipodi:type="arc"
style="opacity:0.6;fill:#fb0000;fill-opacity:1;stroke:#000000;stroke-width:0.35771862;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path2406"
sodipodi:cx="65.551178"
sodipodi:cy="310.03934"
sodipodi:rx="1.7716535"
sodipodi:ry="1.7716535"
d="M 67.322832,310.03934 A 1.7716535,1.7716535 0 1 1 63.779524,310.03934 A 1.7716535,1.7716535 0 1 1 67.322832,310.03934 z"
transform="matrix(0.9800207,0,0,1.0011502,128.13846,528.63109)" />
<path
sodipodi:type="arc"
style="opacity:0.6;fill:#fb0000;fill-opacity:1;stroke:#000000;stroke-width:0.35771862;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path2408"
sodipodi:cx="65.551178"
sodipodi:cy="310.03934"
sodipodi:rx="1.7716535"
sodipodi:ry="1.7716535"
d="M 67.322832,310.03934 A 1.7716535,1.7716535 0 1 1 63.779524,310.03934 A 1.7716535,1.7716535 0 1 1 67.322832,310.03934 z"
transform="matrix(0.9800207,0,0,1.0011502,201.45482,536.56644)" />
<path
sodipodi:type="arc"
style="opacity:0.6;fill:#fb0000;fill-opacity:1;stroke:#000000;stroke-width:0.35771862;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path2410"
sodipodi:cx="65.551178"
sodipodi:cy="310.03934"
sodipodi:rx="1.7716535"
sodipodi:ry="1.7716535"
d="M 67.322832,310.03934 A 1.7716535,1.7716535 0 1 1 63.779524,310.03934 A 1.7716535,1.7716535 0 1 1 67.322832,310.03934 z"
transform="matrix(0.9800207,0,0,1.0011502,32.485822,542.44402)" />
<path
sodipodi:type="arc"
style="opacity:0.6;fill:#fb0000;fill-opacity:1;stroke:#000000;stroke-width:0.35771862;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path2412"
sodipodi:cx="65.551178"
sodipodi:cy="310.03934"
sodipodi:rx="1.7716535"
sodipodi:ry="1.7716535"
d="M 67.322832,310.03934 A 1.7716535,1.7716535 0 1 1 63.779524,310.03934 A 1.7716535,1.7716535 0 1 1 67.322832,310.03934 z"
transform="matrix(0.9800207,0,0,1.0011502,56.859962,524.37937)" />
<path
style="opacity:0.6;fill:none;fill-rule:evenodd;stroke:#0001fb;stroke-width:2.12598419;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 245.77377,936.24751 L 287.11001,905.86712"
id="path2416"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517" />
<path
sodipodi:type="arc"
style="opacity:0.6;fill:#fb0000;fill-opacity:1;stroke:#000000;stroke-width:0.35771862;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path2420"
sodipodi:cx="65.551178"
sodipodi:cy="310.03934"
sodipodi:rx="1.7716535"
sodipodi:ry="1.7716535"
d="M 67.322832,310.03934 A 1.7716535,1.7716535 0 1 1 63.779524,310.03934 A 1.7716535,1.7716535 0 1 1 67.322832,310.03934 z"
transform="matrix(0.9800207,0,0,1.0011502,204.71336,608.79864)" />
<path
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#fffd01;stroke-width:2.12598419;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 267.40232,848.15373 L 299.29209,855.24034"
id="path2422"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517" />
<path
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#fffd01;stroke-width:2.12598419;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 267.99967,919.18756 L 269.99718,919.78445"
id="path2424"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517" />
<text
xml:space="preserve"
style="font-size:8px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Century Gothic;-inkscape-font-specification:Century Gothic Bold"
x="82.943787"
y="791.79657"
id="text2426"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan2428"
x="82.943787"
y="791.79657">is_intersect</tspan></text>
<text
xml:space="preserve"
style="font-size:8px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Century Gothic;-inkscape-font-specification:Century Gothic Bold"
x="151.55994"
y="791.55756"
id="text2430"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan2452">is_disjoint</tspan></text>
<text
xml:space="preserve"
style="font-size:8px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Century Gothic;-inkscape-font-specification:Century Gothic Bold"
x="72.881683"
y="884.06732"
id="text2440"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan2444"
x="72.881683"
y="884.06732">is_collinear_overlap</tspan></text>
<text
xml:space="preserve"
style="font-size:8px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Century Gothic;-inkscape-font-specification:Century Gothic Bold"
x="158.79314"
y="883.87817"
id="text2446"
sodipodi:linespacing="100%"><tspan
sodipodi:role="line"
id="tspan2450"
x="158.79314"
y="883.87817">is_collinear_connect</tspan></text>
<path
style="font-size:8px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;opacity:0.90000000000000002;fill:#808080;fill-rule:evenodd;stroke:#808080;stroke-width:2.12598419000000010;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;font-family:Times New Roman;-inkscape-font-specification:Times New Roman Bold"
d="M 304.92986,793.27185 L 304.92986,757.06561"
id="path2456"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517" />
<path
style="font-size:8px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;opacity:0.90000000000000002;fill:#808080;fill-rule:evenodd;stroke:#808080;stroke-width:2.12598419000000010;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;font-family:Times New Roman;-inkscape-font-specification:Times New Roman Bold"
d="M 295.55052,793.27185 L 295.55052,757.06561"
id="path3228"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517"
inkscape:transform-center-x="-17.263914" />
<path
style="font-size:8px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;opacity:0.90000000000000002;fill:#808080;fill-rule:evenodd;stroke:#808080;stroke-width:2.12598419000000010;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;font-family:Times New Roman;-inkscape-font-specification:Times New Roman Bold"
d="M 314.3092,793.27185 L 314.3092,757.06561"
id="path3230"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517" />
<path
style="font-size:8px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;opacity:0.90000000000000002;fill:#808080;fill-rule:evenodd;stroke:#808080;stroke-width:2.12598419000000010;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;font-family:Times New Roman;-inkscape-font-specification:Times New Roman Bold"
d="M 286.59116,793.27185 L 286.67516,757.06561"
id="path3232"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517"
inkscape:transform-center-x="-17.263914" />
<path
style="font-size:8px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;opacity:0.90000000000000002;fill:#808080;fill-rule:evenodd;stroke:#808080;stroke-width:2.12598419000000010;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;font-family:Times New Roman;-inkscape-font-specification:Times New Roman Bold"
d="M 323.68855,757.06561 L 286.17118,757.06561"
id="path3234"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517" />
<path
style="font-size:8px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;opacity:0.90000000000000002;fill:#808080;fill-rule:evenodd;stroke:#808080;stroke-width:2.12598419000000010;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;font-family:Times New Roman;-inkscape-font-specification:Times New Roman Bold"
d="M 323.68855,766.11717 L 286.17118,766.11717"
id="path3236"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517" />
<path
style="font-size:8px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;opacity:0.90000000000000002;fill:#808080;fill-rule:evenodd;stroke:#808080;stroke-width:2.12598419000000010;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;font-family:Times New Roman;-inkscape-font-specification:Times New Roman Bold"
d="M 323.68855,775.16873 L 286.17118,775.16873"
id="path3238"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517" />
<path
style="font-size:8px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;opacity:0.90000000000000002;fill:#808080;fill-rule:evenodd;stroke:#808080;stroke-width:2.12598419000000010;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;font-family:Times New Roman;-inkscape-font-specification:Times New Roman Bold"
d="M 323.68855,784.22029 L 286.17118,784.22029"
id="path3240"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517" />
<path
style="font-size:8px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;opacity:0.90000000000000002;fill:#808080;fill-rule:evenodd;stroke:#808080;stroke-width:2.12598419000000010;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;font-family:Times New Roman;-inkscape-font-specification:Times New Roman Bold"
d="M 323.43655,793.27185 L 323.42306,756.66178"
id="path3242"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517" />
<path
style="font-size:8px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;opacity:0.90000000000000002;fill:#808080;fill-rule:evenodd;stroke:#808080;stroke-width:2.12598419000000010;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;font-family:Times New Roman;-inkscape-font-specification:Times New Roman Bold"
d="M 323.68855,793.27185 L 286.17118,793.27185"
id="path3244"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517" />
<text
xml:space="preserve"
style="font-size:4.16063023px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Times New Roman;-inkscape-font-specification:Times New Roman Bold"
x="302.86984"
y="776.75757"
id="text3246"
sodipodi:linespacing="125%"
transform="scale(1.0179454,0.982371)"><tspan
sodipodi:role="line"
id="tspan3250"
x="302.86984"
y="776.75757">B</tspan></text>
<text
xml:space="preserve"
style="font-size:4.16063023px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Times New Roman;-inkscape-font-specification:Times New Roman Bold"
x="284.69885"
y="795.41443"
id="text3252"
sodipodi:linespacing="125%"
transform="scale(1.0179454,0.982371)"><tspan
sodipodi:role="line"
id="tspan3254"
x="284.69885"
y="795.41443">B</tspan></text>
<text
xml:space="preserve"
style="font-size:4.16063023px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Times New Roman;-inkscape-font-specification:Times New Roman Bold"
x="312.45383"
y="776.75757"
id="text3256"
sodipodi:linespacing="125%"
transform="scale(1.0179454,0.982371)"><tspan
y="776.75757"
x="312.45383"
sodipodi:role="line"
id="tspan3260">E</tspan></text>
<text
xml:space="preserve"
style="font-size:4.16063023px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Times New Roman;-inkscape-font-specification:Times New Roman Bold"
x="284.72122"
y="804.32825"
id="text3262"
sodipodi:linespacing="125%"
transform="scale(1.0179454,0.982371)"><tspan
sodipodi:role="line"
id="tspan3264"
x="284.72122"
y="804.32825">E</tspan></text>
<text
xml:space="preserve"
style="font-size:4.16063023px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Times New Roman;-inkscape-font-specification:Times New Roman Bold"
x="285.25348"
y="785.97559"
id="text3266"
sodipodi:linespacing="125%"
transform="scale(1.0179454,0.982371)"><tspan
sodipodi:role="line"
id="tspan3270"
x="285.25348"
y="785.97559">I</tspan></text>
<text
xml:space="preserve"
style="font-size:4.16063023px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Times New Roman;-inkscape-font-specification:Times New Roman Bold"
x="294.02585"
y="776.75757"
id="text3272"
sodipodi:linespacing="125%"
transform="scale(1.0179454,0.982371)"><tspan
sodipodi:role="line"
id="tspan3274"
x="294.02585"
y="776.75757">I</tspan></text>
<text
xml:space="preserve"
style="font-size:4.16063023px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Times New Roman;-inkscape-font-specification:Times New Roman Bold"
x="293.89435"
y="785.54333"
id="text3346"
sodipodi:linespacing="125%"
transform="scale(1.0179454,0.982371)"><tspan
sodipodi:role="line"
id="tspan3350"
x="293.89435"
y="785.54333">0</tspan></text>
<text
xml:space="preserve"
style="font-size:4.16063023px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Times New Roman;-inkscape-font-specification:Times New Roman Bold"
x="303.00858"
y="786.00177"
id="text3352"
sodipodi:linespacing="125%"
transform="scale(1.0179454,0.982371)"><tspan
sodipodi:role="line"
id="tspan3354"
x="303.00858"
y="786.00177">0</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 28 KiB

@@ -0,0 +1,152 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="354.33069"
height="354.33069"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.46"
version="1.0"
sodipodi:docbase="c:\svn\geolib\trunk\src\cpp\library\gl\geometry\doc\geometry\images"
sodipodi:docname="intersection_segment_segment.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
inkscape:export-filename="c:\svn\geolib\trunk\src\cpp\library\gl\geometry\doc\geometry\images\clip_segment_segment.png"
inkscape:export-xdpi="200"
inkscape:export-ydpi="200">
<defs
id="defs4">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 177.16534 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="354.33069 : 177.16534 : 1"
inkscape:persp3d-origin="177.16534 : 118.11023 : 1"
id="perspective12" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
gridtolerance="50"
guidetolerance="10"
objecttolerance="10"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="5.4339867"
inkscape:cx="145.33833"
inkscape:cy="48.561038"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
width="10cm"
height="10cm"
showgrid="true"
gridanglex="8.4666669mm"
gridanglez="8.4666669mm"
grid_units="mm"
inkscape:grid-bbox="false"
inkscape:window-width="1280"
inkscape:window-height="778"
inkscape:window-x="0"
inkscape:window-y="0"
units="cm">
<inkscape:grid
id="GridFromPre046Settings"
type="xygrid"
originx="0px"
originy="0px"
spacingx="1mm"
spacingy="1mm"
color="#0000ff"
empcolor="#0000ff"
opacity="0.2"
empopacity="0.4"
empspacing="5" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-38.639912,-633.95635)">
<path
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#fffd01;stroke-width:2.12598425;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
d="M 77.875125,949.43639 L 127.09591,913.61656"
id="linestring"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517" />
<path
style="opacity:0.6;fill:none;fill-rule:evenodd;stroke:#0001fb;stroke-width:2.12598419;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 109.82222,966.69297 L 74.072983,917.4209"
id="path2385"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517" />
<path
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#fffd01;stroke-width:2.12598419;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 154.66272,948.5789 L 203.8835,912.75903"
id="path3157"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517" />
<path
style="opacity:0.6;fill:none;fill-rule:evenodd;stroke:#0001fb;stroke-width:2.12598443;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 206.79728,946.42841 L 180.7656,942.10689"
id="path3161"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517"
inkscape:transform-center-x="13.869227"
inkscape:transform-center-y="2.4991609" />
<path
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#fffd01;stroke-width:2.12598419;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 244.66272,948.5789 L 293.8835,912.75903"
id="path3163"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517" />
<path
style="opacity:0.6;fill:none;fill-rule:evenodd;stroke:#0001fb;stroke-width:2.12598419;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 220.78968,966.18146 L 270.01046,930.3616"
id="path3167"
sodipodi:nodetypes="cc"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517" />
<path
sodipodi:type="arc"
style="opacity:0.6;fill:#fb0000;fill-opacity:1;stroke:#000000;stroke-width:0.35771862;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path3169"
sodipodi:cx="65.551178"
sodipodi:cy="310.03934"
sodipodi:rx="1.7716535"
sodipodi:ry="1.7716535"
d="M 67.322832,310.03934 A 1.7716535,1.7716535 0 1 1 63.779524,310.03934 A 1.7716535,1.7716535 0 1 1 67.322832,310.03934 z"
transform="matrix(0.9800207,0,0,1.0011502,26.387398,629.83064)" />
<path
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#ff0000;stroke-width:1.41732283;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 244.8216,948.71683 L 269.93834,930.37469"
id="path3165"
sodipodi:nodetypes="cc"
inkscape:export-filename="c:\svn\geolib\trunk\src\cpp\library\gl\geometry\doc\geometry\images\intersection_linestring_example.png"
inkscape:export-xdpi="267.0517"
inkscape:export-ydpi="267.0517" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 6.2 KiB

@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="354.33069"
height="354.33069"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.45.1"
version="1.0"
sodipodi:docbase="c:\svn\geolib\trunk\src\cpp\library\gl\geometry\doc"
sodipodi:docname="linestring_example.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
gridtolerance="50"
guidetolerance="10"
objecttolerance="10"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="8.7985531"
inkscape:cx="106.64411"
inkscape:cy="74.188153"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
width="10cm"
height="10cm"
showgrid="true"
gridspacingx="1mm"
gridspacingy="1mm"
gridanglex="8.4666669mm"
gridanglez="8.4666669mm"
grid_units="mm"
inkscape:grid-bbox="false"
inkscape:window-width="1280"
inkscape:window-height="778"
inkscape:window-x="0"
inkscape:window-y="0"
units="cm" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-38.639912,-633.95635)">
<path
style="opacity:0.56687897;fill:none;fill-rule:evenodd;stroke:#007eff;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 78.67733,949.10975 L 149.24344,878.54364 L 212.69291,949.32749 L 149.4331,920.52717"
id="path2238"
sodipodi:nodetypes="cccc" />
<path
style="opacity:0.6;fill:none;fill-rule:evenodd;stroke:#ff0000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 77.875125,949.43639 L 127.09591,913.61656 L 148.44123,878.87028 L 211.8907,949.65413 L 148.63089,920.85381"
id="linestring"
sodipodi:nodetypes="ccccc" />
<path
sodipodi:type="arc"
style="opacity:0.39490446;fill:#0092ff;fill-opacity:1;stroke:#000000;stroke-opacity:1"
id="path2232"
sodipodi:cx="72.000801"
sodipodi:cy="699.51318"
sodipodi:rx="1.7753623"
sodipodi:ry="1.9726247"
d="M 73.776163 699.51318 A 1.7753623 1.9726247 0 1 1 70.225439,699.51318 A 1.7753623 1.9726247 0 1 1 73.776163 699.51318 z"
transform="translate(34.177691,246.24958)" />
<rect
style="opacity:0.35031846;fill:#0092ff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.46545494px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
id="rect2234"
width="106.77697"
height="35.16954"
x="108.55672"
y="899.84406"
transform="matrix(1,0,-1.8627311e-2,0.9998265,0,0)" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 101.06522,934.70903 L 127.68592,914.51401 L 137.78343,898.90878"
id="path2163" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 169.45723,899.69565 L 196.99589,931.3651"
id="path2165" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 184.02651,935.03692 L 149.60319,919.43169"
id="path2167" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.1 KiB

@@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="354.33069"
height="354.33069"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.45.1"
version="1.0"
sodipodi:docbase="c:\svn\geolib\trunk\src\cpp\library\gl\geometry\doc"
sodipodi:docname="polygon_example.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
gridtolerance="50"
guidetolerance="10"
objecttolerance="10"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.6312445"
inkscape:cx="177.16534"
inkscape:cy="164.4618"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
width="10cm"
height="10cm"
showgrid="true"
gridspacingx="1mm"
gridspacingy="1mm"
gridanglex="8.4666669mm"
gridanglez="8.4666669mm"
grid_units="mm"
inkscape:grid-bbox="false"
inkscape:window-width="1280"
inkscape:window-height="774"
inkscape:window-x="-4"
inkscape:window-y="-4"
units="cm" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-38.639912,-633.95635)">
<rect
style="opacity:0.35031846;fill:#0092ff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.46545494px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
id="rect2234"
width="106.77697"
height="35.16954"
x="108.55672"
y="899.84406"
transform="matrix(1,0,-1.8627311e-2,0.9998265,0,0)" />
<path
style="opacity:0.56687897;fill:#fff900;fill-opacity:1;stroke:#121518;stroke-opacity:1;stroke-width:0.9992126;stroke-miterlimit:4;stroke-dasharray:none;stroke-linejoin:round"
d="M 184,882 L 159,918 L 170,932 L 159,946 L 137.84854,924.45625 L 123.69708,928.09125 L 109.97083,942.15146 L 142,964 L 212,960 L 229,946 L 227,896 L 184,882 z M 194,910 L 209,921 L 187,939 L 180,917 L 194,910 z "
id="path2161"
sodipodi:nodetypes="ccccccccccccccccc" />
<path
sodipodi:type="arc"
style="opacity:0.5;fill:#ff000b;fill-opacity:1;stroke:#000000;stroke-opacity:1"
id="path2232"
sodipodi:cx="72.000801"
sodipodi:cy="699.51318"
sodipodi:rx="1.7753623"
sodipodi:ry="1.9726247"
d="M 73.776163 699.51318 A 1.7753623 1.9726247 0 1 1 70.225439,699.51318 A 1.7753623 1.9726247 0 1 1 73.776163 699.51318 z"
transform="translate(97.937256,218.05672)" />
<path
sodipodi:type="arc"
style="opacity:0.5;fill:#ff000b;fill-opacity:1;stroke:#000000;stroke-opacity:1"
id="path4110"
sodipodi:cx="72.000801"
sodipodi:cy="699.51318"
sodipodi:rx="1.7753623"
sodipodi:ry="1.9726247"
d="M 73.776163 699.51318 A 1.7753623 1.9726247 0 1 1 70.225439,699.51318 A 1.7753623 1.9726247 0 1 1 73.776163 699.51318 z"
transform="translate(73.05507,217.92244)" />
<path
sodipodi:type="arc"
style="opacity:0.5;fill:#ff000b;fill-opacity:1;stroke:#000000;stroke-opacity:1"
id="path4112"
sodipodi:cx="72.000801"
sodipodi:cy="699.51318"
sodipodi:rx="1.7753623"
sodipodi:ry="1.9726247"
d="M 73.776163 699.51318 A 1.7753623 1.9726247 0 1 1 70.225439,699.51318 A 1.7753623 1.9726247 0 1 1 73.776163 699.51318 z"
transform="translate(122.20614,217.62168)" />
<path
style="opacity:0.5;fill:#ff000b;fill-opacity:1;stroke:#121518;stroke-width:0.99921262;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1"
d="M 102.84026,269.66542 L 117.22881,276.63251 L 113.2909,290.8696 L 99.205261,287.2346 L 102.84026,269.66542 z "
id="rect2162"
sodipodi:nodetypes="ccccc"
transform="translate(38.639912,633.95635)" />
<path
style="opacity:0.35031846;fill:#ff4700;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.46541455px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 330.4961,899.74455 L 317.77735,918.05705 L 328.77735,932.05705 L 326.52735,934.93205 L 344.46485,934.93205 L 338.77735,917.05705 L 352.77735,910.05705 L 357.08985,913.2133 L 357.33985,899.74455 L 330.4961,899.74455 z M 296.6211,924.5258 L 282.46485,928.1508 L 275.83986,934.93205 L 306.83985,934.93205 L 296.6211,924.5258 z M 356.77735,930.05705 L 350.8086,934.93205 L 356.6836,934.93205 L 356.77735,930.05705 z "
id="path2183" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.1 KiB

@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="354.33069"
height="354.33069"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.45.1"
version="1.0"
sodipodi:docbase="c:\svn\geolib\trunk\src\cpp\library\gl\doc"
sodipodi:docname="polygon_example.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
gridtolerance="50"
guidetolerance="10"
objecttolerance="10"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="6.6340734"
inkscape:cx="121.70637"
inkscape:cy="65.376123"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
width="10cm"
height="10cm"
showgrid="true"
gridspacingx="1mm"
gridspacingy="1mm"
gridanglex="8.4666669mm"
gridanglez="8.4666669mm"
grid_units="mm"
inkscape:grid-bbox="false"
inkscape:window-width="1280"
inkscape:window-height="744"
inkscape:window-x="-4"
inkscape:window-y="-4"
units="cm" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-38.639912,-633.95635)">
<rect
style="opacity:0.35031846;fill:#0092ff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.46545494px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
id="rect2234"
width="106.77697"
height="35.16954"
x="108.55672"
y="899.84406"
transform="matrix(1,0,-1.8627311e-2,0.9998265,0,0)" />
<path
style="opacity:0.56687897;fill:#fff900;fill-opacity:1;stroke:#121518;stroke-opacity:1;stroke-width:0.9992126;stroke-miterlimit:4;stroke-dasharray:none;stroke-linejoin:round"
d="M 183.96492,882.10899 L 159.3519,917.95833 L 170.01492,931.78926 L 158.96896,946.27736 L 138.06489,928.55892 L 123.87568,928.5754 L 112.86946,942.48336 L 141.60982,963.71284 L 212.38594,960.27083 L 229.28535,945.91682 L 226.64045,896.49471 L 183.96492,882.10899 z M 194.37062,910.01505 L 209.05737,921.28896 L 187.45444,939.06871 L 180.11964,917.58522 L 194.37062,910.01505 z "
id="path2161"
sodipodi:nodetypes="ccccccccccccccccc" />
<path
sodipodi:type="arc"
style="opacity:0.5;fill:#ff000b;fill-opacity:1;stroke:#000000;stroke-opacity:1"
id="path2232"
sodipodi:cx="72.000801"
sodipodi:cy="699.51318"
sodipodi:rx="1.7753623"
sodipodi:ry="1.9726247"
d="M 73.776163 699.51318 A 1.7753623 1.9726247 0 1 1 70.225439,699.51318 A 1.7753623 1.9726247 0 1 1 73.776163 699.51318 z"
transform="translate(98.391632,219.11693)" />
<path
sodipodi:type="arc"
style="opacity:0.5;fill:#ff000b;fill-opacity:1;stroke:#000000;stroke-opacity:1"
id="path4110"
sodipodi:cx="72.000801"
sodipodi:cy="699.51318"
sodipodi:rx="1.7753623"
sodipodi:ry="1.9726247"
d="M 73.776163 699.51318 A 1.7753623 1.9726247 0 1 1 70.225439,699.51318 A 1.7753623 1.9726247 0 1 1 73.776163 699.51318 z"
transform="translate(73.963821,218.98265)" />
<path
sodipodi:type="arc"
style="opacity:0.5;fill:#ff000b;fill-opacity:1;stroke:#000000;stroke-opacity:1"
id="path4112"
sodipodi:cx="72.000801"
sodipodi:cy="699.51318"
sodipodi:rx="1.7753623"
sodipodi:ry="1.9726247"
d="M 73.776163 699.51318 A 1.7753623 1.9726247 0 1 1 70.225439,699.51318 A 1.7753623 1.9726247 0 1 1 73.776163 699.51318 z"
transform="translate(120.84301,218.53043)" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.3 KiB

Some files were not shown because too many files have changed in this diff Show More