Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:37:03

0001 //
0002 // Copyright 2012 Christian Henning
0003 //
0004 // Distributed under the Boost Software License, Version 1.0
0005 // See accompanying file LICENSE_1_0.txt or copy at
0006 // http://www.boost.org/LICENSE_1_0.txt
0007 //
0008 #ifndef BOOST_GIL_IO_GET_READER_HPP
0009 #define BOOST_GIL_IO_GET_READER_HPP
0010 
0011 #include <boost/gil/io/get_read_device.hpp>
0012 #include <boost/gil/detail/mp11.hpp>
0013 
0014 #include <type_traits>
0015 
0016 namespace boost { namespace gil {
0017 
0018 /// \brief Helper metafunction to generate image reader type.
0019 template
0020 <
0021     typename T,
0022     typename FormatTag,
0023     typename ConversionPolicy,
0024     class Enable = void
0025 >
0026 struct get_reader {};
0027 
0028 template <typename String, typename FormatTag, typename ConversionPolicy>
0029 struct get_reader
0030 <
0031     String,
0032     FormatTag,
0033     ConversionPolicy,
0034     typename std::enable_if
0035     <
0036         mp11::mp_and
0037         <
0038             detail::is_supported_path_spec<String>,
0039             is_format_tag<FormatTag>
0040         >::value
0041     >::type
0042 >
0043 {
0044     using device_t = typename get_read_device<String, FormatTag>::type;
0045     using type = reader<device_t, FormatTag, ConversionPolicy>;
0046 };
0047 
0048 template <typename Device, typename FormatTag, typename ConversionPolicy>
0049 struct get_reader
0050 <
0051     Device,
0052     FormatTag,
0053     ConversionPolicy,
0054     typename std::enable_if
0055     <
0056         mp11::mp_and
0057         <
0058             detail::is_adaptable_input_device<FormatTag, Device>,
0059             is_format_tag<FormatTag>
0060         >::value
0061     >::type
0062 >
0063 {
0064     using device_t = typename get_read_device<Device, FormatTag>::type;
0065     using type = reader<device_t, FormatTag, ConversionPolicy>;
0066 };
0067 
0068 /// \brief Helper metafunction to generate dynamic image reader type.
0069 template <typename T, typename FormatTag, class Enable = void>
0070 struct get_dynamic_image_reader
0071 {
0072 };
0073 
0074 template <typename String, typename FormatTag>
0075 struct get_dynamic_image_reader
0076 <
0077     String,
0078     FormatTag,
0079     typename std::enable_if
0080     <
0081         mp11::mp_and
0082         <
0083             detail::is_supported_path_spec<String>,
0084             is_format_tag<FormatTag>
0085         >::value
0086     >::type
0087 >
0088 {
0089     using device_t = typename get_read_device<String, FormatTag>::type;
0090     using type = dynamic_image_reader<device_t, FormatTag>;
0091 };
0092 
0093 template <typename Device, typename FormatTag>
0094 struct get_dynamic_image_reader
0095 <
0096     Device,
0097     FormatTag,
0098     typename std::enable_if
0099     <
0100         mp11::mp_and
0101         <
0102             detail::is_adaptable_input_device<FormatTag, Device>,
0103             is_format_tag<FormatTag>
0104         >::value
0105     >::type
0106 >
0107 {
0108     using device_t = typename get_read_device<Device, FormatTag>::type;
0109     using type = dynamic_image_reader<device_t, FormatTag>;
0110 };
0111 
0112 /// \brief Helper metafunction to generate image backend type.
0113 template <typename T, typename FormatTag, class Enable = void>
0114 struct get_reader_backend
0115 {
0116 };
0117 
0118 template <typename String, typename FormatTag>
0119 struct get_reader_backend
0120 <
0121     String,
0122     FormatTag,
0123     typename std::enable_if
0124     <
0125         mp11::mp_and
0126         <
0127             detail::is_supported_path_spec<String>,
0128             is_format_tag<FormatTag>
0129         >::value
0130     >::type
0131 >
0132 {
0133     using device_t = typename get_read_device<String, FormatTag>::type;
0134     using type = reader_backend<device_t, FormatTag>;
0135 };
0136 
0137 template <typename Device, typename FormatTag>
0138 struct get_reader_backend
0139 <
0140     Device,
0141     FormatTag,
0142     typename std::enable_if
0143     <
0144         mp11::mp_and
0145         <
0146             detail::is_adaptable_input_device<FormatTag, Device>,
0147             is_format_tag<FormatTag>
0148         >::value
0149     >::type
0150 >
0151 {
0152     using device_t = typename get_read_device<Device, FormatTag>::type;
0153     using type = reader_backend<device_t, FormatTag>;
0154 };
0155 
0156 /// \brief Helper metafunction to generate image scanline_reader type.
0157 template <typename T, typename FormatTag>
0158 struct get_scanline_reader
0159 {
0160     using device_t = typename get_read_device<T, FormatTag>::type;
0161     using type = scanline_reader<device_t, FormatTag>;
0162 };
0163 
0164 } // namespace gil
0165 } // namespace boost
0166 
0167 #endif