/*-----------------------------------------------------------------------------+ Copyright (c) 2010-2010: Joachim Faulhaber +------------------------------------------------------------------------------+ 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) +-----------------------------------------------------------------------------*/ #ifndef BOOST_ICL_TYPE_TRAITS_IS_INTERVAL_HPP_JOFA_100327 #define BOOST_ICL_TYPE_TRAITS_IS_INTERVAL_HPP_JOFA_100327 #include #include #include namespace boost{ namespace icl { template struct interval_bound_type { typedef interval_bound_type type; BOOST_STATIC_CONSTANT(bound_type, value = (interval_bounds::undefined)); }; template struct is_interval { typedef is_interval type; BOOST_STATIC_CONSTANT(bool, value = ((interval_bound_type::value) < interval_bounds::undefined)); }; template struct has_static_bounds { typedef has_static_bounds type; BOOST_STATIC_CONSTANT(bool, value = ((interval_bound_type::value) < interval_bounds::dynamic)); }; template struct has_dynamic_bounds { typedef has_dynamic_bounds type; BOOST_STATIC_CONSTANT(bool, value = (interval_bound_type::value == interval_bounds::dynamic)); }; template struct has_asymmetric_bounds { typedef has_asymmetric_bounds type; BOOST_STATIC_CONSTANT(bound_type, bounds = (interval_bound_type::value)); BOOST_STATIC_CONSTANT(bool, value = ( bounds == interval_bounds::static_left_open || bounds == interval_bounds::static_right_open)); }; template struct has_symmetric_bounds { typedef has_symmetric_bounds type; BOOST_STATIC_CONSTANT(bound_type, bounds = (interval_bound_type::value)); BOOST_STATIC_CONSTANT(bool, value = ( bounds == interval_bounds::static_closed || bounds == interval_bounds::static_open)); }; //------------------------------------------------------------------------------ template struct is_discrete_static { typedef is_discrete_static type; typedef typename interval_traits::domain_type domain_type; BOOST_STATIC_CONSTANT(bool, value = (mpl::and_< has_static_bounds , is_discrete >::value) ); }; //------------------------------------------------------------------------------ template struct is_continuous_static { typedef is_continuous_static type; typedef typename interval_traits::domain_type domain_type; BOOST_STATIC_CONSTANT(bool, value = (mpl::and_< has_static_bounds , is_continuous , has_asymmetric_bounds >::value) ); }; //------------------------------------------------------------------------------ template struct is_static_right_open { typedef is_static_right_open type; BOOST_STATIC_CONSTANT(bool, value = (interval_bound_type::value == interval_bounds::static_right_open)); }; template struct is_static_left_open { typedef is_static_left_open type; BOOST_STATIC_CONSTANT(bool, value = (interval_bound_type::value == interval_bounds::static_left_open)); }; template struct is_static_open { typedef is_static_open type; BOOST_STATIC_CONSTANT(bool, value = (interval_bound_type::value == interval_bounds::static_open)); }; template struct is_static_closed { typedef is_static_closed type; BOOST_STATIC_CONSTANT(bool, value = (interval_bound_type::value == interval_bounds::static_closed)); }; template struct is_discrete_static_closed { typedef is_static_closed type; typedef typename interval_traits::domain_type domain_type; BOOST_STATIC_CONSTANT( bool, value = (mpl::and_< is_static_closed , is_discrete >::value) ); }; template struct is_discrete_static_open { typedef is_static_closed type; typedef typename interval_traits::domain_type domain_type; BOOST_STATIC_CONSTANT( bool, value = (mpl::and_< is_static_open , is_discrete >::value) ); }; //------------------------------------------------------------------------------ template struct is_continuous_right_open { typedef is_continuous_right_open type; typedef typename interval_traits::domain_type domain_type; BOOST_STATIC_CONSTANT(bool, value = (mpl::and_, is_continuous >::value)); }; template struct is_continuous_left_open { typedef is_continuous_left_open type; typedef typename interval_traits::domain_type domain_type; BOOST_STATIC_CONSTANT(bool, value = (mpl::and_, is_continuous >::value)); }; //------------------------------------------------------------------------------ template struct is_singelizable { typedef is_singelizable type; typedef typename interval_traits::domain_type domain_type; BOOST_STATIC_CONSTANT(bool, value = (mpl::or_< has_dynamic_bounds , is_discrete >::value) ); }; }} // namespace boost icl #endif