Boost GIL


read_image_info.hpp
1 //
2 // Copyright 2007-2012 Christian Henning, Andreas Pokorny, Lubomir Bourdev
3 //
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
7 //
8 #ifndef BOOST_GIL_IO_READ_IMAGE_INFO_HPP
9 #define BOOST_GIL_IO_READ_IMAGE_INFO_HPP
10 
11 #include <boost/gil/io/base.hpp>
12 #include <boost/gil/io/device.hpp>
13 #include <boost/gil/io/get_reader.hpp>
14 #include <boost/gil/io/path_spec.hpp>
15 
16 #include <boost/mpl/and.hpp>
17 #include <boost/type_traits/is_base_and_derived.hpp>
18 
19 #include <type_traits>
20 
21 namespace boost{ namespace gil {
22 
24 
30 template <typename Device, typename FormatTag>
31 inline
32 auto read_image_info(Device& file, image_read_settings<FormatTag> const& settings,
33  typename std::enable_if
34  <
35  mpl::and_
36  <
37  detail::is_adaptable_input_device<FormatTag, Device>,
38  is_format_tag<FormatTag>
39  >::value
40  >::type* /*dummy*/ = nullptr)
42 {
43  return make_reader_backend(file, settings);
44 }
45 
51 template <typename Device, typename FormatTag>
52 inline
53 auto read_image_info(Device& file, FormatTag const&,
54  typename std::enable_if
55  <
56  mpl::and_
57  <
58  detail::is_adaptable_input_device<FormatTag, Device>,
59  is_format_tag<FormatTag>
60  >::value
61  >::type* /*dummy*/ = nullptr)
63 {
64  return read_image_info(file, image_read_settings<FormatTag>());
65 }
66 
72 template <typename String, typename FormatTag>
73 inline
74 auto read_image_info(
75  String const& file_name, image_read_settings<FormatTag> const& settings,
76  typename std::enable_if
77  <
78  mpl::and_
79  <
80  is_format_tag<FormatTag>,
81  detail::is_supported_path_spec<String>
82  >::value
83  >::type* /*dummy*/ = nullptr)
85 {
86  return make_reader_backend(file_name, settings);
87 }
88 
94 template <typename String, typename FormatTag>
95 inline
96 auto read_image_info(String const& file_name, FormatTag const&,
97  typename std::enable_if
98  <
99  mpl::and_
100  <
101  is_format_tag<FormatTag>,
102  detail::is_supported_path_spec<String>
103  >::value
104  >::type* /*dummy*/ = nullptr)
106 {
107  return read_image_info(file_name, image_read_settings<FormatTag>());
108 }
109 
110 }} // namespace boost::gil
111 
112 #endif
Helper metafunction to generate image backend type.
Definition: get_reader.hpp:115
Definition: algorithm.hpp:30
auto read_image_info(Device &file, image_read_settings< FormatTag > const &settings, typename std::enable_if< mpl::and_< detail::is_adaptable_input_device< FormatTag, Device >, is_format_tag< FormatTag > >::value >::type *=nullptr) -> typename get_reader_backend< Device, FormatTag >::type
Returns the image format backend. Backend is format specific.
Definition: read_image_info.hpp:32