Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65977 - in sandbox/itl/libs/itl: doc test/test_casual_
From: afojgo_at_[hidden]
Date: 2010-10-15 09:07:55

Author: jofaber
Date: 2010-10-15 09:07:52 EDT (Fri, 15 Oct 2010)
New Revision: 65977

Refactoring: Updated documentation. Updated section examples. Inserted example custom interval.
Text files modified:
   sandbox/itl/libs/itl/doc/examples.qbk | 40 ++++++---
   sandbox/itl/libs/itl/doc/introduction.qbk | 33 +++++---
   sandbox/itl/libs/itl/doc/itl.qbk | 152 ++++++++++++++++++++--------------------
   sandbox/itl/libs/itl/test/test_casual_/test_casual.cpp | 29 +++++++
   4 files changed, 148 insertions(+), 106 deletions(-)

Modified: sandbox/itl/libs/itl/doc/examples.qbk
--- sandbox/itl/libs/itl/doc/examples.qbk (original)
+++ sandbox/itl/libs/itl/doc/examples.qbk 2010-10-15 09:07:52 EDT (Fri, 15 Oct 2010)
@@ -1,5 +1,5 @@
- Copyright (c) 2008-2009 Joachim Faulhaber
+ Copyright (c) 2008-2010 Joachim Faulhaber
     Distributed under the Boost Software License, Version 1.0.
     (See accompanying file LICENSE_1_0.txt or copy at
@@ -12,48 +12,51 @@
 [table Overview over Icl Examples
         [[level] [example] [classes] [features]]
- [[intro][[link Party]]
+ [[intro][[link Party]]
                 [__itv_map__][Generates an attendance history of a party
                           by inserting into an __itv_map__.
                                           ['*aggregate on overlap*].]]
- [[basic] [[link boost_itl.examples.interval Interval]]
+ [[basic] [[link boost_icl.examples.interval Interval]]
             [__itv__] [Intervals for integral and continuous instance types.
                        Closed and open interval borders.]]
- [[basic] [[link boost_itl.examples.interval_container Interval container]]
+ [[basic] [[link boost_icl.examples.interval_container Interval container]]
                                        [Basic characteristics of interval containers.]]
- [[basic] [[link boost_itl.examples.overlap_counter Overlap counter]]
+ [[basic] [[link boost_icl.examples.overlap_counter Overlap counter]]
             [__itv_map__][The most simple application of an interval map:
                           Counting the overlaps of added intervals.]]
- [[advanced][[link boost_itl.examples.partys_height_average Party's height average]]
+ [[advanced][[link boost_icl.examples.partys_height_average Party's height average]]
             [__itv_map__][Using /aggregate on overlap/ a history of height averages of party guests is computed.
                           Associated values are user defined class objects, that implement
                           an appropriate `operator +=` for the aggregation.]]
- [[advanced][[link boost_itl.examples.partys_tallest_guests Party's tallest guests]]
+ [[advanced][[link boost_icl.examples.partys_tallest_guests Party's tallest guests]]
                          [Using /aggregate on overlap/ the heights of the party's tallest guests are computed.
                           Associated values are aggregated via a maximum functor, that can
                           be chosen as template parameter of an interval_map class template.]]
- [[advanced][[link boost_itl.examples.time_grids_for_months_and_weeks Time grids for months and weeks]]
+ [[advanced][[link boost_icl.examples.time_grids_for_months_and_weeks Time grids for months and weeks]]
                                                                              [Shows how the ['*border preserving*]
                                               __spl_itv_set__ can be used to create time partitions where different
                                               periodic time intervals overlay each other.]]
- [[advanced][[link boost_itl.examples.man_power Man power]]
+ [[advanced][[link boost_icl.examples.man_power Man power]]
                 [Set style operations on __itv_sets__ and __itv_maps__ like union, difference
              and intersection can be used to obtain calculations in a flexible way. Example
              [*man_power] demonstrates such operations in the process of calculating the
              available man-power of a company in a given time interval.]]
- [[advanced][[link boost_itl.examples.user_groups User groups]][__itv_map__]
+ [[advanced][[link boost_icl.examples.user_groups User groups]][__itv_map__]
                 [Example [*user_groups] shows how interval_maps can be unified or
          intersected to calculate desired information.]]
- [[and std] [[link boost_itl.examples.std_copy Std copy]]
+ [[and std] [[link boost_icl.examples.std_copy Std copy]]
             [__itv_map__][Fill interval containers using `std::copy`.]]
- [[and std] [[link boost_itl.examples.std_transform Std transform]]
+ [[and std] [[link boost_icl.examples.std_transform Std transform]]
             [__itv_map__,\n__sep_itv_set__][Fill interval containers from user defined objects using `std::transform`.]]
+ [[customize] [[link boost_icl.examples.custom_interval Custom interval]]
+ [JODO interval_traits][Use interval containers with your own interval class types.]]
@@ -136,7 +139,7 @@
 Example [*interval container] demonstrates the characteristic behaviors
 of different interval containers that are also summarized
-in the introductory [link boost_itl.introduction.interval_combining_styles Interval Combining Styles].
+in the introductory [link boost_icl.introduction.interval_combining_styles Interval Combining Styles].
 [import ../example/interval_container_/interval_container.cpp]
@@ -327,7 +330,7 @@
 To get clear about the different behaviors of interval containers
 in the example, you may want to refer to the section about
-[link boost_itl.introduction.interval_combining_styles interval combining styles]
+[link boost_icl.introduction.interval_combining_styles interval combining styles]
 that uses the same data.
@@ -354,6 +357,15 @@
 [endsect][/ std::transform]
+[section Custom interval]
+Example *custom interval* demonstrates how to use interval
+containers with an own interval class type.
+[import ../example/custom_interval_/custom_interval.cpp]
+[endsect][/ Custom interval]
 [endsect][/ examples]

Modified: sandbox/itl/libs/itl/doc/introduction.qbk
--- sandbox/itl/libs/itl/doc/introduction.qbk (original)
+++ sandbox/itl/libs/itl/doc/introduction.qbk 2010-10-15 09:07:52 EDT (Fri, 15 Oct 2010)
@@ -15,8 +15,13 @@
 from February 18, 2010 to March 08, 2010 and has been accepted
 into the boost library collection.
-The name ['*Interval Template Library (ITL)*] is provisional
-an will be changed to ['*Interval Container Library (ICL)*].
+The name ['*Interval Template Library (ITL)*]
+will be changed to ['*Interval Container Library (ICL)*].
+The library is currently refactored for the suggestions and requests
+that came up during the review. These modifications will be
+completed in autumn 2010 and the library will probably
+available with the boost release 1.46.
 ["A bug crawls across the boost docs on my laptop screen.
@@ -33,14 +38,14 @@
 intervals that does still represent a /set/,
 you arrive at the idea of /interval_sets/ provided by this library.
-Interval containers of the *ITL* have been developed initially at
+Interval containers of the *ICL* have been developed initially at
 [@ Cortex Software GmbH]
 to solve problems related to date and time interval
 computations in the context of a Hospital Information System.
 Time intervals with associated values like ['amount of invoice]
 or ['set of therapies] had to be manipulated in statistics,
 billing programs and therapy scheduling programs.
-So the *ITL* emerged out of those industrial use cases.
+So the *ICL* emerged out of those industrial use cases.
 It extracts generic code that helps to solve common
 problems from the date and time problem domain and can be
 beneficial in other fields as well.
@@ -51,19 +56,19 @@
 problem domain, elements are typically occurring in contiguous
 Besides a compact representation of associative containers, that
-can reduce the cost of space and time drastically, the ITL
+can reduce the cost of space and time drastically, the ICL
 comes with a universal mechanism of aggregation, that allows
 to combine associated values in meaningful ways when intervals
 overlap on insertion.
 For a condensed introduction and overview you may want to look at the
-presentation material on the *ITL* from ['*BoostCon2009*]].
+presentation material on the *ICL* from ['*BoostCon2009*]].
 [section Definition and Basic Example]
-The [*Interval Template Library (ITL)] provides __itvs__ and two kinds of
+The [*Interval Template Library (ICL)] provides __itvs__ and two kinds of
 interval containers: __itv_sets__ and __itv_maps__.
 * An __itv_bset__ is a *set* that is implemented as a set of intervals.
@@ -83,7 +88,7 @@
 interval_set<int> mySet;
-bool has_answer = mySet.contains(42);
+bool has_answer = contains(mySet, 42);
@@ -93,10 +98,10 @@
 // Switch on my favorite telecasts using an interval_set
-interval<seconds> news(make_seconds("20:00:00"), make_seconds("20:15:00"));
-interval<seconds> talk_show(make_seconds("22:45:30"), make_seconds("23:30:50"));
+interval<seconds>::type news(make_seconds("20:00:00"), make_seconds("20:15:00"));
+interval<seconds>::type talk_show(make_seconds("22:45:30"), make_seconds("23:30:50"));
 interval_set<seconds> myTvProgram;
 // Iterating over elements (seconds) would be silly ...
 for(interval_set<seconds>::iterator telecast = myTvProgram.begin();
@@ -134,10 +139,10 @@
 In the example Mary enters the party first. She attends during the
 time interval `[20:00,22:00)`. Harry enters later. He stays within `[21:00,23:00)`.
-typedef itl::set<string> guests;
+typedef std::set<string> guests;
 interval_map<time, guests> party;
-party += make_pair(interval<time>::rightopen(time("20:00"), time("22:00")), guests("Mary"));
-party += make_pair(interval<time>::rightopen(time("21:00"), time("23:00")), guests("Harry"));
+party += make_pair(interval<time>::right_open(time("20:00"), time("22:00")), guests("Mary"));
+party += make_pair(interval<time>::right_open(time("21:00"), time("23:00")), guests("Harry"));
 // party now contains
 [20:00, 21:00)->{"Mary"}
 [21:00, 22:00)->{"Harry","Mary"} //guest sets aggregated on overlap

Modified: sandbox/itl/libs/itl/doc/itl.qbk
--- sandbox/itl/libs/itl/doc/itl.qbk (original)
+++ sandbox/itl/libs/itl/doc/itl.qbk 2010-10-15 09:07:52 EDT (Fri, 15 Oct 2010)
@@ -18,82 +18,82 @@
 [/ Macros will be used for links so we have a central place to change them ]
-[def __itv__ [classref boost::itl::interval interval]]
-[def __Itv__ [classref boost::itl::interval Interval]]
-[def __itvs__ [classref boost::itl::interval intervals]]
-[def __itl_itvs__ [classref boost::itl::interval itl::intervals]]
-[def __Itvs__ [classref boost::itl::interval Intervals]]
-[def __itv_set__ [classref boost::itl::interval_set interval_set]]
-[def __itv_sets__ [classref boost::itl::interval_set interval_sets]]
-[def __itv_bset__ [classref boost::itl::interval_base_set interval_set]]
-[def __Itv_bset__ [classref boost::itl::interval_base_set Interval_set]]
-[def __itv_bsets__ [classref boost::itl::interval_base_set interval_sets]]
-[def __itv_bset_s__ [classref boost::itl::interval_base_set interval_set's]]
-[def __Itv_bsets__ [classref boost::itl::interval_base_set Interval_sets]]
-[def __ele_set__ [classref boost::itl::set set]]
-[def __ele_sets__ [classref boost::itl::set sets]]
-[def __itl_set__ [classref boost::itl::set itl::set]]
-[def __itl_sets__ [classref boost::itl::set itl::sets]]
-[def __Itv_set__ [classref boost::itl::interval_set Interval_set]]
-[def __Itv_sets__ [classref boost::itl::interval_set Interval_sets]]
-[def __spl_itv_set__ [classref boost::itl::split_interval_set split_interval_set]]
-[def __spl_itv_sets__ [classref boost::itl::split_interval_set split_interval_sets]]
-[def __spl_itv_set_s__ [classref boost::itl::split_interval_set split_interval_set's]]
-[def __Spl_itv_set__ [classref boost::itl::split_interval_set Split_interval_set]]
-[def __sep_itv_set__ [classref boost::itl::separate_interval_set separate_interval_set]]
-[def __sep_itv_sets__ [classref boost::itl::separate_interval_set separate_interval_sets]]
-[def __Sep_itv_set__ [classref boost::itl::separate_interval_set Separate_interval_set]]
-[def __itv_map__ [classref boost::itl::interval_map interval_map]]
-[def __itv_maps__ [classref boost::itl::interval_map interval_maps]]
-[def __itv_map_s__ [classref boost::itl::interval_map interval_map's]]
-[def __itv_bmap__ [classref boost::itl::interval_base_map interval_map]]
-[def __Itv_bmap__ [classref boost::itl::interval_base_map Interval_map]]
-[def __itv_bmaps__ [classref boost::itl::interval_base_map interval_maps]]
-[def __Itv_bmaps__ [classref boost::itl::interval_base_map Interval_maps]]
-[def __itv_bmap_s__ [classref boost::itl::interval_base_map interval_map's]]
-[def __Itv_map__ [classref boost::itl::interval_map Interval_map]]
-[def __spl_itv_map__ [classref boost::itl::split_interval_map split_interval_map]]
-[def __Spl_itv_map__ [classref boost::itl::split_interval_map Split_interval_map]]
-[def __spl_itv_maps__ [classref boost::itl::split_interval_map split_interval_maps]]
-[def __inverse__ [classref boost::itl::inverse inverse]]
-[def __ip_cross__ [classref boost::itl::inplace_cross inplace_cross]]
-[def __ip_dash__ [classref boost::itl::inplace_dash inplace_dash]]
-[def __ip_plus__ [classref boost::itl::inplace_plus inplace_plus]]
-[def __ip_minus__ [classref boost::itl::inplace_minus inplace_minus]]
-[def __ip_star__ [classref boost::itl::inplace_star inplace_star]]
-[def __ip_slash__ [classref boost::itl::inplace_slash inplace_slash]]
-[def __ip_times__ [classref boost::itl::inplace_times inplace_times]]
-[def __ip_divide__ [classref boost::itl::inplace_divide inplace_divide]]
-[def __ip_pipe__ [classref boost::itl::inplace_pipe inplace_pipe]]
-[def __ip_et__ [classref boost::itl::inplace_et inplace_et]]
-[def __ip_caret__ [classref boost::itl::inplace_caret inplace_caret]]
-[def __ip_min__ [classref boost::itl::inplace_min inplace_min]]
-[def __ip_max__ [classref boost::itl::inplace_max inplace_max]]
-[def __ip_identity__ [classref boost::itl::inplace_identity inplace_identity]]
-[def __ip_erasure__ [classref boost::itl::inplace_erasure inplace_erasure]]
-[def __ip_bitset_union__ [classref boost::itl::inplace_bitset_union inplace_bitset_union]]
-[def __ip_bitset_difference__ [classref boost::itl::inplace_bitset_difference inplace_bitset_difference]]
-[def __itv_bmap_add__ [memberref boost::itl::interval_base_map::add add]]
-[def __ele_map__ [classref boost::itl::map map]]
-[def __ele_maps__ [classref boost::itl::map maps]]
-[def __itl_map__ [classref boost::itl::map itl::map]]
-[def __itl_maps__ [classref boost::itl::map itl::maps]]
-[def __itl_map_s__ [classref boost::itl::map itl::map's]]
-[def __pabsorber__ [classref boost::itl::partial_absorber partial_absorber]]
-[def __penricher__ [classref boost::itl::partial_enricher partial_enricher]]
-[def __penrichers__ [classref boost::itl::partial_enricher partial_enrichers]]
-[def __tabsorber__ [classref boost::itl::total_absorber total_absorber]]
-[def __tenricher__ [classref boost::itl::total_absorber total_enricher]]
+[def __itv__ [classref boost::icl::interval interval]]
+[def __Itv__ [classref boost::icl::interval Interval]]
+[def __itvs__ [classref boost::icl::interval intervals]]
+[def __itl_itvs__ [classref boost::icl::interval icl::intervals]]
+[def __Itvs__ [classref boost::icl::interval Intervals]]
+[def __itv_set__ [classref boost::icl::interval_set interval_set]]
+[def __itv_sets__ [classref boost::icl::interval_set interval_sets]]
+[def __itv_bset__ [classref boost::icl::interval_base_set interval_set]]
+[def __Itv_bset__ [classref boost::icl::interval_base_set Interval_set]]
+[def __itv_bsets__ [classref boost::icl::interval_base_set interval_sets]]
+[def __itv_bset_s__ [classref boost::icl::interval_base_set interval_set's]]
+[def __Itv_bsets__ [classref boost::icl::interval_base_set Interval_sets]]
+[def __ele_set__ [classref boost::icl::set set]]
+[def __ele_sets__ [classref boost::icl::set sets]]
+[def __itl_set__ [classref boost::icl::set icl::set]]
+[def __itl_sets__ [classref boost::icl::set icl::sets]]
+[def __Itv_set__ [classref boost::icl::interval_set Interval_set]]
+[def __Itv_sets__ [classref boost::icl::interval_set Interval_sets]]
+[def __spl_itv_set__ [classref boost::icl::split_interval_set split_interval_set]]
+[def __spl_itv_sets__ [classref boost::icl::split_interval_set split_interval_sets]]
+[def __spl_itv_set_s__ [classref boost::icl::split_interval_set split_interval_set's]]
+[def __Spl_itv_set__ [classref boost::icl::split_interval_set Split_interval_set]]
+[def __sep_itv_set__ [classref boost::icl::separate_interval_set separate_interval_set]]
+[def __sep_itv_sets__ [classref boost::icl::separate_interval_set separate_interval_sets]]
+[def __Sep_itv_set__ [classref boost::icl::separate_interval_set Separate_interval_set]]
+[def __itv_map__ [classref boost::icl::interval_map interval_map]]
+[def __itv_maps__ [classref boost::icl::interval_map interval_maps]]
+[def __itv_map_s__ [classref boost::icl::interval_map interval_map's]]
+[def __itv_bmap__ [classref boost::icl::interval_base_map interval_map]]
+[def __Itv_bmap__ [classref boost::icl::interval_base_map Interval_map]]
+[def __itv_bmaps__ [classref boost::icl::interval_base_map interval_maps]]
+[def __Itv_bmaps__ [classref boost::icl::interval_base_map Interval_maps]]
+[def __itv_bmap_s__ [classref boost::icl::interval_base_map interval_map's]]
+[def __Itv_map__ [classref boost::icl::interval_map Interval_map]]
+[def __spl_itv_map__ [classref boost::icl::split_interval_map split_interval_map]]
+[def __Spl_itv_map__ [classref boost::icl::split_interval_map Split_interval_map]]
+[def __spl_itv_maps__ [classref boost::icl::split_interval_map split_interval_maps]]
+[def __inverse__ [classref boost::icl::inverse inverse]]
+[def __ip_cross__ [classref boost::icl::inplace_cross inplace_cross]]
+[def __ip_dash__ [classref boost::icl::inplace_dash inplace_dash]]
+[def __ip_plus__ [classref boost::icl::inplace_plus inplace_plus]]
+[def __ip_minus__ [classref boost::icl::inplace_minus inplace_minus]]
+[def __ip_star__ [classref boost::icl::inplace_star inplace_star]]
+[def __ip_slash__ [classref boost::icl::inplace_slash inplace_slash]]
+[def __ip_times__ [classref boost::icl::inplace_times inplace_times]]
+[def __ip_divide__ [classref boost::icl::inplace_divide inplace_divide]]
+[def __ip_pipe__ [classref boost::icl::inplace_pipe inplace_pipe]]
+[def __ip_et__ [classref boost::icl::inplace_et inplace_et]]
+[def __ip_caret__ [classref boost::icl::inplace_caret inplace_caret]]
+[def __ip_min__ [classref boost::icl::inplace_min inplace_min]]
+[def __ip_max__ [classref boost::icl::inplace_max inplace_max]]
+[def __ip_identity__ [classref boost::icl::inplace_identity inplace_identity]]
+[def __ip_erasure__ [classref boost::icl::inplace_erasure inplace_erasure]]
+[def __ip_bitset_union__ [classref boost::icl::inplace_bitset_union inplace_bitset_union]]
+[def __ip_bitset_difference__ [classref boost::icl::inplace_bitset_difference inplace_bitset_difference]]
+[def __itv_bmap_add__ [memberref boost::icl::interval_base_map::add add]]
+[def __ele_map__ [classref boost::icl::map map]]
+[def __ele_maps__ [classref boost::icl::map maps]]
+[def __itl_map__ [classref boost::icl::map icl::map]]
+[def __itl_maps__ [classref boost::icl::map icl::maps]]
+[def __itl_map_s__ [classref boost::icl::map icl::map's]]
+[def __pabsorber__ [classref boost::icl::partial_absorber partial_absorber]]
+[def __penricher__ [classref boost::icl::partial_enricher partial_enricher]]
+[def __penrichers__ [classref boost::icl::partial_enricher partial_enrichers]]
+[def __tabsorber__ [classref boost::icl::total_absorber total_absorber]]
+[def __tenricher__ [classref boost::icl::total_absorber total_enricher]]
-[def __itv_bse_set__ [classref boost::itl::interval_base_set interval_base_set]]
+[def __itv_bse_set__ [classref boost::icl::interval_base_set interval_base_set]]
 [def __e [link element_type *e*]]
 [def __i [link interval_type *i*]]
 [def __s [link itl_set_type *s*]]
@@ -204,4 +204,4 @@
 [xinclude itldoc.xml]
-14:46 18.11.2008
\ No newline at end of file
+14:46 15.10.2010
\ No newline at end of file

Modified: sandbox/itl/libs/itl/test/test_casual_/test_casual.cpp
--- sandbox/itl/libs/itl/test/test_casual_/test_casual.cpp (original)
+++ sandbox/itl/libs/itl/test/test_casual_/test_casual.cpp 2010-10-15 09:07:52 EDT (Fri, 15 Oct 2010)
@@ -22,8 +22,8 @@
 #include <boost/type_traits/is_floating_point.hpp>
+#define BOOST_ICL_DISCRETE_STATIC_INTERVAL_BORDERS 2 //0=() 1=(] 2=[) 3=[]
 #include <boost/itl/interval_set.hpp>
 #include <boost/itl/separate_interval_set.hpp>
@@ -49,6 +49,31 @@
 using namespace unit_test;
 using namespace boost::icl;
+ interval_set<int> mySet;
+ mySet.insert(42);
+ bool has_answer = contains(mySet, 42);
+ // Switch on my favorite telecasts using an interval_set
+ interval<int>::type news(2000, 2015);
+ interval<int>::type talk_show(2245, 2330);
+ interval_set<int> myTvProgram;
+ myTvProgram.add(news).add(talk_show);
+ // Iterating over elements (seconds) would be silly ...
+ for(interval_set<int>::iterator telecast = myTvProgram.begin();
+ telecast != myTvProgram.end(); ++telecast)
+ // this iterates over intervals
+ //TV.switch_on(*telecast);
+ cout << *telecast;
 /*CL after Proto

Boost-Commit list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at