interval_traits.hpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Boost.Polygon library interval_traits.hpp header file
  2. // Copyright (c) Intel Corporation 2008.
  3. // Copyright (c) 2008-2012 Simonson Lucanus.
  4. // Copyright (c) 2012-2012 Andrii Sydorchuk.
  5. // See http://www.boost.org for updates, documentation, and revision history.
  6. // Use, modification and distribution is subject to the Boost Software License,
  7. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  8. // http://www.boost.org/LICENSE_1_0.txt)
  9. #ifndef BOOST_POLYGON_INTERVAL_TRAITS_HPP
  10. #define BOOST_POLYGON_INTERVAL_TRAITS_HPP
  11. #include "isotropy.hpp"
  12. namespace boost {
  13. namespace polygon {
  14. template <typename Interval>
  15. struct interval_traits {
  16. typedef Interval interval_type;
  17. typedef typename interval_type::coordinate_type coordinate_type;
  18. static coordinate_type get(const interval_type& interval, direction_1d dir) {
  19. return interval.get(dir);
  20. }
  21. };
  22. template <typename Interval>
  23. struct interval_mutable_traits {
  24. typedef Interval interval_type;
  25. typedef typename interval_type::coordinate_type coordinate_type;
  26. static void set(
  27. interval_type& interval, direction_1d dir, coordinate_type value) {
  28. interval.set(dir, value);
  29. }
  30. static interval_type construct(coordinate_type low, coordinate_type high) {
  31. return interval_type(low, high);
  32. }
  33. };
  34. } // polygon
  35. } // boost
  36. #endif // BOOST_POLICY_INTERVAL_TRAITS_HPP