![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /usr/include/boost/icl/ |
Upload File : |
/*-----------------------------------------------------------------------------+ 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_INTERVAL_BOUNDS_HPP_JOFA_100330 #define BOOST_ICL_INTERVAL_BOUNDS_HPP_JOFA_100330 #include <boost/utility/enable_if.hpp> #include <boost/icl/detail/design_config.hpp> namespace boost{namespace icl { typedef unsigned char bound_type; class interval_bounds { public: BOOST_STATIC_CONSTANT(bound_type, static_open = 0); BOOST_STATIC_CONSTANT(bound_type, static_left_open = 1); BOOST_STATIC_CONSTANT(bound_type, static_right_open = 2); BOOST_STATIC_CONSTANT(bound_type, static_closed = 3); BOOST_STATIC_CONSTANT(bound_type, dynamic = 4); BOOST_STATIC_CONSTANT(bound_type, undefined = 5); BOOST_STATIC_CONSTANT(bound_type, _open = 0); BOOST_STATIC_CONSTANT(bound_type, _left_open = 1); BOOST_STATIC_CONSTANT(bound_type, _right_open = 2); BOOST_STATIC_CONSTANT(bound_type, _closed = 3); BOOST_STATIC_CONSTANT(bound_type, _right = 1); BOOST_STATIC_CONSTANT(bound_type, _left = 2); BOOST_STATIC_CONSTANT(bound_type, _all = 3); public: interval_bounds():_bits(){} explicit interval_bounds(bound_type bounds): _bits(bounds){} interval_bounds all ()const { return interval_bounds(_bits & _all ); } interval_bounds left ()const { return interval_bounds(_bits & _left ); } interval_bounds right()const { return interval_bounds(_bits & _right); } interval_bounds reverse_left ()const { return interval_bounds((bound_type(~_bits)>>1) & _right); } interval_bounds reverse_right()const { return interval_bounds((bound_type(~_bits)<<1) & _left ); } bound_type bits()const{ return _bits; } static interval_bounds open() { return interval_bounds(_open); } static interval_bounds left_open() { return interval_bounds(_left_open); } static interval_bounds right_open(){ return interval_bounds(_right_open);} static interval_bounds closed() { return interval_bounds(_closed); } public: bound_type _bits; }; template<class DomainT> class bounded_value { public: typedef DomainT domain_type; typedef bounded_value<DomainT> type; public: bounded_value(const domain_type& value, interval_bounds bound) : _value(value), _bound(bound) {} domain_type value()const { return _value; } interval_bounds bound()const { return _bound; } private: domain_type _value; interval_bounds _bound; }; }} // namespace icl boost #endif