Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/future In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6755/adobe/future Modified Files: Jamfile.v2 assemblage.hpp closed_hash.hpp cmd_system.hpp count_minmax.hpp enum_ops.hpp file_slurp.hpp find_closest.hpp iomanip.hpp iomanip_asl_cel.hpp iomanip_fwd.hpp iomanip_pdf.hpp iomanip_xml.hpp manip.hpp memory.hpp menu_system.hpp modal_dialog_interface.hpp ternary_function.hpp timer.hpp Log Message: asl 1.0.13 Index: assemblage.hpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/future/assemblage.hpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** assemblage.hpp 6 Jan 2006 18:02:57 -0000 1.5 --- assemblage.hpp 3 Feb 2006 18:33:36 -0000 1.6 *************** *** 1,6 **** /* ! Copyright 2005-2006 Adobe Systems Incorporated ! Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt ! or a copy at http://opensource.adobe.com/licenses.html) */ --- 1,6 ---- /* ! Copyright 2005-2006 Adobe Systems Incorporated ! Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt ! or a copy at http://opensource.adobe.com/licenses.html) */ *************** *** 30,62 **** { public: ! typedef boost::signals::connection connection_t; ! typedef boost::function<void ()> destruct_slot_t; private: ! typedef std::list<connection_t> connections_t; #if 0 ! typedef boost::signal<void ()> destruct_signal_t; #endif ! typedef std::vector<destruct_slot_t> destruct_signal_t; public: ! assemblage_t(); ! ~assemblage_t(); ! connection_t& hold_connection(const connection_t& connection); ! void signal_destruction(const destruct_slot_t& slot); ! template <typename T> ! void delete_on_destruction(T& x) ! { ! adobe::delete_ptr<T> deleter; ! signal_destruction(boost::bind(deleter,x)); ! } private: ! connections_t connections_m; ! destruct_signal_t destruct_signal_m; ! int group_m; }; --- 30,62 ---- { public: ! typedef boost::signals::connection connection_t; ! typedef boost::function<void ()> destruct_slot_t; private: ! typedef std::list<connection_t> connections_t; #if 0 ! typedef boost::signal<void ()> destruct_signal_t; #endif ! typedef std::vector<destruct_slot_t> destruct_signal_t; public: ! assemblage_t(); ! ~assemblage_t(); ! connection_t& hold_connection(const connection_t& connection); ! void signal_destruction(const destruct_slot_t& slot); ! template <typename T> ! void delete_on_destruction(T& x) ! { ! adobe::delete_ptr<T> deleter; ! signal_destruction(boost::bind(deleter,x)); ! } private: ! connections_t connections_m; ! destruct_signal_t destruct_signal_m; ! int group_m; }; *************** *** 71,85 **** struct equal_to_first : std::unary_function<PairType, bool> { ! equal_to_first(const typename PairType::first_type& first) : ! first_m(first) ! { } ! ! bool operator() (const PairType& pair) const ! { return pair.first == first_m; } private: ! typename PairType::first_type first_m; }; ! } // namespace --- 71,85 ---- struct equal_to_first : std::unary_function<PairType, bool> { ! equal_to_first(const typename PairType::first_type& first) : ! first_m(first) ! { } ! ! bool operator() (const PairType& pair) const ! { return pair.first == first_m; } private: ! typename PairType::first_type first_m; }; ! } // namespace Index: find_closest.hpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/future/find_closest.hpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** find_closest.hpp 6 Jan 2006 18:02:57 -0000 1.3 --- find_closest.hpp 3 Feb 2006 18:33:36 -0000 1.4 *************** *** 1,6 **** /* ! Copyright 2005-2006 Adobe Systems Incorporated ! Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt ! or a copy at http://opensource.adobe.com/licenses.html) */ --- 1,6 ---- /* ! Copyright 2005-2006 Adobe Systems Incorporated ! Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt ! or a copy at http://opensource.adobe.com/licenses.html) */ *************** *** 25,66 **** /* ! find_closest takes a range and a value, and returns the closest value in the sequence to the ! value passed, for some definition of "closest". By default it compares the cardinal difference ! between the values to find the closest, though the client can pass their own TernaryPredicate ! to override this functionality. ! Preconditions: ! - The sequence to be searched must be sorted according to the comparison method used in ! the supplied TernaryPredicate. ! Postconditions: ! - As long as the size of the sequence is greater than 0, the result will always be a valid ! value inside the sequence. (i.e., the only time the end of the sequence is returned is ! when the sequence is empty). ! Additional Concepts: ! - Subtractable : Subtraction yields a difference type; T - T -> D ! - TernaryPredicate : A TernanyPredicate is called with three arguments ! and returns true or false. */ /*************************************************************************************************/ ! template < typename T // T models Subtractable ! > struct closer_predicate : ternary_function<T, T, T, bool> { ! typedef ternary_function<T, T, T, bool> _super; ! typedef typename _super::first_argument_type first_argument_type; ! typedef typename _super::second_argument_type second_argument_type; ! typedef typename _super::third_argument_type third_argument_type; ! typedef typename _super::result_type result_type; ! result_type operator () (const first_argument_type& a, const second_argument_type& b, const third_argument_type& x) const ! { ! // precondition: a <= b ! return x - a < b - x; ! } }; --- 25,66 ---- /* ! find_closest takes a range and a value, and returns the closest value in the sequence to the ! value passed, for some definition of "closest". By default it compares the cardinal difference ! between the values to find the closest, though the client can pass their own TernaryPredicate ! to override this functionality. ! Preconditions: ! - The sequence to be searched must be sorted according to the comparison method used in ! the supplied TernaryPredicate. ! Postconditions: ! - As long as the size of the sequence is greater than 0, the result will always be a valid ! value inside the sequence. (i.e., the only time the end of the sequence is returned is ! when the sequence is empty). ! Additional Concepts: ! - Subtractable : Subtraction yields a difference type; T - T -> D ! - TernaryPredicate : A TernanyPredicate is called with three arguments ! and returns true or false. */ /*************************************************************************************************/ ! template < typename T // T models Subtractable ! > struct closer_predicate : ternary_function<T, T, T, bool> { ! typedef ternary_function<T, T, T, bool> _super; ! typedef typename _super::first_argument_type first_argument_type; ! typedef typename _super::second_argument_type second_argument_type; ! typedef typename _super::third_argument_type third_argument_type; ! typedef typename _super::result_type result_type; ! result_type operator () (const first_argument_type& a, const second_argument_type& b, const third_argument_type& x) const ! { ! // precondition: a <= b ! return x - a < b - x; ! } }; *************** *** 71,131 **** /*************************************************************************************************/ ! template < typename I, // I models ForwardIterator ! typename D, // D models LessThanComparable ! typename T, // T models Subtractable ! typename C // C models TernaryPredicate ! > I find_closest(I first, D n, const T& value, C pred, std::forward_iterator_tag) { ! if (n < D(2)) return first; ! while (n != D(2)) ! { ! D third(n / D(3)); ! D new_n(n - third); ! I first_third(first); ! I last_third(first); ! std::advance(first_third, third); ! std::advance(last_third, new_n); ! if (!pred(*first_third, *last_third, value)) ! first = first_third; ! n = new_n; ! } ! I second(first); ! std::advance(second, 1); ! return pred(*first, *second, value) ? first : second; } /*************************************************************************************************/ ! template < typename I, // I models ForwardIterator ! typename D, // D models LessThanComparable ! typename T, // T models Subtractable ! typename C // C models TernaryPredicate ! > I find_closest(I first, D n, const T& value, C pred, std::random_access_iterator_tag) { ! if (n < D(2)) return first; ! while (n != D(2)) ! { ! D third(n / D(3)); ! D new_n(n - third); ! if (!pred(*(first + third), *(first + new_n), value)) ! first += third; ! n = new_n; ! } ! I second(first + 1); ! return pred(*first, *second, value) ? first : second; } --- 71,131 ---- /*************************************************************************************************/ ! template < typename I, // I models ForwardIterator ! typename D, // D models LessThanComparable ! typename T, // T models Subtractable ! typename C // C models TernaryPredicate ! > I find_closest(I first, D n, const T& value, C pred, std::forward_iterator_tag) { ! if (n < D(2)) return first; ! while (n != D(2)) ! { ! D third(n / D(3)); ! D new_n(n - third); ! I first_third(first); ! I last_third(first); ! std::advance(first_third, third); ! std::advance(last_third, new_n); ! if (!pred(*first_third, *last_third, value)) ! first = first_third; ! n = new_n; ! } ! I second(first); ! std::advance(second, 1); ! return pred(*first, *second, value) ? first : second; } /*************************************************************************************************/ ! template < typename I, // I models ForwardIterator ! typename D, // D models LessThanComparable ! typename T, // T models Subtractable ! typename C // C models TernaryPredicate ! > I find_closest(I first, D n, const T& value, C pred, std::random_access_iterator_tag) { ! if (n < D(2)) return first; ! while (n != D(2)) ! { ! D third(n / D(3)); ! D new_n(n - third); ! if (!pred(*(first + third), *(first + new_n), value)) ! first += third; ! n = new_n; ! } ! I second(first + 1); ! return pred(*first, *second, value) ? first : second; } *************** *** 136,187 **** /*************************************************************************************************/ ! template < typename I, // I models ForwardIterator ! typename D, // D models LessThanComparable ! typename T, // T models Subtractable ! typename C // C models TernaryPredicate ! > inline I find_closest(I first, D n, const T& value, C pred) { ! typedef typename std::iterator_traits<I>::iterator_category category; ! return implementation::find_closest(first, n, value, pred, category()); } /*************************************************************************************************/ ! template < typename I, // I models ForwardIterator ! typename D, // D models LessThanComparable ! typename T // T models Subtractable ! > inline I find_closest(I first, D n, const T& value) { ! typedef typename std::iterator_traits<I>::iterator_category category; ! return implementation::find_closest(first, n, value, closer_predicate<T>(), category()); } /*************************************************************************************************/ ! template < typename I, // I models ForwardIterator ! typename T, // T models Subtractable ! typename C // C models TernaryPredicate ! > inline I find_closest(I first, I last, const T& value, C pred) { ! typedef typename std::iterator_traits<I>::iterator_category category; ! return implementation::find_closest(first, std::distance(first, last), value, pred, category()); } /*************************************************************************************************/ ! template < typename I, // I models ForwardIterator ! typename T // T models Subtractable ! > inline I find_closest(I first, I last, const T& value) { ! typedef typename std::iterator_traits<I>::iterator_category category; ! return implementation::find_closest(first, std::distance(first, last), value, closer_predicate<T>(), category()); } --- 136,187 ---- /*************************************************************************************************/ ! template < typename I, // I models ForwardIterator ! typename D, // D models LessThanComparable ! typename T, // T models Subtractable ! typename C // C models TernaryPredicate ! > inline I find_closest(I first, D n, const T& value, C pred) { ! typedef typename std::iterator_traits<I>::iterator_category category; ! return implementation::find_closest(first, n, value, pred, category()); } /*************************************************************************************************/ ! template < typename I, // I models ForwardIterator ! typename D, // D models LessThanComparable ! typename T // T models Subtractable ! > inline I find_closest(I first, D n, const T& value) { ! typedef typename std::iterator_traits<I>::iterator_category category; ! return implementation::find_closest(first, n, value, closer_predicate<T>(), category()); } /*************************************************************************************************/ ! template < typename I, // I models ForwardIterator ! typename T, // T models Subtractable ! typename C // C models TernaryPredicate ! > inline I find_closest(I first, I last, const T& value, C pred) { ! typedef typename std::iterator_traits<I>::iterator_category category; ! return implementation::find_closest(first, std::distance(first, last), value, pred, category()); } /*************************************************************************************************/ ! template < typename I, // I models ForwardIterator ! typename T // T models Subtractable ! > inline I find_closest(I first, I last, const T& value) { ! typedef typename std::iterator_traits<I>::iterator_category category; ! return implementation::find_closest(first, std::distance(first, last), value, closer_predicate<T>(), category()); } Index: timer.hpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/future/timer.hpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** timer.hpp 6 Jan 2006 18:02:57 -0000 1.7 --- timer.hpp 3 Feb 2006 18:33:36 -0000 1.8 *************** *** 1,6 **** /* ! Copyright 2005-2006 Adobe Systems Incorporated ! Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt ! or a copy at http://opensource.adobe.com/licenses.html) */ --- 1,6 ---- /* ! Copyright 2005-2006 Adobe Systems Incorporated ! Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt ! or a copy at http://opensource.adobe.com/licenses.html) */ *************** *** 16,32 **** \ingroup asl_libraries ! \brief A class for measuring periods of elapsed time. Can also ! accrue split times for some basic statistical reporting. Comparisons between two <code>adobe::timer_t</code> considers only the last split time. \model_of ! - \ref concept_regular_type ! - \ref stldoc_LessThanComparable \rationale ! A class that measures elapsed time can be useful when debugging, optimizing, or comparing ! implementations. <code>adobe::timer_t</code> utilizes the most accurate timing API a ! platform has to offer to maximize accuracy, while keeping the public API generic. \example --- 16,32 ---- \ingroup asl_libraries ! \brief A class for measuring periods of elapsed time. Can also ! accrue split times for some basic statistical reporting. Comparisons between two <code>adobe::timer_t</code> considers only the last split time. \model_of ! - \ref concept_regular_type ! - \ref stldoc_LessThanComparable \rationale ! A class that measures elapsed time can be useful when debugging, optimizing, or comparing ! implementations. <code>adobe::timer_t</code> utilizes the most accurate timing API a ! platform has to offer to maximize accuracy, while keeping the public API generic. \example *************** *** 35,52 **** \par \code ! adobe::timer_t timer1; ! do_my_func(); ! timer1.split(); ! adobe::timer_t timer2; ! do_their_func(); ! timer2.split(); ! if (timer1 == timer2) ! std::cout << "Functions are equally fast" << std::endl; ! else if (timer1 < timer2) ! std::cout << "My function is faster" << std::endl; ! else ! std::cout << "Their function is faster" << std::endl; \endcode \par --- 35,52 ---- \par \code ! adobe::timer_t timer1; ! do_my_func(); ! timer1.split(); ! adobe::timer_t timer2; ! do_their_func(); ! timer2.split(); ! if (timer1 == timer2) ! std::cout << "Functions are equally fast" << std::endl; ! else if (timer1 < timer2) ! std::cout << "My function is faster" << std::endl; ! else ! std::cout << "Their function is faster" << std::endl; \endcode \par *************** *** 54,80 **** in order to gain a more accurate understanding of the cost of an implementation: \code ! adobe::timer_t timer1; ! adobe::timer_t timer2; ! for (std::size_t i(0); i < sample_count_k; ++i) ! { ! timer1.reset(); ! do_my_func(); ! timer1.accrue(); ! timer2.reset(); ! do_their_func(); ! timer2.accrue(); ! } ! double my_avg(timer1.accrued_average()); ! double their_avg(timer2.accrued_average()); ! if (my_avg == their_avg) ! std::cout << "Functions are equally fast" << std::endl; ! else if (my_avg < their_avg) ! std::cout << "My function is faster" << std::endl; ! else ! std::cout << "Their function is faster" << std::endl; \endcode \par --- 54,80 ---- in order to gain a more accurate understanding of the cost of an implementation: \code ! adobe::timer_t timer1; ! adobe::timer_t timer2; ! for (std::size_t i(0); i < sample_count_k; ++i) ! { ! timer1.reset(); ! do_my_func(); ! timer1.accrue(); ! timer2.reset(); ! do_their_func(); ! timer2.accrue(); ! } ! double my_avg(timer1.accrued_average()); ! double their_avg(timer2.accrued_average()); ! if (my_avg == their_avg) ! std::cout << "Functions are equally fast" << std::endl; ! else if (my_avg < their_avg) ! std::cout << "My function is faster" << std::endl; ! else ! std::cout << "Their function is faster" << std::endl; \endcode \par *************** *** 98,116 **** #if ADOBE_PLATFORM_MAC ! #include<Carbon/Carbon.h> #elif ADOBE_PLATFORM_WIN ! #ifndef WINDOWS_LEAN_AND_MEAN ! #define WINDOWS_LEAN_AND_MEAN ! #define ADOBE_UNDEFINE_WINDOWS_LEAN_AND_MEAN 1 ! #endif ! #include <windows.h> ! #if ADOBE_UNDEFINE_WINDOWS_LEAN_AND_MEAN ! #undef WINDOWS_LEAN_AND_MEAN ! #undef ADOBE_UNDEFINE_WINDOWS_LEAN_AND_MEAN ! #endif #elif defined(BOOST_HAS_THREADS) ! #include <boost/thread/xtime.hpp> #elif defined(BOOST_HAS_GETTIMEOFDAY) ! #include <sys/time.h> #endif --- 98,116 ---- #if ADOBE_PLATFORM_MAC ! #include<Carbon/Carbon.h> #elif ADOBE_PLATFORM_WIN ! #ifndef WINDOWS_LEAN_AND_MEAN ! #define WINDOWS_LEAN_AND_MEAN ! #define ADOBE_UNDEFINE_WINDOWS_LEAN_AND_MEAN 1 ! #endif ! #include <windows.h> ! #if ADOBE_UNDEFINE_WINDOWS_LEAN_AND_MEAN ! #undef WINDOWS_LEAN_AND_MEAN ! #undef ADOBE_UNDEFINE_WINDOWS_LEAN_AND_MEAN ! #endif #elif defined(BOOST_HAS_THREADS) ! #include <boost/thread/xtime.hpp> #elif defined(BOOST_HAS_GETTIMEOFDAY) ! #include <sys/time.h> #endif *************** *** 128,341 **** { #if ADOBE_PLATFORM_MAC ! typedef UnsignedWide value_type; #elif ADOBE_PLATFORM_WIN ! typedef LARGE_INTEGER value_type; #elif defined(BOOST_HAS_THREADS) ! typedef boost::xtime value_type; #elif defined(BOOST_HAS_GETTIMEOFDAY) ! typedef timeval value_type; #endif ! typedef std::vector<double> accumulator_type; public: ! typedef accumulator_type::size_type size_type; #ifndef ADOBE_NO_DOCUMENTATION ! timer_t() ! { #if ADOBE_PLATFORM_WIN ! (void)::QueryPerformanceFrequency(&frequency_m); #endif ! reset(); ! } ! timer_t(const timer_t& rhs) : ! epoch_m(rhs.epoch_m), ! split_m(rhs.split_m), ! time_set_m(rhs.time_set_m) #if ADOBE_PLATFORM_WIN ! , frequency_m(rhs.frequency_m) #endif ! { } ! timer_t& operator = (const timer_t& rhs) ! { ! epoch_m = rhs.epoch_m; ! split_m = rhs.split_m; ! time_set_m = rhs.time_set_m; #if ADOBE_PLATFORM_WIN ! frequency_m = rhs.frequency_m; #endif ! return *this; ! } #endif ! /*! ! Resets the epoch of the timer to now ! */ ! inline void reset() ! { #if ADOBE_PLATFORM_MAC ! ::Microseconds(&epoch_m); #elif ADOBE_PLATFORM_WIN ! (void)::QueryPerformanceCounter(&epoch_m); #elif defined(BOOST_HAS_THREADS) ! boost::xtime_get(&epoch_m, boost::TIME_UTC); #elif defined(BOOST_HAS_GETTIMEOFDAY) ! gettimeofday(&epoch_m, static_cast<struct timezone*>(0)); #endif ! } ! /*! ! Resets the split time accumulator ! */ ! inline void reset_accumulator() ! { time_set_m.clear(); } ! /*! ! \return ! The difference of time between the epoch and now, in milliseconds ! */ ! inline double split() ! { #if ADOBE_PLATFORM_MAC ! ::Microseconds(&split_m); #elif ADOBE_PLATFORM_WIN ! (void)::QueryPerformanceCounter(&split_m); #elif defined(BOOST_HAS_THREADS) ! boost::xtime_get(&split_m, boost::TIME_UTC); #elif defined(BOOST_HAS_GETTIMEOFDAY) ! gettimeofday(&split_m, static_cast<struct timezone*>(0)); #endif ! return last_split(); ! } ! /*! ! \return ! The difference of time between the epoch and the last split, in milliseconds ! */ ! ! inline double last_split() const ! { #if ADOBE_PLATFORM_MAC ! return (split_m.lo - epoch_m.lo) / double(1e3); #elif ADOBE_PLATFORM_WIN ! return (split_m.QuadPart - epoch_m.QuadPart) / static_cast<double>(frequency_m.QuadPart) * double(1e3); #elif defined(BOOST_HAS_THREADS) ! return ((split_m.sec - epoch_m.sec) * double(1e3) + (split_m.nsec - epoch_m.nsec) / double(1e6)); #elif defined(BOOST_HAS_GETTIMEOFDAY) ! return ((split_m.tv_sec - epoch_m.tv_sec) * double(1e3) + (split_m.tv_usec - epoch_m.tv_usec) / double(1e3)); #else ! return -1; #endif ! } ! /*! ! Grabs a new split time and stores it in the accumulator. ! */ ! inline void accrue() ! { time_set_m.push_back(split()); } ! /*! ! \return ! The smallest of the split times in the accumulator, in milliseconds ! */ ! inline double accrued_min() const ! { return *adobe::min_element(time_set_m); } ! /*! ! \return ! The largest of the split times in the accumulator, in milliseconds ! */ ! inline double accrued_max() const ! { return *adobe::max_element(time_set_m); } ! /*! ! \return ! The average of the split times in the accumulator, in milliseconds ! */ ! inline double accrued_average() const ! { return empty() ? 0 : accrued_total() / size(); } ! /*! ! \return ! The median of the split times in the accumulator, in milliseconds ! */ ! inline double accrued_median() const ! { ! if (empty()) return 0; ! adobe::sort(time_set_m); ! return (size() % 2 == 1) ? ! time_set_m[time_set_m.size() / 2] : ! (time_set_m[time_set_m.size() / 2] + ! time_set_m[time_set_m.size() / 2 - 1]) / 2; ! } ! /*! ! \return ! The summation of the split times in the accumulator, in milliseconds ! */ ! inline double accrued_total() const ! { return adobe::accumulate(time_set_m, double(0)); } ! /*! ! \return ! The number of split times in the accumulator ! */ ! inline size_type size() const ! { return time_set_m.size(); } ! /*! ! \return ! Whether or not there are any split times in the accumulator ! */ ! inline bool empty() const ! { return time_set_m.empty(); } ! /*! ! An archaic utility function that takes a new split time and outputs it to a stream ! \param decoration An identifier to apply to the split time. ! \param s The stream to which output is written. Defaults to <code>std::cout</code> ! */ ! inline void report(const char* decoration, std::ostream& s = std::cout) ! { ! double time(split()); ! s << decoration << " took " << time << " milliseconds (" << time / 1e3 << " sec)" << std::endl; ! } private: #ifndef ADOBE_NO_DOCUMENTATION ! friend bool operator == (const timer_t& x, const timer_t& y); ! friend bool operator < (const timer_t& x, const timer_t& y); #endif ! value_type epoch_m; ! value_type split_m; ! mutable accumulator_type time_set_m; #if ADOBE_PLATFORM_WIN ! value_type frequency_m; #endif }; --- 128,341 ---- { #if ADOBE_PLATFORM_MAC ! typedef UnsignedWide value_type; #elif ADOBE_PLATFORM_WIN ! typedef LARGE_INTEGER value_type; #elif defined(BOOST_HAS_THREADS) ! typedef boost::xtime value_type; #elif defined(BOOST_HAS_GETTIMEOFDAY) ! typedef timeval value_type; #endif ! typedef std::vector<double> accumulator_type; public: ! typedef accumulator_type::size_type size_type; #ifndef ADOBE_NO_DOCUMENTATION ! timer_t() ! { #if ADOBE_PLATFORM_WIN ! (void)::QueryPerformanceFrequency(&frequency_m); #endif ! reset(); ! } ! timer_t(const timer_t& rhs) : ! epoch_m(rhs.epoch_m), ! split_m(rhs.split_m), ! time_set_m(rhs.time_set_m) #if ADOBE_PLATFORM_WIN ! , frequency_m(rhs.frequency_m) #endif ! { } ! timer_t& operator = (const timer_t& rhs) ! { ! epoch_m = rhs.epoch_m; ! split_m = rhs.split_m; ! time_set_m = rhs.time_set_m; #if ADOBE_PLATFORM_WIN ! frequency_m = rhs.frequency_m; #endif ! return *this; ! } #endif ! /*! ! Resets the epoch of the timer to now ! */ ! inline void reset() ! { #if ADOBE_PLATFORM_MAC ! ::Microseconds(&epoch_m); #elif ADOBE_PLATFORM_WIN ! (void)::QueryPerformanceCounter(&epoch_m); #elif defined(BOOST_HAS_THREADS) ! boost::xtime_get(&epoch_m, boost::TIME_UTC); #elif defined(BOOST_HAS_GETTIMEOFDAY) ! gettimeofday(&epoch_m, static_cast<struct timezone*>(0)); #endif ! } ! /*! ! Resets the split time accumulator ! */ ! inline void reset_accumulator() ! { time_set_m.clear(); } ! /*! ! \return ! The difference of time between the epoch and now, in milliseconds ! */ ! inline double split() ! { #if ADOBE_PLATFORM_MAC ! ::Microseconds(&split_m); #elif ADOBE_PLATFORM_WIN ! (void)::QueryPerformanceCounter(&split_m); #elif defined(BOOST_HAS_THREADS) ! boost::xtime_get(&split_m, boost::TIME_UTC); #elif defined(BOOST_HAS_GETTIMEOFDAY) ! gettimeofday(&split_m, static_cast<struct timezone*>(0)); #endif ! return last_split(); ! } ! /*! ! \return ! The difference of time between the epoch and the last split, in milliseconds ! */ ! ! inline double last_split() const ! { #if ADOBE_PLATFORM_MAC ! return (split_m.lo - epoch_m.lo) / double(1e3); #elif ADOBE_PLATFORM_WIN ! return (split_m.QuadPart - epoch_m.QuadPart) / static_cast<double>(frequency_m.QuadPart) * double(1e3); #elif defined(BOOST_HAS_THREADS) ! return ((split_m.sec - epoch_m.sec) * double(1e3) + (split_m.nsec - epoch_m.nsec) / double(1e6)); #elif defined(BOOST_HAS_GETTIMEOFDAY) ! return ((split_m.tv_sec - epoch_m.tv_sec) * double(1e3) + (split_m.tv_usec - epoch_m.tv_usec) / double(1e3)); #else ! return -1; #endif ! } ! /*! ! Grabs a new split time and stores it in the accumulator. ! */ ! inline void accrue() ! { time_set_m.push_back(split()); } ! /*! ! \return ! The smallest of the split times in the accumulator, in milliseconds ! */ ! inline double accrued_min() const ! { return *adobe::min_element(time_set_m); } ! /*! ! \return ! The largest of the split times in the accumulator, in milliseconds ! */ ! inline double accrued_max() const ! { return *adobe::max_element(time_set_m); } ! /*! ! \return ! The average of the split times in the accumulator, in milliseconds ! */ ! inline double accrued_average() const ! { return empty() ? 0 : accrued_total() / size(); } ! /*! ! \return ! The median of the split times in the accumulator, in milliseconds ! */ ! inline double accrued_median() const ! { ! if (empty()) return 0; ! adobe::sort(time_set_m); ! return (size() % 2 == 1) ? ! time_set_m[time_set_m.size() / 2] : ! (time_set_m[time_set_m.size() / 2] + ! time_set_m[time_set_m.size() / 2 - 1]) / 2; ! } ! /*! ! \return ! The summation of the split times in the accumulator, in milliseconds ! */ ! inline double accrued_total() const ! { return adobe::accumulate(time_set_m, double(0)); } ! /*! ! \return ! The number of split times in the accumulator ! */ ! inline size_type size() const ! { return time_set_m.size(); } ! /*! ! \return ! Whether or not there are any split times in the accumulator ! */ ! inline bool empty() const ! { return time_set_m.empty(); } ! /*! ! An archaic utility function that takes a new split time and outputs it to a stream ! \param decoration An identifier to apply to the split time. ! \param s The stream to which output is written. Defaults to <code>std::cout</code> ! */ ! inline void report(const char* decoration, std::ostream& s = std::cout) ! { ! double time(split()); ! s << decoration << " took " << time << " milliseconds (" << time / 1e3 << " sec)" << std::endl; ! } private: #ifndef ADOBE_NO_DOCUMENTATION ! friend bool operator == (const timer_t& x, const timer_t& y); ! friend bool operator < (const timer_t& x, const timer_t& y); #endif ! value_type epoch_m; ! value_type split_m; ! mutable accumulator_type time_set_m; #if ADOBE_PLATFORM_WIN ! value_type frequency_m; #endif }; Index: manip.hpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/future/manip.hpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** manip.hpp 6 Jan 2006 18:02:57 -0000 1.3 --- manip.hpp 3 Feb 2006 18:33:36 -0000 1.4 *************** *** 1,6 **** /* ! Copyright 2005-2006 Adobe Systems Incorporated ! Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt ! or a copy at http://opensource.adobe.com/licenses.html) */ --- 1,6 ---- /* ! Copyright 2005-2006 Adobe Systems Incorporated ! Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt ! or a copy at http://opensource.adobe.com/licenses.html) */ *************** *** 29,83 **** { public: ! manipulator_base() : ! error_m(std::ios_base::goodbit) ! { } protected: ! template <typename StreamType> ! std::ios_base::iostate handle_error(StreamType& strm) const ! { ! std::ios_base::iostate err(error_m); ! try { throw; } ! catch (std::bad_alloc&) ! { ! set_bad(); ! std::ios_base::iostate exception_mask(strm.exceptions()); ! ! if (exception_mask & std::ios_base::failbit && !(exception_mask & std::ios_base::badbit)) ! strm.setstate(err); ! else if (exception_mask & std::ios_base::badbit) ! { ! try { strm.setstate(err); } ! catch (std::ios_base::failure&) { } ! throw; ! } ! } ! catch (...) ! { ! set_fail(); ! std::ios_base::iostate exception_mask(strm.exceptions()); ! if ((exception_mask & std::ios_base::badbit) && (err & std::ios_base::badbit)) ! strm.setstate(err); ! else if (exception_mask & std::ios_base::failbit) ! { ! try { strm.setstate(err); } ! catch (std::ios_base::failure&) { } ! throw; ! } ! } ! return err; ! } ! void set_fail() const { error_m |= std::ios_base::failbit; } ! void set_bad() const { error_m |= std::ios_base::badbit; } ! mutable std::ios_base::iostate error_m; }; --- 29,83 ---- { public: ! manipulator_base() : ! error_m(std::ios_base::goodbit) ! { } protected: ! template <typename StreamType> ! std::ios_base::iostate handle_error(StreamType& strm) const ! { ! std::ios_base::iostate err(error_m); ! try { throw; } ! catch (std::bad_alloc&) ! { ! set_bad(); ! std::ios_base::iostate exception_mask(strm.exceptions()); ! ! if (exception_mask & std::ios_base::failbit && !(exception_mask & std::ios_base::badbit)) ! strm.setstate(err); ! else if (exception_mask & std::ios_base::badbit) ! { ! try { strm.setstate(err); } ! catch (std::ios_base::failure&) { } ! throw; ! } ! } ! catch (...) ! { ! set_fail(); ! std::ios_base::iostate exception_mask(strm.exceptions()); ! if ((exception_mask & std::ios_base::badbit) && (err & std::ios_base::badbit)) ! strm.setstate(err); ! else if (exception_mask & std::ios_base::failbit) ! { ! try { strm.setstate(err); } ! catch (std::ios_base::failure&) { } ! throw; ! } ! } ! return err; ! } ! void set_fail() const { error_m |= std::ios_base::failbit; } ! void set_bad() const { error_m |= std::ios_base::badbit; } ! mutable std::ios_base::iostate error_m; }; *************** *** 88,124 **** { public: ! typedef ArgumentType argument_type; ! typedef std::basic_ostream<charT, traits> stream_type; ! typedef stream_type& (*manip_func)(stream_type&, const ArgumentType&); ! basic_omanipulator(manip_func pf, const ArgumentType& arg) : ! pf_m(pf), arg_m(arg) ! { } ! void do_manip(stream_type& strm) const ! { ! if (error_m != std::ios_base::goodbit) ! strm.setstate(error_m); ! else ! { ! std::ios_base::iostate err(error_m); ! try ! { ! (*pf_m)(strm, arg_m); ! } ! catch (...) ! { ! err = handle_error(strm); ! } ! if (err) strm.setstate(err); ! } ! } private: ! manip_func pf_m; protected: ! argument_type arg_m; }; --- 88,124 ---- { public: ! typedef ArgumentType argument_type; ! typedef std::basic_ostream<charT, traits> stream_type; ! typedef stream_type& (*manip_func)(stream_type&, const ArgumentType&); ! basic_omanipulator(manip_func pf, const ArgumentType& arg) : ! pf_m(pf), arg_m(arg) ! { } ! void do_manip(stream_type& strm) const ! { ! if (error_m != std::ios_base::goodbit) ! strm.setstate(error_m); ! else ! { ! std::ios_base::iostate err(error_m); ! try ! { ! (*pf_m)(strm, arg_m); ! } ! catch (...) ! { ! err = handle_error(strm); ! } ! if (err) strm.setstate(err); ! } ! } private: ! manip_func pf_m; protected: ! argument_type arg_m; }; *************** *** 129,167 **** { public: ! typedef ArgumentType1 argument_type_1; ! typedef ArgumentType2 argument_type_2; ! typedef std::basic_ostream<charT, traits> stream_type; ! typedef stream_type& (*manip_func)(stream_type&, const ArgumentType1&, const ArgumentType2&); ! basic_omanipulator2(manip_func pf, const ArgumentType1& arg1, const ArgumentType2& arg2) : ! pf_m(pf), arg1_m(arg1) , arg2_m(arg2) ! { } ! void do_manip(stream_type& strm) const ! { ! if (error_m != std::ios_base::goodbit) ! strm.setstate(error_m); ! else ! { ! std::ios_base::iostate err(error_m); ! try ! { ! (*pf_m)(strm, arg1_m, arg2_m); ! } ! catch (...) ! { ! err = handle_error(strm); ! } ! if (err) strm.setstate(err); ! } ! } private: ! manip_func pf_m; protected: ! argument_type_1 arg1_m; ! argument_type_2 arg2_m; }; --- 129,167 ---- { public: ! typedef ArgumentType1 argument_type_1; ! typedef ArgumentType2 argument_type_2; ! typedef std::basic_ostream<charT, traits> stream_type; ! typedef stream_type& (*manip_func)(stream_type&, const ArgumentType1&, const ArgumentType2&); ! basic_omanipulator2(manip_func pf, const ArgumentType1& arg1, const ArgumentType2& arg2) : ! pf_m(pf), arg1_m(arg1) , arg2_m(arg2) ! { } ! void do_manip(stream_type& strm) const ! { ! if (error_m != std::ios_base::goodbit) ! strm.setstate(error_m); ! else ! { ! std::ios_base::iostate err(error_m); ! try ! { ! (*pf_m)(strm, arg1_m, arg2_m); ! } ! catch (...) ! { ! err = handle_error(strm); ! } ! if (err) strm.setstate(err); ! } ! } private: ! manip_func pf_m; protected: ! argument_type_1 arg1_m; ! argument_type_2 arg2_m; }; *************** *** 170,180 **** template <class ArgumentType, class charT, class traits> std::basic_ostream<charT, traits>& operator << (std::basic_ostream<charT, traits>& os, ! const adobe::basic_omanipulator<ArgumentType, charT, traits>& manip) ! { ! if (os.good()) ! manip.do_manip(os); ! return os; ! } /*************************************************************************************************/ --- 170,180 ---- template <class ArgumentType, class charT, class traits> std::basic_ostream<charT, traits>& operator << (std::basic_ostream<charT, traits>& os, ! const adobe::basic_omanipulator<ArgumentType, charT, traits>& manip) ! { ! if (os.good()) ! manip.do_manip(os); ! return os; ! } /*************************************************************************************************/ *************** *** 182,192 **** template <class ArgumentType1, class ArgumentType2, class charT, class traits> std::basic_ostream<charT, traits>& operator << (std::basic_ostream<charT, traits>& os, ! const adobe::basic_omanipulator2<ArgumentType1, ArgumentType2, charT, traits>& manip) ! { ! if (os.good()) ! manip.do_manip(os); ! return os; ! } /*************************************************************************************************/ --- 182,192 ---- template <class ArgumentType1, class ArgumentType2, class charT, class traits> std::basic_ostream<charT, traits>& operator << (std::basic_ostream<charT, traits>& os, ! const adobe::basic_omanipulator2<ArgumentType1, ArgumentType2, charT, traits>& manip) ! { ! if (os.good()) ! manip.do_manip(os); ! return os; ! } /*************************************************************************************************/ *************** *** 195,228 **** class basic_bounded_width : public basic_omanipulator<unsigned int, charT, traits> { ! typedef basic_omanipulator<unsigned int, charT, traits> inherited_t; public: ! typedef typename inherited_t::stream_type stream_type; ! typedef typename inherited_t::argument_type argument_type; ! basic_bounded_width(argument_type min, argument_type max) : ! basic_omanipulator<argument_type, charT, traits>(basic_bounded_width::fct, min), ! min_m(min), max_m(max) ! { } ! inherited_t& operator() (argument_type i) ! { ! inherited_t::arg_m = std::min(max_m, std::max(i, min_m)); ! return *this; ! } private: ! static stream_type& fct(stream_type& strm, const argument_type& i) ! { ! strm.width(i); ! return strm; ! } ! argument_type min_m; ! argument_type max_m; }; ! typedef basic_bounded_width<char, std::char_traits<char> > bounded_width; ! typedef basic_bounded_width<wchar_t, std::char_traits<wchar_t> > wbounded_width; /*************************************************************************************************/ --- 195,228 ---- class basic_bounded_width : public basic_omanipulator<unsigned int, charT, traits> { ! typedef basic_omanipulator<unsigned int, charT, traits> inherited_t; public: ! typedef typename inherited_t::stream_type stream_type; ! typedef typename inherited_t::argument_type argument_type; ! basic_bounded_width(argument_type min, argument_type max) : ! basic_omanipulator<argument_type, charT, traits>(basic_bounded_width::fct, min), ! min_m(min), max_m(max) ! { } ! inherited_t& operator() (argument_type i) ! { ! inherited_t::arg_m = std::min(max_m, std::max(i, min_m)); ! return *this; ! } private: ! static stream_type& fct(stream_type& strm, const argument_type& i) ! { ! strm.width(i); ! return strm; ! } ! argument_type min_m; ! argument_type max_m; }; ! typedef basic_bounded_width<char, std::char_traits<char> > bounded_width; ! typedef basic_bounded_width<wchar_t, std::char_traits<wchar_t> > wbounded_width; /*************************************************************************************************/ Index: enum_ops.hpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/future/enum_ops.hpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** enum_ops.hpp 6 Jan 2006 18:02:57 -0000 1.5 --- enum_ops.hpp 3 Feb 2006 18:33:36 -0000 1.6 *************** *** 1,6 **** /* ! Copyright 2005-2006 Adobe Systems Incorporated ! Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt ! or a copy at http://opensource.adobe.com/licenses.html) */ --- 1,6 ---- /* ! Copyright 2005-2006 Adobe Systems Incorporated ! Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt ! or a copy at http://opensource.adobe.com/licenses.html) */ *************** *** 17,56 **** /*! ! \defgroup enum_ops Enumeration Operations ! \ingroup asl_libraries ! ! \section Description Description ! ! \c enum_ops provides optional typesafe bitset and arithmetic ! operations for enumeration types. Without these typesafe operations, ! the compiler will promote the operand(s) to the appropriate integral ! type, and the result will be an integral type. When the typesafe ! operations have been defined for an enumeration type, \c E, the result ! will be of type \c E exactly when the operand(s) are of type \c E. ! ! \c ADOBE_DEFINE_BITSET_OPS(E) enables the bitset operations <code>~, ! |, &, ^, |=, &=, ^= </code> for enumeration type \c E. ! ! \c ADOBE_DEFINE_ARITHMETIC_OPS(E) enables the typesafe arithmetic ! operations <code>=, -, *, /, %, +=, *=, -=, /=, %=</code> for ! enumeration type \c E. ! ! \section Definition Definition ! ! Defined in \link enum_ops.hpp <code>adobe/enum_ops.hpp</code> \endlink ! ! \section Example Example ! ! The following is an example of code that will compile: ! \dontinclude enum_ops_example.cpp ! \skip start_of_example ! \until end_of_example ! ! The following is contains an example of code that will not compile ! since the typesafe operators have not been defined. ! ! \dontinclude enum_ops_example_fail.cpp ! \skip start_of_example ! \until end_of_example */ --- 17,56 ---- /*! ! \defgroup enum_ops Enumeration Operations ! \ingroup asl_libraries ! ! \section Description Description ! ! \c enum_ops provides optional typesafe bitset and arithmetic ! operations for enumeration types. Without these typesafe operations, ! the compiler will promote the operand(s) to the appropriate integral ! type, and the result will be an integral type. When the typesafe ! operations have been defined for an enumeration type, \c E, the result ! will be of type \c E exactly when the operand(s) are of type \c E. ! ! \c ADOBE_DEFINE_BITSET_OPS(E) enables the bitset operations <code>~, ! |, &, ^, |=, &=, ^= </code> for enumeration type \c E. ! ! \c ADOBE_DEFINE_ARITHMETIC_OPS(E) enables the typesafe arithmetic ! operations <code>=, -, *, /, %, +=, *=, -=, /=, %=</code> for ! enumeration type \c E. ! ! \section Definition Definition ! ! Defined in \link enum_ops.hpp <code>adobe/enum_ops.hpp</code> \endlink ! ! \section Example Example ! ! The following is an example of code that will compile: ! \dontinclude enum_ops_example.cpp ! \skip start_of_example ! \until end_of_example ! ! The following is contains an example of code that will not compile ! since the typesafe operators have not been defined. ! ! \dontinclude enum_ops_example_fail.cpp ! \skip start_of_example ! \until end_of_example */ *************** *** 65,80 **** /*************************************************************************************************/ #if !defined(ADOBE_NO_DOCUMENTATION) ! inline signed char promote_enum (signed char e) { return e; } ! inline unsigned char promote_enum (unsigned char e) { return e; } ! inline signed short promote_enum (signed short e) { return e; } ! inline unsigned short promote_enum (unsigned short e) { return e; } ! inline signed int promote_enum (signed int e) { return e; } ! inline unsigned int promote_enum (unsigned int e) { return e; } ! inline signed long promote_enum (signed long e) { return e; } ! inline unsigned long promote_enum (unsigned long e) { return e; } #ifdef BOOST_HAS_LONG_LONG ! inline signed long long promote_enum (signed long long e) { return e; } ! inline unsigned long long promote_enum (unsigned long long e) { return e; } #endif #endif --- 65,80 ---- /*************************************************************************************************/ #if !defined(ADOBE_NO_DOCUMENTATION) ! inline signed char promote_enum (signed char e) { return e; } ! inline unsigned char promote_enum (unsigned char e) { return e; } ! inline signed short promote_enum (signed short e) { return e; } ! inline unsigned short promote_enum (unsigned short e) { return e; } ! inline signed int promote_enum (signed int e) { return e; } ! inline unsigned int promote_enum (unsigned int e) { return e; } ! inline signed long promote_enum (signed long e) { return e; } ! inline unsigned long promote_enum (unsigned long e) { return e; } #ifdef BOOST_HAS_LONG_LONG ! inline signed long long promote_enum (signed long long e) { return e; } ! inline unsigned long long promote_enum (unsigned long long e) { return e; } #endif #endif *************** *** 89,184 **** /*************************************************************************************************/ ! #define ADOBE_DEFINE_BITSET_OPS(EnumType) \ ! inline EnumType operator~(EnumType a) \ ! { \ ! return EnumType(~adobe::implementation::promote_enum(a)); \ ! } \ ! \ ! inline EnumType operator|(EnumType lhs, EnumType rhs) \ ! { \ ! return EnumType(adobe::implementation::promote_enum(lhs) | adobe::implementation::promote_enum(rhs)); \ ! } \ ! \ ! inline EnumType operator&(EnumType lhs, EnumType rhs) \ ! { \ ! return EnumType(adobe::implementation::promote_enum(lhs) & adobe::implementation::promote_enum(rhs)); \ ! } \ ! \ ! inline EnumType operator^(EnumType lhs, EnumType rhs) \ ! { \ ! return EnumType(adobe::implementation::promote_enum(lhs) ^ adobe::implementation::promote_enum(rhs)); \ ! } \ ! \ ! inline EnumType& operator&=(EnumType& lhs, EnumType rhs) \ ! { \ ! return lhs = lhs & rhs; \ ! } \ ! \ ! inline EnumType& operator|=(EnumType& lhs, EnumType rhs) \ ! { \ ! return lhs = lhs | rhs; \ ! } \ ! \ ! inline EnumType& operator^=(EnumType& lhs, EnumType rhs) \ ! { \ ! return lhs = lhs ^ rhs; \ } /*************************************************************************************************/ ! #define ADOBE_DEFINE_ARITHMETIC_OPS(EnumType) \ ! inline EnumType operator-(EnumType a) \ ! { \ ! return EnumType(-a); \ ! } \ ! \ ! inline EnumType operator+(EnumType lhs, EnumType rhs) \ ! { \ ! return EnumType(adobe::implementation::promote_enum(lhs) + adobe::implementation::promote_enum(rhs)); \ ! } \ ! \ ! inline EnumType operator-(EnumType lhs, EnumType rhs) \ ! { \ ! return EnumType(adobe::implementation::promote_enum(lhs) - adobe::implementation::promote_enum(rhs)); \ ! } \ ! \ ! inline EnumType operator*(EnumType lhs, EnumType rhs) \ ! { \ ! return EnumType(adobe::implementation::promote_enum(lhs) * adobe::implementation::promote_enum(rhs)); \ ! } \ ! \ ! inline EnumType operator/(EnumType lhs, EnumType rhs) \ ! { \ ! return EnumType(adobe::implementation::promote_enum(lhs) / adobe::implementation::promote_enum(rhs)); \ ! } \ ! \ ! inline EnumType operator%(EnumType lhs, EnumType rhs) \ ! { \ ! return EnumType(adobe::implementation::promote_enum(lhs) % adobe::implementation::promote_enum(rhs)); \ ! } \ ! \ ! inline EnumType& operator+=(EnumType& lhs, EnumType rhs) \ ! { \ ! return lhs = lhs + rhs; \ ! } \ ! \ ! inline EnumType& operator-=(EnumType& lhs, EnumType rhs) \ ! { \ ! return lhs = lhs - rhs; \ ! } \ ! \ ! inline EnumType& operator*=(EnumType& lhs, EnumType rhs) \ ! { \ ! return lhs = lhs * rhs; \ ! } \ ! \ ! inline EnumType& operator/=(EnumType& lhs, EnumType rhs) \ ! { \ ! return lhs = lhs / rhs; \ ! } \ ! \ ! inline EnumType& operator%=(EnumType& lhs, EnumType rhs) \ ! { \ ! return lhs = lhs % rhs; \ } --- 89,184 ---- /*************************************************************************************************/ ! #define ADOBE_DEFINE_BITSET_OPS(EnumType) \ ! inline EnumType operator~(EnumType a) \ ! { \ ! return EnumType(~adobe::implementation::promote_enum(a)); \ ! } \ ! \ ! inline EnumType operator|(EnumType lhs, EnumType rhs) \ ! { \ ! return EnumType(adobe::implementation::promote_enum(lhs) | adobe::implementation::promote_enum(rhs)); \ ! } \ ! \ ! inline EnumType operator&(EnumType lhs, EnumType rhs) \ ! { \ ! return EnumType(adobe::implementation::promote_enum(lhs) & adobe::implementation::promote_enum(rhs)); \ ! } \ ! \ ! inline EnumType operator^(EnumType lhs, EnumType rhs) \ ! { \ ! return EnumType(adobe::implementation::promote_enum(lhs) ^ adobe::implementation::promote_enum(rhs)); \ ! } \ ! \ ! inline EnumType& operator&=(EnumType& lhs, EnumType rhs) \ ! { \ ! return lhs = lhs & rhs; \ ! } \ ! \ ! inline EnumType& operator|=(EnumType& lhs, EnumType rhs) \ ! { \ ! return lhs = lhs | rhs; \ ! } \ ! \ ! inline EnumType& operator^=(EnumType& lhs, EnumType rhs) \ ! { \ ! return lhs = lhs ^ rhs; \ } /*************************************************************************************************/ ! #define ADOBE_DEFINE_ARITHMETIC_OPS(EnumType) \ ! inline EnumType operator-(EnumType a) \ ! { \ ! return EnumType(-a); \ ! } \ ! \ ! inline EnumType operator+(EnumType lhs, EnumType rhs) \ ! { \ ! return EnumType(adobe::implementation::promote_enum(lhs) + adobe::implementation::promote_enum(rhs)); \ ! } \ ! \ ! inline EnumType operator-(EnumType lhs, EnumType rhs) \ ! { \ ! return EnumType(adobe::implementation::promote_enum(lhs) - adobe::implementation::promote_enum(rhs)); \ ! } \ ! \ ! inline EnumType operator*(EnumType lhs, EnumType rhs) \ ! { \ ! return EnumType(adobe::implementation::promote_enum(lhs) * adobe::implementation::promote_enum(rhs)); \ ! } \ ! \ ! inline EnumType operator/(EnumType lhs, EnumType rhs) \ ! { \ ! return EnumType(adobe::implementation::promote_enum(lhs) / adobe::implementation::promote_enum(rhs)); \ ! } \ ! \ ! inline EnumType operator%(EnumType lhs, EnumType rhs) \ ! { \ ! return EnumType(adobe::implementation::promote_enum(lhs) % adobe::implementation::promote_enum(rhs)); \ ! } \ ! \ ! inline EnumType& operator+=(EnumType& lhs, EnumType rhs) \ ! { \ ! return lhs = lhs + rhs; \ ! } \ ! \ ! inline EnumType& operator-=(EnumType& lhs, EnumType rhs) \ ! { \ ! return lhs = lhs - rhs; \ ! } \ ! \ ! inline EnumType& operator*=(EnumType& lhs, EnumType rhs) \ ! { \ ! return lhs = lhs * rhs; \ ! } \ ! \ ! inline EnumType& operator/=(EnumType& lhs, EnumType rhs) \ ! { \ ! return lhs = lhs / rhs; \ ! } \ ! \ ! inline EnumType& operator%=(EnumType& lhs, EnumType rhs) \ ! { ... [truncated message content] |