Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67348 - in branches/release: boost/icl libs/icl libs/icl/test
From: afojgo_at_[hidden]
Date: 2010-12-19 13:00:31


Author: jofaber
Date: 2010-12-19 13:00:27 EST (Sun, 19 Dec 2010)
New Revision: 67348
URL: http://svn.boost.org/trac/boost/changeset/67348

Log:
Added some adapter code for posix_time::time_duration and gregorian::date_duration, so the durations can be fully used with icl::intervals.
Properties modified:
   branches/release/boost/icl/ (props changed)
   branches/release/libs/icl/ (props changed)
Text files modified:
   branches/release/boost/icl/gregorian.hpp | 19 +++++++++++++++++++
   branches/release/boost/icl/interval_base_map.hpp | 9 +++++++++
   branches/release/boost/icl/ptime.hpp | 19 +++++++++++++++++++
   branches/release/libs/icl/test/test_type_lists.hpp | 23 +++++++++++++++++++----
   branches/release/libs/icl/test/test_value_maker.hpp | 2 +-
   5 files changed, 67 insertions(+), 5 deletions(-)

Modified: branches/release/boost/icl/gregorian.hpp
==============================================================================
--- branches/release/boost/icl/gregorian.hpp (original)
+++ branches/release/boost/icl/gregorian.hpp 2010-12-19 13:00:27 EST (Sun, 19 Dec 2010)
@@ -88,6 +88,25 @@
     }
 
     // ------------------------------------------------------------------------
+ template<> struct is_discrete<boost::gregorian::date_duration>
+ {
+ typedef is_discrete type;
+ BOOST_STATIC_CONSTANT(bool, value = true);
+ };
+
+ template<>
+ struct has_difference<boost::gregorian::date_duration>
+ {
+ typedef has_difference type;
+ BOOST_STATIC_CONSTANT(bool, value = true);
+ };
+
+ template<>
+ struct size_type_of<boost::gregorian::date_duration>
+ {
+ typedef boost::gregorian::date_duration type;
+ };
+
     boost::gregorian::date_duration operator ++(boost::gregorian::date_duration& x)
     {
         return x += boost::gregorian::date::duration_type::unit();

Modified: branches/release/boost/icl/interval_base_map.hpp
==============================================================================
--- branches/release/boost/icl/interval_base_map.hpp (original)
+++ branches/release/boost/icl/interval_base_map.hpp 2010-12-19 13:00:27 EST (Sun, 19 Dec 2010)
@@ -677,6 +677,11 @@
         { icl::clear(object); }
     };
 
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4127) // conditional expression is constant
+#endif
+
     template<class Type>
     struct on_total_absorbable<Type, true, false>
     {
@@ -694,6 +699,10 @@
         }
     };
 
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+
     template<class Type, bool absorbs_identities>
     struct on_total_absorbable<Type, false, absorbs_identities>
     {

Modified: branches/release/boost/icl/ptime.hpp
==============================================================================
--- branches/release/boost/icl/ptime.hpp (original)
+++ branches/release/boost/icl/ptime.hpp 2010-12-19 13:00:27 EST (Sun, 19 Dec 2010)
@@ -87,6 +87,25 @@
     }
 
     // ------------------------------------------------------------------------
+ template<> struct is_discrete<boost::posix_time::time_duration>
+ {
+ typedef is_discrete type;
+ BOOST_STATIC_CONSTANT(bool, value = true);
+ };
+
+ template<>
+ struct has_difference<boost::posix_time::time_duration>
+ {
+ typedef has_difference type;
+ BOOST_STATIC_CONSTANT(bool, value = true);
+ };
+
+ template<>
+ struct size_type_of<boost::posix_time::time_duration>
+ {
+ typedef boost::posix_time::time_duration type;
+ };
+
     boost::posix_time::time_duration operator ++(boost::posix_time::time_duration& x)
     {
         return x += boost::posix_time::ptime::time_duration_type::unit();

Modified: branches/release/libs/icl/test/test_type_lists.hpp
==============================================================================
--- branches/release/libs/icl/test/test_type_lists.hpp (original)
+++ branches/release/libs/icl/test/test_type_lists.hpp 2010-12-19 13:00:27 EST (Sun, 19 Dec 2010)
@@ -17,8 +17,14 @@
 
 #if(_MSC_VER < 1500 && defined(_DEBUG) ) // 1500 = MSVC-9.0
 typedef int boost_posix_time_ptime;
+typedef int boost_posix_time_duration;
+typedef int boost_gregorian_date;
+typedef int boost_gregorian_date_duration;
 #else
-typedef boost::posix_time::ptime boost_posix_time_ptime;
+typedef boost::posix_time::ptime boost_posix_time_ptime;
+typedef boost::posix_time::time_duration boost_posix_time_duration;
+typedef boost::gregorian::date boost_gregorian_date;
+typedef boost::gregorian::date_duration boost_gregorian_date_duration;
 #endif
 
 typedef ::boost::mpl::list<
@@ -27,7 +33,9 @@
     ,float, double, long double
     ,boost::rational<int>
     ,boost_posix_time_ptime
-// ,boost::gregorian::date
+ ,boost_posix_time_duration
+ ,boost_gregorian_date
+ ,boost_gregorian_date_duration
     ,int*
> bicremental_types;
 
@@ -84,7 +92,11 @@
     ,unsigned long, unsigned long long
     ,short, int, long
     ,boost_posix_time_ptime
-// ,boost::gregorian::date
+ ,boost_posix_time_ptime
+ ,boost_posix_time_duration
+ ,boost_gregorian_date
+ ,boost_gregorian_date_duration
+ ,int*
> discrete_types;
 
 typedef int discrete_type_1;
@@ -130,7 +142,10 @@
     ,boost::rational<int>
     ,std::string
     ,boost_posix_time_ptime
-// ,boost::gregorian::date
+ ,boost_posix_time_duration
+ ,boost_gregorian_date
+ ,boost_gregorian_date_duration
+ ,int*
> ordered_types;
 
 typedef int ordered_type_1;

Modified: branches/release/libs/icl/test/test_value_maker.hpp
==============================================================================
--- branches/release/libs/icl/test/test_value_maker.hpp (original)
+++ branches/release/libs/icl/test/test_value_maker.hpp 2010-12-19 13:00:27 EST (Sun, 19 Dec 2010)
@@ -75,7 +75,7 @@
     {
         static const int offset = size/2;
         for(int idx = 0; idx < size; idx++)
- values[idx] = test_value<Type>::make(idx - offset);
+ values[idx] = test_value<Type>::make(idx - offset);
     
         return true;
     }


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