|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r66082 - in sandbox/itl/libs/itl: doc test/test_casual_
From: afojgo_at_[hidden]
Date: 2010-10-18 15:27:35
Author: jofaber
Date: 2010-10-18 15:27:29 EDT (Mon, 18 Oct 2010)
New Revision: 66082
URL: http://svn.boost.org/trac/boost/changeset/66082
Log:
Updated documentation: Modified Interface. Addition of docs for intervals.
Text files modified:
sandbox/itl/libs/itl/doc/icl.qbk | 4 +-
sandbox/itl/libs/itl/doc/interface.qbk | 67 ++++++++++++++++++++++++++++++++++-----
sandbox/itl/libs/itl/test/test_casual_/test_casual.cpp | 19 +++++++++++
3 files changed, 78 insertions(+), 12 deletions(-)
Modified: sandbox/itl/libs/itl/doc/icl.qbk
==============================================================================
--- sandbox/itl/libs/itl/doc/icl.qbk (original)
+++ sandbox/itl/libs/itl/doc/icl.qbk 2010-10-18 15:27:29 EDT (Mon, 18 Oct 2010)
@@ -30,8 +30,8 @@
[def __op_itv__ [classref boost::icl::open_interval open_interval]]
[def __cl_itv__ [classref boost::icl::closed_interval closed_interval]]
-[def __dc_itv__ [classref boost::icl::closed_interval discrete_interval]]
-[def __ct_itv__ [classref boost::icl::closed_interval continous_interval]]
+[def __dc_itv__ [classref boost::icl::discrete_interval discrete_interval]]
+[def __ct_itv__ [classref boost::icl::continuous_interval continuous_interval]]
[def __itvs__ [classref boost::icl::interval intervals]]
Modified: sandbox/itl/libs/itl/doc/interface.qbk
==============================================================================
--- sandbox/itl/libs/itl/doc/interface.qbk (original)
+++ sandbox/itl/libs/itl/doc/interface.qbk 2010-10-18 15:27:29 EDT (Mon, 18 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
@@ -18,16 +18,63 @@
[section Intervals]
-[table Interval class templates
-[[group] [template] [instance parameters]]
-[[`static_bounded`] [__ro_itv__] [`<class DomainT,template<class>class Compare>`]]
-[[ ] [__lo_itv__] []]
-[[ ] [__cl_itv__] []]
-[[ ] [__op_itv__] []]
-[[`dynamic_bounded`] [__dc_itv__] []]
-[[ ] [__ct_itv__] []]
-]
+In the *icl* we have two groups of interval types. There are ['*statically bounded*] intervals,
+__ro_itv__,
+__lo_itv__,
+__cl_itv__,
+__op_itv__,
+that always have the the same kind of interval borders and ['*dynamically bounded*] intervals,
+__dc_itv__,
+__ct_itv__
+which can have one of the four possible bound types at runtime.
+
+[table Interval class templates
+[[group] [form] [template] [instance parameters]]
+[[`static_bounded`] [asymmetric][__ro_itv__] [`<class DomainT, template<class>class Compare>`]]
+[[ ] [] [__lo_itv__] [`<...same for all interval class templates...>`]]
+[[ ] [symmetric] [__cl_itv__] []]
+[[ ] [] [__op_itv__] []]
+[[`dynamic_bounded`][] [__dc_itv__] []]
+[[ ] [] [__ct_itv__] []]
+]
+
+Not every class template works with all domain types. Use interval class templates
+according the next table.
+
+[table Usability of interval class templates for discrete or continuous domain types
+[[group] [form] [template] [discrete] [continuous] ]
+[[`static_bounded`] [asymmetric][__ro_itv__] [yes] [yes] ]
+[[ ] [] [__lo_itv__] [yes] [yes] ]
+[[ ] [symmetric] [__cl_itv__] [yes] [ ] ]
+[[ ] [] [__op_itv__] [yes] [ ] ]
+[[`dynamic_bounded`][] [__dc_itv__] [yes] [ ] ]
+[[ ] [] [__ct_itv__] [] [yes] ]
+]
+
+From a pragmatical point of view, the most important interval class template
+of the /statically bounded/ group is __ro_itv__. For discrete domain types
+also closed intervals might be convenient.
+
+Use __ct_itv__, if you work with interval containers of countinuous domain types
+and you want to be able to handle single values as well:
+
+``
+typedef interval_set<std::string, less, continuous_interval<std::string> > IdentifiersT;
+IdentifiersT identifiers, excluded;
+identifiers += continuous_interval<std::string>::right_open("a", "c");
+
+// special identifiers shall be excluded
+identifiers -= std::string("boost");
+cout << "identifiers: " << identifiers << endl;
+
+excluded = IdentifiersT(icl::hull(identifiers)) - identifiers;
+cout << "excluded : " << excluded << endl;
+
+//------ Program output: --------
+identifiers: {[a,boost)(boost,c)}
+excluded : {[boost,boost]}
+``
[endsect][/ Intervals]
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-18 15:27:29 EDT (Mon, 18 Oct 2010)
@@ -72,6 +72,25 @@
//...so this iterates over intervals
//TV.switch_on(*telecast);
cout << *telecast;
+
+ cout << endl;
+}
+
+BOOST_AUTO_TEST_CASE(interface_sample_identifiers)
+{
+ typedef interval_set<std::string, less, continuous_interval<std::string> > IdentifiersT;
+ IdentifiersT identifiers, excluded;
+
+ // special identifiers shall be excluded
+ identifiers += continuous_interval<std::string>::right_open("a", "c");
+ identifiers -= std::string("boost");
+ cout << "identifiers: " << identifiers << endl;
+
+ excluded = IdentifiersT(icl::hull(identifiers)) - identifiers;
+ cout << "excluded : " << excluded << endl;
+
+ if(icl::contains(identifiers, std::string("boost")))
+ cout << "error, identifiers.contains('boost')\n";
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk