read_image_info.hpp 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /*
  2. Copyright 2007-2012 Christian Henning, Andreas Pokorny, Lubomir Bourdev
  3. Use, modification and distribution are subject to the Boost Software License,
  4. Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  5. http://www.boost.org/LICENSE_1_0.txt).
  6. */
  7. /*************************************************************************************************/
  8. #ifndef BOOST_GIL_IO_READ_IMAGE_INFO_HPP
  9. #define BOOST_GIL_IO_READ_IMAGE_INFO_HPP
  10. ////////////////////////////////////////////////////////////////////////////////////////
  11. /// \file
  12. /// \brief
  13. /// \author Christian Henning, Andreas Pokorny, Lubomir Bourdev \n
  14. ///
  15. /// \date 2007-2012 \n
  16. ///
  17. ////////////////////////////////////////////////////////////////////////////////////////
  18. #include <boost/type_traits/is_base_and_derived.hpp>
  19. #include <boost/mpl/and.hpp>
  20. #include <boost/utility/enable_if.hpp>
  21. #include <boost/gil/io/base.hpp>
  22. #include <boost/gil/io/device.hpp>
  23. #include <boost/gil/io/path_spec.hpp>
  24. namespace boost{ namespace gil {
  25. /// \ingroup IO
  26. /// \brief Returns the image format backend. Backend is format specific.
  27. /// \param file It's a device. Must satisfy is_adaptable_input_device metafunction.
  28. /// \param settings Specifies read settings depending on the image format.
  29. /// \return image_read_info object dependent on the image format.
  30. /// \throw std::ios_base::failure
  31. template< typename Device
  32. , typename FormatTag
  33. >
  34. inline
  35. typename get_reader_backend< Device
  36. , FormatTag
  37. >::type
  38. read_image_info( Device& file
  39. , const image_read_settings< FormatTag >& settings
  40. , typename enable_if< mpl::and_< detail::is_adaptable_input_device< FormatTag
  41. , Device
  42. >
  43. , is_format_tag< FormatTag >
  44. >
  45. >::type* /* ptr */ = 0
  46. )
  47. {
  48. return make_reader_backend( file, settings );
  49. }
  50. /// \brief Returns the image format backend. Backend is format specific.
  51. /// \param file It's a device. Must satisfy is_adaptable_input_device metafunction.
  52. /// \param tag Defines the image format. Must satisfy is_format_tag metafunction.
  53. /// \return image_read_info object dependent on the image format.
  54. /// \throw std::ios_base::failure
  55. template< typename Device
  56. , typename FormatTag
  57. >
  58. inline
  59. typename get_reader_backend< Device
  60. , FormatTag
  61. >::type
  62. read_image_info( Device& file
  63. , const FormatTag&
  64. , typename enable_if< mpl::and_< detail::is_adaptable_input_device< FormatTag
  65. , Device
  66. >
  67. , is_format_tag< FormatTag >
  68. >
  69. >::type* /* ptr */ = 0
  70. )
  71. {
  72. return read_image_info( file
  73. , image_read_settings< FormatTag >()
  74. );
  75. }
  76. /// \brief Returns the image format backend. Backend is format specific.
  77. /// \param file_name File name. Must satisfy is_supported_path_spec metafunction.
  78. /// \param settings Specifies read settings depending on the image format.
  79. /// \return image_read_info object dependent on the image format.
  80. /// \throw std::ios_base::failure
  81. template< typename String
  82. , typename FormatTag
  83. >
  84. inline
  85. typename get_reader_backend< String
  86. , FormatTag
  87. >::type
  88. read_image_info( const String& file_name
  89. , const image_read_settings< FormatTag >& settings
  90. , typename enable_if< mpl::and_< is_format_tag< FormatTag >
  91. , detail::is_supported_path_spec< String >
  92. >
  93. >::type* /* ptr */ = 0
  94. )
  95. {
  96. return make_reader_backend( file_name, settings );
  97. }
  98. /// \brief Returns the image format backend. Backend is format specific.
  99. /// \param file_name File name. Must satisfy is_supported_path_spec metafunction.
  100. /// \param tag Defines the image format. Must satisfy is_format_tag metafunction.
  101. /// \return image_read_info object dependent on the image format.
  102. /// \throw std::ios_base::failure
  103. template< typename String
  104. , typename FormatTag
  105. >
  106. inline
  107. typename get_reader_backend< String
  108. , FormatTag
  109. >::type
  110. read_image_info( const String& file_name
  111. , const FormatTag&
  112. , typename enable_if< mpl::and_< is_format_tag< FormatTag >
  113. , detail::is_supported_path_spec< String >
  114. >
  115. >::type* /* ptr */ = 0
  116. )
  117. {
  118. return read_image_info( file_name
  119. , image_read_settings< FormatTag >()
  120. );
  121. }
  122. } // namespace gil
  123. } // namespace boost
  124. #endif