|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r52822 - in sandbox/itl: . boost/itl boost/itl_xt boost/validate/driver boost/validate/gentor libs/itl/build/cygwin libs/itl/build/win32 libs/itl/doc libs/itl/example libs/itl/example/boost_party libs/itl/example/partys_height_average libs/itl/example/partys_tallest_guests libs/itl/test/test_casual libs/validate/example/labat_single libs/validate/src/gentor
From: afojgo_at_[hidden]
Date: 2009-05-07 02:56:17
Author: jofaber
Date: 2009-05-07 02:56:11 EDT (Thu, 07 May 2009)
New Revision: 52822
URL: http://svn.boost.org/trac/boost/changeset/52822
Log:
A bunch of postponed additions from seg_tree experiments. Stable {msvc-9.0}
Added:
sandbox/itl/libs/itl/example/partys_height_average/
sandbox/itl/libs/itl/example/partys_height_average/Jamfile.v2 (contents, props changed)
sandbox/itl/libs/itl/example/partys_height_average/partys_height_average.cpp (contents, props changed)
sandbox/itl/libs/itl/example/partys_height_average/vc9_partys_height_average.vcproj (contents, props changed)
sandbox/itl/libs/itl/example/partys_tallest_guests/
sandbox/itl/libs/itl/example/partys_tallest_guests/Jamfile.v2 (contents, props changed)
sandbox/itl/libs/itl/example/partys_tallest_guests/partys_tallest_guests.cpp (contents, props changed)
sandbox/itl/libs/itl/example/partys_tallest_guests/vc9_partys_tallest_guests.vcproj (contents, props changed)
Text files modified:
sandbox/itl/README.TXT | 9 +++
sandbox/itl/README_PLUS.TXT | 11 +++
sandbox/itl/boost/itl/interval.hpp | 111 +++++++++++++++++++++++++++++++++++++++
sandbox/itl/boost/itl/set.hpp | 7 +
sandbox/itl/boost/itl/split_interval_map.hpp | 6 +-
sandbox/itl/boost/itl/split_interval_set.hpp | 68 +++++++++++------------
sandbox/itl/boost/itl_xt/numbergentor.hpp | 2
sandbox/itl/boost/itl_xt/setgentor.hpp | 2
sandbox/itl/boost/validate/driver/itl_driver.hpp | 4
sandbox/itl/boost/validate/gentor/randomgentor.hpp | 28 +++++++++
sandbox/itl/libs/itl/build/cygwin/makefile | 23 ++++++--
sandbox/itl/libs/itl/build/win32/vc9_all.sln | 12 ++++
sandbox/itl/libs/itl/doc/Jamfile.v2 | 2
sandbox/itl/libs/itl/doc/acknowledgments.qbk | 3
sandbox/itl/libs/itl/doc/introduction.qbk | 40 +++++++++++++
sandbox/itl/libs/itl/example/Jamfile.v2 | 18 ++++++
sandbox/itl/libs/itl/example/boost_party/boost_party.cpp | 57 +-------------------
sandbox/itl/libs/itl/test/test_casual/test_casual.cpp | 43 +++------------
sandbox/itl/libs/validate/example/labat_single/labat_single.cpp | 20 +++++-
sandbox/itl/libs/validate/src/gentor/gentorprofile.cpp | 21 +++++++
20 files changed, 337 insertions(+), 150 deletions(-)
Modified: sandbox/itl/README.TXT
==============================================================================
--- sandbox/itl/README.TXT (original)
+++ sandbox/itl/README.TXT 2009-05-07 02:56:11 EDT (Thu, 07 May 2009)
@@ -10,8 +10,10 @@
+-----------------------------------------------------------------------------*/
Interval Template Library (Boost.Itl)
+=====================================
Abstract:
+=========
The Interval Template Library (Itl) provides intervals
and two kinds of interval containers: Interval_sets and
@@ -33,7 +35,14 @@
feature is called aggregate on overlap.
+Portability:
+============
+
+* The Itl compiles with gcc-3.4.4, gcc-4.3.0 and msvc-9.0
+
+
Content:
+========
itl.html html-documentation refering to
libs/itl/doc/html/index.html
Modified: sandbox/itl/README_PLUS.TXT
==============================================================================
--- sandbox/itl/README_PLUS.TXT (original)
+++ sandbox/itl/README_PLUS.TXT 2009-05-07 02:56:11 EDT (Thu, 07 May 2009)
@@ -15,6 +15,7 @@
validate A law based test automaton (LaBatea).
Abstract:
+=========
The Interval Template Library (Itl) provides intervals
and two kinds of interval containers: Interval_sets and
@@ -41,7 +42,17 @@
itl as test automaton and for checkeing sematical
concepts.
+
+Portability:
+============
+
+* The Itl compiles with gcc-3.4.4, gcc-4.3.0 and msvc-9.0
+
+* Valitate (LaBatea) ONLY compiles with msvc! Prefer msvc-9.0
+ for efficiency reasons.
+
Content:
+========
=== Boost.Itl =================================================================
itl.html html-documentation refering to
Modified: sandbox/itl/boost/itl/interval.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval.hpp (original)
+++ sandbox/itl/boost/itl/interval.hpp 2009-05-07 02:56:11 EDT (Thu, 07 May 2009)
@@ -142,10 +142,20 @@
/** <tt>*this</tt> is subset of <tt>super</tt> */
bool contained_in(const interval& super)const ;
+ /** <tt>sub</tt> is proper subset of <tt>*this</tt> and does not touch the borders of <tt>*this</tt> */
+ bool free_contains(const interval& sub)const;
+
+ /** <tt>sub</tt> is proper subset of <tt>*this</tt> */
+ bool proper_contains(const interval& sub)const;
+
/** <tt>*this</tt> and <tt>x2</tt> are disjoint; their intersection is empty */
bool is_disjoint(const interval& x2)const
{ return exclusive_less(x2) || x2.exclusive_less(*this); }
+ /** <tt>*this</tt> and <tt>x2</tt> have a non empty intersection */
+ bool intersects(const interval& x2)const
+ { return !is_disjoint(x2); }
+
//==========================================================================
//= Size
//==========================================================================
@@ -187,6 +197,12 @@
maximum of upper bounds */
interval& extend(const interval& x2);
+ interval& left_extend(const interval& x2);
+ interval& right_extend(const interval& x2);
+
+ interval& left_set(const interval& x2);
+ interval& right_set(const interval& x2);
+
/** Interval spanning from lower bound of \c *this interval to the upper bound of \c rhs.
Bordertypes according to the lower bound of \c *this and the upper bound of \c rhs. */
interval span(const interval& rhs)const
@@ -307,6 +323,10 @@
/** Maximal element of <tt>*this</tt> is less than the minimal element of <tt>x2</tt> */
bool exclusive_less(const interval& x2)const;
+ /** Maximal element of <tt>*this</tt> is less than the minimal element of <tt>x2</tt>
+ and there is at least one element in between. */
+ bool distant_less(const interval& x2)const;
+
/** Set \c *this interval to from \c low to \c up with boundtype \c bounds */
interval& set(const DomainT& low, const DomainT& up, bound_type bounds)
{ _lwb=low; _upb=up; _boundtype=bounds; return *this; }
@@ -539,6 +559,24 @@
::type::open_bound_less_equal(_upb, x2._lwb);
}
+template <class DomainT, ITL_COMPARE Compare>
+bool interval<DomainT,Compare>::distant_less(const interval& x2)const
+{
+ using namespace boost::mpl;
+ if(is_right(open_bounded) && x2.is_left(closed_bounded)) return domain_less(_upb, x2._lwb); //_upb < x2._lwb;
+ if(is_right(closed_bounded) && x2.is_left(open_bounded) ) return domain_less(_upb, x2._lwb); //_upb < x2._lwb;
+ if(is_right(open_bounded) && x2.is_left(open_bounded) ) return domain_less_equal(_upb, x2._lwb); //_upb <= x2._lwb;
+
+ //CL if(is_right(closed_bounded) && x2.is_left(closed_bounded)) return domain_less(succ(_upb), x2._lwb); //succ(_upb) < x2._lwb
+ return
+ if_<
+ bool_<is_continuous<DomainT>::value>,
+ continuous_type<interval<DomainT,Compare> >,
+ discrete_type<interval<DomainT,Compare> >
+ >
+ ::type::open_bound_less(_upb, x2._lwb);
+}
+
template <class DomainT, ITL_COMPARE Compare>
bool interval<DomainT,Compare>::lower_less(const interval& x2)const
@@ -727,7 +765,7 @@
if(is_right(closed_bounded) && is_left(closed_bounded)) return domain_less_equal(_lwb, x) && domain_less_equal(x, _upb);
if(is_right(closed_bounded) && is_left(open_bounded) ) return domain_less(_lwb, x) && domain_less_equal(x, _upb);
if(is_right(open_bounded) && is_left(closed_bounded)) return domain_less_equal(_lwb, x) && domain_less(x, _upb);
- return domain_less(_lwb, x) && domain_less(x, _upb);
+ return domain_less(_lwb, x) && domain_less(x, _upb);
}
template <class DomainT, ITL_COMPARE Compare>
@@ -738,6 +776,13 @@
bool interval<DomainT,Compare>::contains(const interval& sub)const
{ return lower_less_equal(sub) && sub.upper_less_equal(*this); }
+template <class DomainT, ITL_COMPARE Compare>
+bool interval<DomainT,Compare>::free_contains(const interval& sub)const
+{ return lower_less(sub) && sub.upper_less(*this); }
+
+template <class DomainT, ITL_COMPARE Compare>
+bool interval<DomainT,Compare>::proper_contains(const interval& sub)const
+{ return contains(sub) && (lower_less(sub) || sub.upper_less(*this)); }
template <class DomainT, ITL_COMPARE Compare>
interval<DomainT,Compare>& interval<DomainT,Compare>::extend(const interval<DomainT,Compare>& x2)
@@ -756,6 +801,70 @@
}
}
+template <class DomainT, ITL_COMPARE Compare>
+interval<DomainT,Compare>& interval<DomainT,Compare>::left_extend(const interval<DomainT,Compare>& x2)
+{
+ if(x2.empty()) return *this;
+ else if(empty())
+ {
+ *this = x2;
+ return *this;
+ }
+ else
+ {
+ set_lwb(lwb_min(x2));
+ return *this;
+ }
+}
+
+template <class DomainT, ITL_COMPARE Compare>
+interval<DomainT,Compare>& interval<DomainT,Compare>::right_extend(const interval<DomainT,Compare>& x2)
+{
+ if(x2.empty()) return *this;
+ else if(empty())
+ {
+ *this = x2;
+ return *this;
+ }
+ else
+ {
+ set_upb(upb_max(x2));
+ return *this;
+ }
+}
+
+template <class DomainT, ITL_COMPARE Compare>
+interval<DomainT,Compare>& interval<DomainT,Compare>::left_set(const interval<DomainT,Compare>& x2)
+{
+ if(x2.empty()) return *this;
+ else if(empty())
+ {
+ *this = x2;
+ return *this;
+ }
+ else
+ {
+ set_lwb(BoundT(x2._lwb, x2.boundtype()));
+ return *this;
+ }
+}
+
+template <class DomainT, ITL_COMPARE Compare>
+interval<DomainT,Compare>& interval<DomainT,Compare>::right_set(const interval<DomainT,Compare>& x2)
+{
+ if(x2.empty()) return *this;
+ else if(empty())
+ {
+ *this = x2;
+ return *this;
+ }
+ else
+ {
+ set_upb(BoundT(x2._upb, x2.boundtype()));
+ return *this;
+ }
+}
+
template <class DomainT, ITL_COMPARE Compare>
inline interval<DomainT,Compare>& interval<DomainT,Compare>::left_subtract(const interval& x2)
Modified: sandbox/itl/boost/itl/set.hpp
==============================================================================
--- sandbox/itl/boost/itl/set.hpp (original)
+++ sandbox/itl/boost/itl/set.hpp 2009-05-07 02:56:11 EDT (Thu, 07 May 2009)
@@ -603,8 +603,11 @@
{
typedef itl::set<DomainT,Compare,Alloc> ObjectT;
stream << "{";
- const_FORALL(typename ObjectT, it, object)
- stream << *it;
+ typename ObjectT::const_iterator it = object.begin();
+ if(it != object.end())
+ stream << *it++;
+ while(it != object.end())
+ stream << " " << *it++;
return stream << "}";
}
Modified: sandbox/itl/boost/itl/split_interval_map.hpp
==============================================================================
--- sandbox/itl/boost/itl/split_interval_map.hpp (original)
+++ sandbox/itl/boost/itl/split_interval_map.hpp 2009-05-07 02:56:11 EDT (Thu, 07 May 2009)
@@ -349,9 +349,9 @@
interval_type right_resid;
cur_itv.left_subtract(right_resid, x_rest);
- this->_map.erase(it);
- fill(value_type(common, cmb_val));
- fill(value_type(right_resid, cur_val));
+ this->_map.erase(it);
+ fill(value_type(common, cmb_val));
+ fill(value_type(right_resid, cur_val));
}
Modified: sandbox/itl/boost/itl/split_interval_set.hpp
==============================================================================
--- sandbox/itl/boost/itl/split_interval_set.hpp (original)
+++ sandbox/itl/boost/itl/split_interval_set.hpp 2009-05-07 02:56:11 EDT (Thu, 07 May 2009)
@@ -137,7 +137,7 @@
/// Treatment of adjoint intervals on insertion
void handle_neighbours(const iterator& it){}
- void insert_rest(const interval_type& x_itv, iterator& it, iterator& end_it);
+ void insert_rest(interval_type& x_itv, iterator& it, iterator& end_it);
void subtract_rest(const interval_type& x_itv, iterator& it, iterator& end_it);
} ;
@@ -215,42 +215,38 @@
template <typename DomainT, ITL_COMPARE Compare, template<class,ITL_COMPARE>class Interval, ITL_ALLOC Alloc>
-void split_interval_set<DomainT,Compare,Interval,Alloc>::insert_rest(const interval_type& x_itv, iterator& it, iterator& end_it)
+void split_interval_set<DomainT,Compare,Interval,Alloc>::insert_rest(interval_type& x_itv, iterator& it, iterator& end_it)
{
- iterator nxt_it = it; nxt_it++;
-
- interval_type cur_itv = *it;
-
- interval_type newGap; x_itv.right_subtract(newGap, cur_itv);
- // this is a new Interval that is a gap in the current map
- add_(newGap);
-
- interval_type interSec = cur_itv & x_itv;
-
- if(nxt_it==end_it)
- {
- interval_type endGap; x_itv.left_subtract(endGap, cur_itv);
- // this is a new Interval that is a gap in the current map
- add_(endGap);
-
- // only for the last there can be a rightResid: a part of *it right of x
- interval_type rightResid; cur_itv.left_subtract(rightResid, x_itv);
-
- this->_set.erase(it);
- add_(interSec);
- add_(rightResid);
- }
- else
- {
- this->_set.erase(it);
- add_(interSec);
-
- // shrink interval
- interval_type x_rest(x_itv);
- x_rest.left_subtract(cur_itv);
-
- insert_rest(x_rest, nxt_it, end_it);
- }
+ interval_type left_gap, cur_itv;
+ while(it != end_it && !x_itv.empty())
+ {
+ cur_itv = *it;
+ x_itv.right_subtract(left_gap, cur_itv);
+ add_(left_gap);
+ if(x_itv.contains(cur_itv))
+ {
+ x_itv.left_subtract(cur_itv);
+ ++it;
+ }
+ else
+ {
+ interval_type intersec = cur_itv & x_itv;
+ interval_type right_over;
+ cur_itv.left_subtract(right_over, x_itv);
+ this->_set.erase(it);
+ add_(intersec);
+ add_(right_over);
+ x_itv.clear();
+ }
+ }
+
+ if(!x_itv.empty())
+ {
+ interval_type right_gap;
+ x_itv.left_subtract(right_gap, cur_itv);
+ // this is a new Interval that is a gap in the current map
+ add_(right_gap);
+ }
}
Modified: sandbox/itl/boost/itl_xt/numbergentor.hpp
==============================================================================
--- sandbox/itl/boost/itl_xt/numbergentor.hpp (original)
+++ sandbox/itl/boost/itl_xt/numbergentor.hpp 2009-05-07 02:56:11 EDT (Thu, 07 May 2009)
@@ -62,7 +62,7 @@
template <class NumTV>
inline NumTV rnd_within_exUpb(NumTV lwb, NumTV exclusive_upb)
{
- NumTV some = (NumTV)RND_WITHIN_EXUPB(lwb,exclusive_upb);
+ NumTV some = static_cast<NumTV>(RND_WITHIN_EXUPB(lwb,exclusive_upb));
return some;
}
Modified: sandbox/itl/boost/itl_xt/setgentor.hpp
==============================================================================
--- sandbox/itl/boost/itl_xt/setgentor.hpp (original)
+++ sandbox/itl/boost/itl_xt/setgentor.hpp 2009-05-07 02:56:11 EDT (Thu, 07 May 2009)
@@ -91,7 +91,7 @@
DomainTD key;
domainGentor()->some(key);
x += key;
- m_sample.push_back(key);
+//JODO URG REV m_sample.push_back(key);
}
}
Modified: sandbox/itl/boost/validate/driver/itl_driver.hpp
==============================================================================
--- sandbox/itl/boost/validate/driver/itl_driver.hpp (original)
+++ sandbox/itl/boost/validate/driver/itl_driver.hpp 2009-05-07 02:56:11 EDT (Thu, 07 May 2009)
@@ -53,8 +53,8 @@
void validate()
{
- srand(static_cast<unsigned>(time(NULL))); //Different numbers each run
- //srand(static_cast<unsigned>(1)); //Same numbers each run (std)
+ //srand(static_cast<unsigned>(time(NULL))); //Different numbers each run
+ srand(static_cast<unsigned>(1)); //Same numbers each run (std)
//srand(static_cast<unsigned>(4711)); //Same numbers each run (varying)
for(int idx=0; hasValidProfile(); idx++)
Modified: sandbox/itl/boost/validate/gentor/randomgentor.hpp
==============================================================================
--- sandbox/itl/boost/validate/gentor/randomgentor.hpp (original)
+++ sandbox/itl/boost/validate/gentor/randomgentor.hpp 2009-05-07 02:56:11 EDT (Thu, 07 May 2009)
@@ -20,6 +20,7 @@
#include <boost/itl/split_interval_set.hpp>
#include <boost/itl/interval_map.hpp>
#include <boost/itl/split_interval_map.hpp>
+#include <boost/itl/tree/tree.hpp>
#include <boost/validate/gentor/gentorprofile.hpp>
@@ -32,7 +33,7 @@
template <> class RandomGentor<nat> : public NumberGentorT<nat> {};
template <> class RandomGentor<double> : public NumberGentorT<double> {};
- // ----- sets ----------------------------------------------------------------
+ // ----- sets --------------------------------------------------------------
//template <class DomainT, template<class>class Set>
//class RandomGentor<Set<DomainT> > :
// public SetGentorT<Set<DomainT> > {};
@@ -53,7 +54,12 @@
class RandomGentor<itl::split_interval_set<DomainT> > :
public SetGentorT<itl::split_interval_set<DomainT> > {};
- // ----- maps -------------------------------------------------------------
+ // ----- tree --------------------------------------------------------------
+ template <class DomainT>
+ class RandomGentor<itl::tree<DomainT> > :
+ public SetGentorT<itl::tree<DomainT> > {};
+
+ // ----- maps --------------------------------------------------------------
template <class DomainT, class Neutronizer>
class RandomGentor<itl::map<DomainT,itl::set<int>,Neutronizer> > :
public MapGentorT<itl::map<DomainT,itl::set<int>,Neutronizer> > {};
@@ -265,6 +271,24 @@
}
};
+
+ //--------------------------------------------------------------------------
+ // itl::tree
+ //--------------------------------------------------------------------------
+ template <>
+ struct Calibrater<itl::tree<int>, RandomGentor>
+ {
+ static void apply(RandomGentor<itl::tree<int> >& gentor)
+ {
+ gentor.setRangeOfSampleSize(GentorProfileSgl::it()->range_ContainerSize());
+ ItvGentorT<int>* itvGentor = new ItvGentorT<int>;
+ interval<int> valRange = GentorProfileSgl::it()->range_interval_int();
+ itvGentor->setValueRange(valRange.lower(), valRange.upper());
+ itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength());
+ gentor.setDomainGentor(itvGentor);
+ }
+ };
+
//----------------------------------------------------------------------------
// itl::map<DomainT,CodomainT,Neutronizer>
//----------------------------------------------------------------------------
Modified: sandbox/itl/libs/itl/build/cygwin/makefile
==============================================================================
--- sandbox/itl/libs/itl/build/cygwin/makefile (original)
+++ sandbox/itl/libs/itl/build/cygwin/makefile 2009-05-07 02:56:11 EDT (Thu, 07 May 2009)
@@ -40,12 +40,12 @@
ITL_INCL = $(addprefix -I,$(ITL_SRC_PATH))
BOOST_INCL = $(addprefix -I,$(BOOST_PATH))
STD_INCL = -I/usr/include
-#GCC_INCL = $(addprefix -I,$(CMP_PATH))/include
+GCC_INCL = $(addprefix -I,$(CMP_PATH))/include
#CONCEPTGCC_INCL = -I/opt/conceptgcc-boostcon/include
-CONCEPTGCC_INCL = -I/opt/conceptgcc-4.3.0-alpha-7/include/c++/4.3.0
+#CONCEPTGCC_INCL = -I/opt/conceptgcc-4.3.0-alpha-7/include/c++/4.3.0
-INCLUDE = $(CONCEPTGCC_INCL) $(ITL_INCL) $(BOOST_INCL)
-#NCLUDE = $(STD_INCL) $(ITL_INCL) $(BOOST_INCL)
+#INCLUDE = $(CONCEPTGCC_INCL) $(ITL_INCL) $(BOOST_INCL)
+INCLUDE = $(STD_INCL) $(ITL_INCL) $(BOOST_INCL)
#--- libraries ----------------------------------------------------------------
#LOAD_LIBS = -L$(CMP_PATH)/lib
@@ -59,14 +59,15 @@
#--- compileflags ---------------------------------------------------
#COMPILE_FLAGS = -O2 -DUSE_CONCEPTS
-COMPILE_FLAGS = -O2
+COMPILE_FLAGS = -O2 -std=gnu++0x
#--- compiler -----------------------------------------------------------------
#--- location of the compiler -------------------------------------------------
#CMP_PATH = /opt/conceptgcc-boostcon
#COMPILE = $(CMP_PATH)/bin/gcc
-COMPILE = /opt/conceptgcc-4.3.0-alpha-7/bin/gcc
#COMPILE = gcc
+#COMPILE = /opt/conceptgcc-4.3.0-alpha-7/bin/gcc
+COMPILE = i686-pc-cygwin-g++-4.exe
all:
@@ -113,6 +114,16 @@
#--- projects -----------------------------------------------------------------
#--- group examples -----------------------------------------------------------
+#--- project boostcon ---------------------------------------------------------
+EXAMPLE_DIR = example
+boostcon_PATH = $(ITL_EXAMPLE_PATH)/boostcon
+boostcon_MAIN = $(boostcon_PATH)/boostcon.cpp
+boostcon_SOURCES = $(boostcon_MAIN)
+boostcon_TARGET = $(BIN_PATH)/boostcon$(EXE_TAG)
+
+boostcon:
+ $(COMPILE) $(COMPILE_FLAGS) $(INCLUDE) $(boostcon_SOURCES) $(LOAD_FLAGS) -o $(boostcon_TARGET)
+
#--- project party ---------------------------------------------------------
EXAMPLE_DIR = example
party_PATH = $(ITL_EXAMPLE_PATH)/party
Modified: sandbox/itl/libs/itl/build/win32/vc9_all.sln
==============================================================================
--- sandbox/itl/libs/itl/build/win32/vc9_all.sln (original)
+++ sandbox/itl/libs/itl/build/win32/vc9_all.sln 2009-05-07 02:56:11 EDT (Thu, 07 May 2009)
@@ -79,6 +79,10 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vc9_test_split_interval_map", "..\..\test\test_split_interval_map\vc9_test_split_interval_map.vcproj", "{EE61B7EF-EC45-4165-8B49-FD5B7D2A9F9E}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vc9_partys_tallest_guests", "..\..\example\partys_tallest_guests\vc9_partys_tallest_guests.vcproj", "{0D1DB87E-E72A-4FE9-A067-1907CC6623F8}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vc9_partys_height_average", "..\..\example\partys_height_average\vc9_partys_height_average.vcproj", "{0D1DB87E-E72A-4FE9-A067-1907CC6633F8}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -241,6 +245,14 @@
{EE61B7EF-EC45-4165-8B49-FD5B7D2A9F9E}.Debug|Win32.Build.0 = Debug|Win32
{EE61B7EF-EC45-4165-8B49-FD5B7D2A9F9E}.Release|Win32.ActiveCfg = Release|Win32
{EE61B7EF-EC45-4165-8B49-FD5B7D2A9F9E}.Release|Win32.Build.0 = Release|Win32
+ {0D1DB87E-E72A-4FE9-A067-1907CC6623F8}.Debug|Win32.ActiveCfg = Debug|Win32
+ {0D1DB87E-E72A-4FE9-A067-1907CC6623F8}.Debug|Win32.Build.0 = Debug|Win32
+ {0D1DB87E-E72A-4FE9-A067-1907CC6623F8}.Release|Win32.ActiveCfg = Release|Win32
+ {0D1DB87E-E72A-4FE9-A067-1907CC6623F8}.Release|Win32.Build.0 = Release|Win32
+ {0D1DB87E-E72A-4FE9-A067-1907CC6633F8}.Debug|Win32.ActiveCfg = Debug|Win32
+ {0D1DB87E-E72A-4FE9-A067-1907CC6633F8}.Debug|Win32.Build.0 = Debug|Win32
+ {0D1DB87E-E72A-4FE9-A067-1907CC6633F8}.Release|Win32.ActiveCfg = Release|Win32
+ {0D1DB87E-E72A-4FE9-A067-1907CC6633F8}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Modified: sandbox/itl/libs/itl/doc/Jamfile.v2
==============================================================================
--- sandbox/itl/libs/itl/doc/Jamfile.v2 (original)
+++ sandbox/itl/libs/itl/doc/Jamfile.v2 2009-05-07 02:56:11 EDT (Thu, 07 May 2009)
@@ -1,6 +1,6 @@
# Boost.Itl
#
-# Copyright (c) 2008-2008 Joachim Faulhaber
+# Copyright (c) 2008-2009 Joachim Faulhaber
# Copyright (c) 2000-2006 Cortex Software GmbH
#
# Distributed under the Boost Software License, Version 1.0.
Modified: sandbox/itl/libs/itl/doc/acknowledgments.qbk
==============================================================================
--- sandbox/itl/libs/itl/doc/acknowledgments.qbk (original)
+++ sandbox/itl/libs/itl/doc/acknowledgments.qbk 2009-05-07 02:56:11 EDT (Thu, 07 May 2009)
@@ -16,7 +16,8 @@
contributed a lot to the success of the project.
Many thanks to Paul A. Bristow, Vicente Botet, Luke Simonson,
-Alp Mestan, David Abrahams, Steven Watanabe and other developers
+Alp Mestan, David Abrahams, Steven Watanabe, Neal Becker
+and other developers
form the Boost community who supported the development of the
Interval Template Library by numerous hints and feedbacks on
the boost mailing list.
Modified: sandbox/itl/libs/itl/doc/introduction.qbk
==============================================================================
--- sandbox/itl/libs/itl/doc/introduction.qbk (original)
+++ sandbox/itl/libs/itl/doc/introduction.qbk 2009-05-07 02:56:11 EDT (Thu, 07 May 2009)
@@ -8,6 +8,34 @@
[section Introduction]
+Intervals are almost ubiquitous in software development. Yet they are
+very easily coded into user defined classes by a pair of numbers
+so they are only /implicitly/ used most of the time. The meaning of
+an interval is simple. They represent all the elements between their
+lower and upper bound and thus a set. But unlike sets, intervals
+usually can not be added to a single new interval.
+If you want to add intervals to a collection of
+intervals that does still represent a set,
+you arrive at the idea of interval_sets that the *itl* provides.
+
+Interval containers of the *itl* have been developed initially at
+[@http://www.cortex-software.de/desktopdefault.aspx Cortex Software GmbH]
+to solve problems related to date 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 maipulated in statistics,
+billing programs and therapy scheduling programs.
+So the *itl* emerged out of those industrial use cases and
+extracts a generic library that helps to solve common
+problems from the time domain more easiely.
+
+From those use cases, specifically the computations for
+statistics, also stems the quite useful idea of ['aggregating
+associated] values, when ['intervals overlap]. This idea is
+fundamental for the way interval_maps of the *itl* are
+designed.
+
+
[section Definition and Basic Example]
The [*Interval Template Library (ITL)] provides __itvs__ and two kinds of
@@ -46,8 +74,8 @@
myTVProgram.add(news).add(talk_show);
// Iterating over elements (seconds) would be silly ...
-for(interval_set<seconds>::iterator telecast = myTvProgam.begin();
- telecast != myTvProgam.end(); ++telecast)
+for(interval_set<seconds>::iterator telecast = myTvProgram.begin();
+ telecast != myTvProgram.end(); ++telecast)
//...so this iterates over intervals
TV.switch_on(*telecast);
``
@@ -223,6 +251,14 @@
to enrich an interval container with certain time grids, like e.g. months
or calendar weeks or both. See example [link boost_itl.examples.month_and_week_grid timegrids for months and weeks].
+[h4 Separating interval containers]
+
+__Sep_itv_set__ implements the separating style.
+This style preserves borders, that are never passed by an overlapping
+interval. So if all intervals that are inserted into an __sep_itv_set__
+are generated form a certain grid that never pass say month borders, then
+these borders are preserved in the __sep_itv_set__.
+
[endsect]
[endsect][/ Introduction]
Modified: sandbox/itl/libs/itl/example/Jamfile.v2
==============================================================================
--- sandbox/itl/libs/itl/example/Jamfile.v2 (original)
+++ sandbox/itl/libs/itl/example/Jamfile.v2 2009-05-07 02:56:11 EDT (Thu, 07 May 2009)
@@ -45,6 +45,24 @@
<include>$(BOOST_ROOT)
;
+exe partys_height_average
+ :
+ partys_height_average/partys_height_average.cpp
+ /boost/date_time//boost_date_time
+ :
+ <include>../../..
+ <include>$(BOOST_ROOT)
+ ;
+
+exe partys_tallest_guests
+ :
+ partys_tallest_guests/partys_tallest_guests.cpp
+ /boost/date_time//boost_date_time
+ :
+ <include>../../..
+ <include>$(BOOST_ROOT)
+ ;
+
exe man_power
:
man_power/man_power.cpp
Modified: sandbox/itl/libs/itl/example/boost_party/boost_party.cpp
==============================================================================
--- sandbox/itl/libs/itl/example/boost_party/boost_party.cpp (original)
+++ sandbox/itl/libs/itl/example/boost_party/boost_party.cpp 2009-05-07 02:56:11 EDT (Thu, 07 May 2009)
@@ -62,14 +62,6 @@
// implement operator += that performs a set union on overlap of intervals.
typedef boost::itl::set<string> GuestSetT;
-// boost::posix_time::ptime is the domain type the the interval_map.
-// It's key values are therefore time intervals: interval<ptime>. The content
-// is the set of names: GuestSetT.
-typedef interval_map<ptime, GuestSetT> BoostPartyAttendenceHistoryT;
-
-// A party's height shall be defined as the maximum height of all guests ;-)
-typedef interval_map<ptime, int, partial_absorber, less, inplace_max> BoostPartyHeightHistoryT;
-
void boost_party()
{
GuestSetT mary_harry;
@@ -83,7 +75,8 @@
GuestSetT peter;
peter.insert("Peter");
- BoostPartyAttendenceHistoryT party;
+ // A party is an interval map that maps time intervals to sets of guests
+ interval_map<ptime, GuestSetT> party;
party.add( // add and element
make_pair(
@@ -105,37 +98,8 @@
time_from_string("2008-05-21 00:30")),
peter);
- //-------------------------------------------------------------------------
- BoostPartyHeightHistoryT tallest_guest;
- // adding an element can be done wrt. simple aggregate functions
- // like e.g. min, max etc. in their 'inplace' or op= incarnation
- tallest_guest.add(
- make_pair(
- interval<ptime>::rightopen(
- time_from_string("2008-05-20 19:30"),
- time_from_string("2008-05-20 23:00")),
- 180)
- );
-
- tallest_guest.add(
- make_pair(
- interval<ptime>::rightopen(
- time_from_string("2008-05-20 20:10"),
- time_from_string("2008-05-21 00:00")),
- 170)
- );
-
- tallest_guest.add(
- make_pair(
- interval<ptime>::rightopen(
- time_from_string("2008-05-20 22:15"),
- time_from_string("2008-05-21 00:30")),
- 200)
- );
-
-
- BoostPartyAttendenceHistoryT::iterator it = party.begin();
+ interval_map<ptime, GuestSetT>::iterator it = party.begin();
cout << "----- History of party guests -------------------------\n";
while(it != party.end())
{
@@ -143,19 +107,9 @@
// Who is at the party within the time interval 'when' ?
GuestSetT who = (*it++).second;
cout << "[" << when.first() << " - " << when.upper() << ")"
- << ": " << who.as_string() << endl;
+ << ": " << who << endl;
}
- BoostPartyHeightHistoryT::iterator height_ = tallest_guest.begin();
- cout << "----- History of maximum guest height -----------------\n";
- while(height_ != tallest_guest.end())
- {
- interval<ptime> when = height_->first;
- // Of what height are the tallest guests within the time interval 'when' ?
- int height = (*height_++).second;
- cout << "[" << when.first() << " - " << when.upper() << ")"
- << ": " << height <<" cm = " << height/30.48 << " ft" << endl;
- }
}
@@ -177,9 +131,6 @@
[2008-May-20 22:15:00 - 2008-May-20 23:00:00): Diana Harry Mary Peter Susan
[2008-May-20 23:00:00 - 2008-May-21 00:00:00): Diana Peter Susan
[2008-May-21 00:00:00 - 2008-May-21 00:30:00): Peter
------ History of maximum guest height -----------------
-[2008-May-20 19:30:00 - 2008-May-20 22:15:00): 180 cm = 5.90551 ft
-[2008-May-20 22:15:00 - 2008-May-21 00:30:00): 200 cm = 6.56168 ft
-----------------------------------------------------------------------------*/
//]
Added: sandbox/itl/libs/itl/example/partys_height_average/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/itl/libs/itl/example/partys_height_average/Jamfile.v2 2009-05-07 02:56:11 EDT (Thu, 07 May 2009)
@@ -0,0 +1,12 @@
+# (C) Copyright 2008: Joachim Faulhaber
+# 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)
+
+exe partys_height_average
+ :
+ partys_height_average.cpp
+ /boost/date_time//boost_date_time
+ :
+ <include>../../..
+ <include>$(BOOST_ROOT)
+ ;
Added: sandbox/itl/libs/itl/example/partys_height_average/partys_height_average.cpp
==============================================================================
--- (empty file)
+++ sandbox/itl/libs/itl/example/partys_height_average/partys_height_average.cpp 2009-05-07 02:56:11 EDT (Thu, 07 May 2009)
@@ -0,0 +1,139 @@
+/*-----------------------------------------------------------------------------+
+Interval Template Library
+Author: Joachim Faulhaber
+Copyright (c) 2007-2009: Joachim Faulhaber
+Copyright (c) 1999-2006: Cortex Software GmbH, Kantstrasse 57, Berlin
++------------------------------------------------------------------------------+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENCE.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
++-----------------------------------------------------------------------------*/
+
+/** Example partys_height_average.cpp \file partys_height_average.cpp
+
+ In partys_height_average.cpp we compute yet another aggregation:
+ The average height of guests. This is done by defining a class
+ counted_sum that sums up heights and counts the numer of guests
+ via an operator +=.
+
+ Based on the operator += we can aggregate counted sums on addition
+ of interval value pairs into an interval_map.
+
+ \include partys_height_average/partys_height_average.cpp
+*/
+//[example_partys_height_average
+#include <iostream>
+// The next line includes <boost/date_time/posix_time/posix_time.hpp>
+// and a few lines of adapter code.
+#include <boost/itl/ptime.hpp>
+
+#include <boost/itl/type_traits/to_string.hpp>
+#include <boost/itl/interval_map.hpp>
+#include <boost/itl/split_interval_map.hpp>
+
+using namespace std;
+using namespace boost::posix_time;
+using namespace boost::itl;
+
+
+class counted_sum
+{
+public:
+ counted_sum():_sum(0),_count(0){}
+ counted_sum(int sum):_sum(sum),_count(1){}
+
+ int sum()const {return _sum;}
+ int count()const{return _count;}
+ double average()const{ return _count==0 ? 0.0 : _sum/static_cast<double>(_count); }
+
+ counted_sum& operator += (const counted_sum& right)
+ { _sum += right.sum(); _count += right.count(); return *this; }
+
+private:
+ int _sum;
+ int _count;
+};
+
+bool operator == (const counted_sum& left, const counted_sum& right)
+{ return left.sum()==right.sum() && left.count()==right.count(); }
+
+
+void partys_height_average()
+{
+ interval_map<ptime, counted_sum> height_sums;
+
+ height_sums.add(
+ make_pair(
+ interval<ptime>::rightopen(
+ time_from_string("2008-05-20 19:30"),
+ time_from_string("2008-05-20 23:00")),
+ counted_sum(165)) // Mary is 1,65 m tall.
+ );
+
+ height_sums.add(
+ make_pair(
+ interval<ptime>::rightopen(
+ time_from_string("2008-05-20 19:30"),
+ time_from_string("2008-05-20 23:00")),
+ counted_sum(180)) // Harry is 1,80 m tall.
+ );
+
+ height_sums.add(
+ make_pair(
+ interval<ptime>::rightopen(
+ time_from_string("2008-05-20 20:10"),
+ time_from_string("2008-05-21 00:00")),
+ counted_sum(170)) // Diana is 1,70 m tall.
+ );
+
+ height_sums.add(
+ make_pair(
+ interval<ptime>::rightopen(
+ time_from_string("2008-05-20 20:10"),
+ time_from_string("2008-05-21 00:00")),
+ counted_sum(165)) // Susan is 1,65 m tall.
+ );
+
+ height_sums.add(
+ make_pair(
+ interval<ptime>::rightopen(
+ time_from_string("2008-05-20 22:15"),
+ time_from_string("2008-05-21 00:30")),
+ counted_sum(200)) // Peters height is 2,00 m
+ );
+
+ interval_map<ptime, counted_sum>::iterator height_sum_ = height_sums.begin();
+ cout << "-------------- History of average guest height -------------------\n";
+ while(height_sum_ != height_sums.end())
+ {
+ interval<ptime> when = height_sum_->first;
+
+ double height_average = (*height_sum_++).second.average();
+ cout << setprecision(3)
+ << "[" << when.first() << " - " << when.upper() << ")"
+ << ": " << height_average <<" cm = " << height_average/30.48 << " ft" << endl;
+ }
+}
+
+
+int main()
+{
+ cout << ">> Interval Template Library: Sample partys_height_average.cpp <<\n";
+ cout << "------------------------------------------------------------------\n";
+ partys_height_average();
+ return 0;
+}
+
+// Program output:
+/*-----------------------------------------------------------------------------
+>> Interval Template Library: Sample partys_height_average.cpp <<
+------------------------------------------------------------------
+-------------- History of average guest height -------------------
+[2008-May-20 19:30:00 - 2008-May-20 20:10:00): 173 cm = 5.66 ft
+[2008-May-20 20:10:00 - 2008-May-20 22:15:00): 170 cm = 5.58 ft
+[2008-May-20 22:15:00 - 2008-May-20 23:00:00): 176 cm = 5.77 ft
+[2008-May-20 23:00:00 - 2008-May-21 00:00:00): 178 cm = 5.85 ft
+[2008-May-21 00:00:00 - 2008-May-21 00:30:00): 200 cm = 6.56 ft
+-----------------------------------------------------------------------------*/
+//]
+
Added: sandbox/itl/libs/itl/example/partys_height_average/vc9_partys_height_average.vcproj
==============================================================================
--- (empty file)
+++ sandbox/itl/libs/itl/example/partys_height_average/vc9_partys_height_average.vcproj 2009-05-07 02:56:11 EDT (Thu, 07 May 2009)
@@ -0,0 +1,220 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="vc9_partys_height_average"
+ ProjectGUID="{0D1DB87E-E72A-4FE9-A067-1907CC6633F8}"
+ RootNamespace="Partys_height_average"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="../../../../bin/debug/"
+ IntermediateDirectory="../../../../bin/obj/$(ProjectName)/debug/"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../; ../../../../boost_1_35_0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ UseUnicodeResponseFiles="true"
+ OutputFile="../../../../bin/debug/$(ProjectName).exe"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="../../../../lib; ../../../../stage/lib"
+ IgnoreAllDefaultLibraries="false"
+ GenerateDebugInformation="true"
+ AssemblyDebug="1"
+ SubSystem="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ UseUnicodeResponseFiles="true"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="../../../../bin/release/"
+ IntermediateDirectory="../../../../bin/obj/$(ProjectName)/release/"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../; ../../../../boost_1_35_0"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ UseUnicodeResponseFiles="false"
+ OutputFile="../../../../bin/release/$(ProjectName).exe"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="../../../../lib; ../../../../stage/lib"
+ IgnoreAllDefaultLibraries="false"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Quelldateien"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\partys_height_average.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Headerdateien"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath="..\..\..\..\boost\itl\interval.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\boost\itl\interval_base_map.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\boost\itl\interval_map.hpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Ressourcendateien"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Added: sandbox/itl/libs/itl/example/partys_tallest_guests/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/itl/libs/itl/example/partys_tallest_guests/Jamfile.v2 2009-05-07 02:56:11 EDT (Thu, 07 May 2009)
@@ -0,0 +1,12 @@
+# (C) Copyright 2008: Joachim Faulhaber
+# 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)
+
+exe partys_tallest_guests
+ :
+ partys_tallest_guests.cpp
+ /boost/date_time//boost_date_time
+ :
+ <include>../../..
+ <include>$(BOOST_ROOT)
+ ;
Added: sandbox/itl/libs/itl/example/partys_tallest_guests/partys_tallest_guests.cpp
==============================================================================
--- (empty file)
+++ sandbox/itl/libs/itl/example/partys_tallest_guests/partys_tallest_guests.cpp 2009-05-07 02:56:11 EDT (Thu, 07 May 2009)
@@ -0,0 +1,165 @@
+/*-----------------------------------------------------------------------------+
+Interval Template Library
+Author: Joachim Faulhaber
+Copyright (c) 2007-2009: Joachim Faulhaber
+Copyright (c) 1999-2006: Cortex Software GmbH, Kantstrasse 57, Berlin
++------------------------------------------------------------------------------+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENCE.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
++-----------------------------------------------------------------------------*/
+
+/** Example partys_tallest_guests.cpp \file partys_tallest_guests.cpp
+
+ In partys_tallest_guests.cpp we use a different instantiation of
+ interval map templates to compute maxima of guest heights.
+
+ Instead of aggregating groups of people attending the party in time
+ we aggregate the maximum of guest height for the time intervals.
+
+ Using a joining interval_map results in a smaller map: All interval
+ value pairs are joined if the maximum does not change in time. Using
+ a split_interval_map results in a larger map: All splits of intervals
+ that occur due to entering and leaving of guests are preserved in
+ the split_interval_map.
+
+ \include partys_tallest_guests/partys_tallest_guests.cpp
+*/
+//[example_partys_tallest_guests
+#include <iostream>
+// The next line includes <boost/date_time/posix_time/posix_time.hpp>
+// and a few lines of adapter code.
+#include <boost/itl/ptime.hpp>
+
+#include <boost/itl/type_traits/to_string.hpp>
+#include <boost/itl/interval_map.hpp>
+#include <boost/itl/split_interval_map.hpp>
+
+using namespace std;
+using namespace boost::posix_time;
+using namespace boost::itl;
+
+
+// A party's height shall be defined as the maximum height of all guests ;-)
+// The last parameter 'inplace_max' is a functor template that calls a max
+// aggregation on overlap.
+typedef interval_map<ptime, int, partial_absorber, less, inplace_max> PartyHeightHistoryT;
+
+// Using a split_interval_map we preserve interval splittings that occured via insertion.
+typedef split_interval_map<ptime, int, partial_absorber, less, inplace_max> PartyHeightSplitHistoryT;
+
+void partys_height()
+{
+ PartyHeightHistoryT tallest_guest;
+
+ tallest_guest.add(
+ make_pair(
+ interval<ptime>::rightopen(
+ time_from_string("2008-05-20 19:30"),
+ time_from_string("2008-05-20 23:00")),
+ 180) // Mary & Harry: Harry is 1,80 m tall.
+ );
+
+ tallest_guest.add(
+ make_pair(
+ interval<ptime>::rightopen(
+ time_from_string("2008-05-20 20:10"),
+ time_from_string("2008-05-21 00:00")),
+ 170) // Diana & Susan: Diana is 1,70 m tall.
+ );
+
+ tallest_guest.add(
+ make_pair(
+ interval<ptime>::rightopen(
+ time_from_string("2008-05-20 22:15"),
+ time_from_string("2008-05-21 00:30")),
+ 200) // Peters height is 2,00 m
+ );
+
+ PartyHeightHistoryT::iterator height_ = tallest_guest.begin();
+ cout << "-------------- History of maximum guest height -------------------\n";
+ while(height_ != tallest_guest.end())
+ {
+ interval<ptime> when = height_->first;
+ // Of what height are the tallest guests within the time interval 'when' ?
+ int height = (*height_++).second;
+ cout << "[" << when.first() << " - " << when.upper() << ")"
+ << ": " << height <<" cm = " << height/30.48 << " ft" << endl;
+ }
+
+}
+
+// Next we are using a split_interval_map instead of a joining interval_map
+void partys_split_height()
+{
+ PartyHeightSplitHistoryT tallest_guest;
+
+ // adding an element can be done wrt. simple aggregate functions
+ // like e.g. min, max etc. in their 'inplace' or op= incarnation
+ tallest_guest.add(
+ make_pair(
+ interval<ptime>::rightopen(
+ time_from_string("2008-05-20 19:30"),
+ time_from_string("2008-05-20 23:00")),
+ 180) // Mary & Harry: Harry is 1,80 m tall.
+ );
+
+ tallest_guest.add(
+ make_pair(
+ interval<ptime>::rightopen(
+ time_from_string("2008-05-20 20:10"),
+ time_from_string("2008-05-21 00:00")),
+ 170) // Diana & Susan: Diana is 1,70 m tall.
+ );
+
+ tallest_guest.add(
+ make_pair(
+ interval<ptime>::rightopen(
+ time_from_string("2008-05-20 22:15"),
+ time_from_string("2008-05-21 00:30")),
+ 200) // Peters height is 2,00 m
+ );
+
+ PartyHeightSplitHistoryT::iterator height_ = tallest_guest.begin();
+ cout << "\n";
+ cout << "-------- Split History of maximum guest height -------------------\n";
+ cout << "--- Same map as above but split for every interval insertion. ---\n";
+ while(height_ != tallest_guest.end())
+ {
+ interval<ptime> when = height_->first;
+ // Of what height are the tallest guests within the time interval 'when' ?
+ int height = (*height_++).second;
+ cout << "[" << when.first() << " - " << when.upper() << ")"
+ << ": " << height <<" cm = " << height/30.48 << " ft" << endl;
+ }
+
+}
+
+
+int main()
+{
+ cout << ">> Interval Template Library: Sample partys_tallest_guests.cpp <<\n";
+ cout << "------------------------------------------------------------------\n";
+ partys_height();
+ partys_split_height();
+ return 0;
+}
+
+// Program output:
+/*-----------------------------------------------------------------------------
+>> Interval Template Library: Sample partys_tallest_guests.cpp <<
+------------------------------------------------------------------
+-------------- History of maximum guest height -------------------
+[2008-May-20 19:30:00 - 2008-May-20 22:15:00): 180 cm = 5.90551 ft
+[2008-May-20 22:15:00 - 2008-May-21 00:30:00): 200 cm = 6.56168 ft
+
+-------- Split History of maximum guest height -------------------
+--- Same map as above but split for every interval insertion. ---
+[2008-May-20 19:30:00 - 2008-May-20 20:10:00): 180 cm = 5.90551 ft
+[2008-May-20 20:10:00 - 2008-May-20 22:15:00): 180 cm = 5.90551 ft
+[2008-May-20 22:15:00 - 2008-May-20 23:00:00): 200 cm = 6.56168 ft
+[2008-May-20 23:00:00 - 2008-May-21 00:00:00): 200 cm = 6.56168 ft
+[2008-May-21 00:00:00 - 2008-May-21 00:30:00): 200 cm = 6.56168 ft
+-----------------------------------------------------------------------------*/
+//]
+
Added: sandbox/itl/libs/itl/example/partys_tallest_guests/vc9_partys_tallest_guests.vcproj
==============================================================================
--- (empty file)
+++ sandbox/itl/libs/itl/example/partys_tallest_guests/vc9_partys_tallest_guests.vcproj 2009-05-07 02:56:11 EDT (Thu, 07 May 2009)
@@ -0,0 +1,220 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="vc9_partys_tallest_guests"
+ ProjectGUID="{0D1DB87E-E72A-4FE9-A067-1907CC6623F8}"
+ RootNamespace="Partys_tallest_guests"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="../../../../bin/debug/"
+ IntermediateDirectory="../../../../bin/obj/$(ProjectName)/debug/"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../; ../../../../boost_1_35_0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ UseUnicodeResponseFiles="true"
+ OutputFile="../../../../bin/debug/$(ProjectName).exe"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="../../../../lib; ../../../../stage/lib"
+ IgnoreAllDefaultLibraries="false"
+ GenerateDebugInformation="true"
+ AssemblyDebug="1"
+ SubSystem="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ UseUnicodeResponseFiles="true"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="../../../../bin/release/"
+ IntermediateDirectory="../../../../bin/obj/$(ProjectName)/release/"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../; ../../../../boost_1_35_0"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ UseUnicodeResponseFiles="false"
+ OutputFile="../../../../bin/release/$(ProjectName).exe"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="../../../../lib; ../../../../stage/lib"
+ IgnoreAllDefaultLibraries="false"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Quelldateien"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\partys_tallest_guests.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Headerdateien"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath="..\..\..\..\boost\itl\interval.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\boost\itl\interval_base_map.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\boost\itl\interval_map.hpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Ressourcendateien"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
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 2009-05-07 02:56:11 EDT (Thu, 07 May 2009)
@@ -29,47 +29,22 @@
-BOOST_AUTO_TEST_CASE(subset_test)
-{
- typedef interval_map<int,int> IntervalMapT;
- typedef split_interval_map<int,int> SplitIntervalMapT;
-
- SplitIntervalMapT left, right;
- left.add(CDv(2,7,5)).add(IIv(9,9,5));
- right.add(CDv(-8,-6,2)).add(CIv(2,7,5)).add(CDv(7,9,1)).add(IIv(9,11,5));
- BOOST_CHECK_EQUAL(is_contained_in(left,right), true);
-
- left.clear(); right.clear();
- left.add(CIv(-4,-2,1)).add(IIv(8,8,3));
- right.add(CIv(-6,-1,1)).add(CIv(6,9,3));
- is_contained_in(left,right);
- BOOST_CHECK_EQUAL(is_contained_in(left,right), true);
-}
-
-BOOST_AUTO_TEST_CASE(superset_test)
-{
- typedef interval_map<int,int> IntervalMapT;
- typedef split_interval_map<int,int> SplitIntervalMapT;
-
- SplitIntervalMapT left, right;
- left.add(IDv(-7,-1,1)).add(IIv(8,16,9));
- right.add(CDv(-8,-4,1)).add(IIv(8,8,9));
- BOOST_CHECK_EQUAL(contains(left,right), true);
-}
-
BOOST_AUTO_TEST_CASE(casual_test)
{
typedef int T;
typedef itl::map<int,int> ItlMapT;
typedef interval_map<int,int,partial_enricher> IntervalMapT;
typedef split_interval_map<int,int> SplitIntervalMapT;
- typedef interval_set<int> IntervalSetT;
+ typedef interval_set<int> IntervalSetT;
+ typedef split_interval_set<int> SplitIntervalSetT;
- //IntervalMapT left, right, result;
- //left .add(IIv(0,0,1)).add(IIv(1,1,2));
- //right.add(IIv(0,0,-1));
+ SplitIntervalSetT left;
+ left.add(I_I(0,2)).add(I_I(3,3)).add(I_I(4,4)).add(I_I(5,5)).add(I_I(6,8));
+ cout << endl;
+
+ left.add(I_I(1,7));
+
- IntervalSetT left, right, result;
+ BOOST_CHECK_EQUAL(I_I(0,2).contains(I_I(0,2).lower()), true);
- result = left + right;
}
Modified: sandbox/itl/libs/validate/example/labat_single/labat_single.cpp
==============================================================================
--- sandbox/itl/libs/validate/example/labat_single/labat_single.cpp (original)
+++ sandbox/itl/libs/validate/example/labat_single/labat_single.cpp 2009-05-07 02:56:11 EDT (Thu, 07 May 2009)
@@ -18,10 +18,13 @@
#include <boost/validate/laws/induced_relation.hpp>
#include <boost/validate/laws/symmetric_difference.hpp>
#include <boost/validate/laws/pushouts.hpp>
+#include <boost/validate/laws/novial_tree.hpp>
+#include <boost/validate/laws/inversion_laws.hpp>
#include <boost/validate/validater/law_validater.hpp>
#include <boost/validate/gentor/gentorprofile.hpp>
#include <boost/validate/gentor/rangegentor.hpp>
#include <boost/itl/interval_set.hpp>
+#include <boost/itl/interval_map.hpp>
#include <boost/itl/functors.hpp>
using namespace std;
@@ -43,12 +46,12 @@
//map_cluster_star_pushout.setTrialsCount(1000);
//map_cluster_star_pushout.run();
- typedef InplaceFlip
- <itl::interval_map<int, int, partial_enricher > > TestLawT;
- LawValidater<TestLawT, RandomGentor> test_law;
+ //typedef InplaceFlip
+ // <itl::interval_map<int, int, partial_enricher > > TestLawT;
+ //LawValidater<TestLawT, RandomGentor> test_law;
//typedef InplaceAssociativity
- // <itl::interval_map<int, int, partial_absorber>, inplace_et> TestLawT;
+ // <itl::split_interval_map<int, int, partial_enricher> > TestLawT;
//LawValidater<TestLawT, RandomGentor> test_law;
//typedef InducedRelation
@@ -57,8 +60,15 @@
// Interval::Atomize, protonic_equal> TestLawT;
//LawValidater<TestLawT, RandomGentor> test_law;
+ //typedef Balance<itl::tree<int> > TestLawT;
+ //LawValidater<TestLawT, RandomGentor> test_law;
+
+ typedef InplaceNaturalInversion
+ <itl::interval_map<int, int, partial_absorber > > TestLawT;
+ LawValidater<TestLawT, RandomGentor> test_law;
+
//-----------------------------------------------------------------------------
- int test_count = 5000;
+ int test_count = 1000;
ptime start, stop;
test_law.setTrialsCount(test_count);
Modified: sandbox/itl/libs/validate/src/gentor/gentorprofile.cpp
==============================================================================
--- sandbox/itl/libs/validate/src/gentor/gentorprofile.cpp (original)
+++ sandbox/itl/libs/validate/src/gentor/gentorprofile.cpp 2009-05-07 02:56:11 EDT (Thu, 07 May 2009)
@@ -61,6 +61,27 @@
//set_maxIntervalLength(20);
//set_range_element_ContainerSize(0,10);
+
+ //--------------------------------------------------------------------------
+ // values for novial_tree test
+ //set_range_int(-5, 5);
+ //set_range_nat(0, 16);
+ //set_range_double(0.0, 1.0);
+ //set_range_ContainerSize(0,1000);
+
+ //set_range_interval_int(0, 100000);
+ //set_maxIntervalLength(1200);
+ //set_range_element_ContainerSize(0,10);
+
+ //set_range_int(-5, 5);
+ //set_range_nat(0, 16);
+ //set_range_double(0.0, 1.0);
+ //set_range_ContainerSize(0,40);
+
+ //set_range_interval_int(0, 1000);
+ //set_maxIntervalLength(50);
+ //set_range_element_ContainerSize(0,10);
+
}
// -------------------------------------
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