tag.hpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
  3. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
  4. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
  5. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
  6. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
  7. // Use, modification and distribution is subject to the Boost Software License,
  8. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  9. // http://www.boost.org/LICENSE_1_0.txt)
  10. #ifndef BOOST_GEOMETRY_CORE_TAG_HPP
  11. #define BOOST_GEOMETRY_CORE_TAG_HPP
  12. #include <boost/geometry/core/tags.hpp>
  13. #include <boost/geometry/util/bare_type.hpp>
  14. namespace boost { namespace geometry
  15. {
  16. namespace traits
  17. {
  18. /*!
  19. \brief Traits class to attach a tag to a geometry
  20. \details All geometries should implement a traits::tag<G>::type metafunction to indicate their
  21. own geometry type.
  22. \ingroup traits
  23. \par Geometries:
  24. - all geometries
  25. \par Specializations should provide:
  26. - typedef XXX_tag type; (point_tag, box_tag, ...)
  27. \tparam Geometry geometry
  28. */
  29. template <typename Geometry, typename Enable = void>
  30. struct tag
  31. {
  32. typedef void type;
  33. };
  34. } // namespace traits
  35. /*!
  36. \brief \brief_meta{type, tag, \meta_geometry_type}
  37. \details With Boost.Geometry, tags are the driving force of the tag dispatching
  38. mechanism. The tag metafunction is therefore used in every free function.
  39. \tparam Geometry \tparam_geometry
  40. \ingroup core
  41. \qbk{[include reference/core/tag.qbk]}
  42. */
  43. template <typename Geometry>
  44. struct tag
  45. {
  46. typedef typename traits::tag
  47. <
  48. typename geometry::util::bare_type<Geometry>::type
  49. >::type type;
  50. };
  51. }} // namespace boost::geometry
  52. #endif // BOOST_GEOMETRY_CORE_TAG_HPP