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_WRITER_HPP
0009 #define BOOST_GIL_IO_GET_WRITER_HPP
0010 
0011 #include <boost/gil/detail/mp11.hpp>
0012 #include <boost/gil/io/get_write_device.hpp>
0013 
0014 #include <type_traits>
0015 
0016 namespace boost { namespace gil {
0017 
0018 /// \brief Helper metafunction to generate writer type.
0019 template <typename T, typename FormatTag, class Enable = void>
0020 struct get_writer {};
0021 
0022 
0023 template <typename String, typename FormatTag>
0024 struct get_writer
0025 <
0026     String,
0027     FormatTag,
0028     typename std::enable_if
0029     <
0030         mp11::mp_and
0031         <
0032             detail::is_supported_path_spec<String>,
0033             is_format_tag<FormatTag>
0034         >::value
0035     >::type
0036 >
0037 {
0038     using device_t = typename get_write_device<String, FormatTag>::type;
0039     using type = writer<device_t, FormatTag>;
0040 };
0041 
0042 template <typename Device, typename FormatTag>
0043 struct get_writer
0044 <
0045     Device,
0046     FormatTag,
0047     typename std::enable_if
0048     <
0049         mp11::mp_and
0050         <
0051             detail::is_adaptable_output_device<FormatTag, Device>,
0052             is_format_tag<FormatTag>
0053         >::value
0054     >::type
0055 >
0056 {
0057     using device_t = typename get_write_device<Device, FormatTag>::type;
0058     using type = writer<device_t, FormatTag>;
0059 };
0060 
0061 /// \brief Helper metafunction to generate dynamic image writer type.
0062 template <typename T, typename FormatTag, class Enable = void>
0063 struct get_dynamic_image_writer {};
0064 
0065 template <typename String, typename FormatTag>
0066 struct get_dynamic_image_writer
0067 <
0068     String,
0069     FormatTag,
0070     typename std::enable_if
0071     <
0072         mp11::mp_and
0073         <
0074             detail::is_supported_path_spec<String>,
0075             is_format_tag<FormatTag>
0076         >::value
0077     >::type
0078 >
0079 {
0080     using device_t = typename get_write_device<String, FormatTag>::type;
0081     using type = dynamic_image_writer<device_t, FormatTag>;
0082 };
0083 
0084 template <typename Device, typename FormatTag>
0085 struct get_dynamic_image_writer
0086 <
0087     Device,
0088     FormatTag,
0089     typename std::enable_if
0090     <
0091         mp11::mp_and
0092         <
0093             detail::is_write_device<FormatTag, Device>,
0094             is_format_tag<FormatTag>
0095         >::value
0096     >::type
0097 >
0098 {
0099     using device_t = typename get_write_device<Device, FormatTag>::type;
0100     using type = dynamic_image_writer<device_t, FormatTag>;
0101 };
0102 
0103 }} // namespace boost::gil
0104 
0105 #endif