Boost GIL


get_write_device.hpp
1 //
2 // Copyright 2012 Christian Henning
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_GET_WRITE_DEVICE_HPP
9 #define BOOST_GIL_IO_GET_WRITE_DEVICE_HPP
10 
11 #include <boost/gil/io/device.hpp>
12 #include <boost/gil/io/path_spec.hpp>
13 
14 #include <boost/mpl/and.hpp>
15 
16 #include <type_traits>
17 
18 namespace boost { namespace gil {
19 
20 template <typename T, typename FormatTag, class Enable = void>
21 struct get_write_device {};
22 
23 template <typename Device, typename FormatTag>
24 struct get_write_device
25 <
26  Device,
27  FormatTag,
28  typename std::enable_if
29  <
30  mpl::and_
31  <
32  detail::is_adaptable_output_device<FormatTag, Device>,
33  is_format_tag<FormatTag>
34  >::value
35  >::type
36 >
37 {
38  using type =
39  typename detail::is_adaptable_output_device<FormatTag, Device>::device_type;
40 };
41 
42 template <typename String, typename FormatTag>
43 struct get_write_device
44 <
45  String,
46  FormatTag,
47  typename std::enable_if
48  <
49  mpl::and_
50  <
51  detail::is_supported_path_spec<String>,
52  is_format_tag<FormatTag>
53  >::value
54  >::type
55 >
56 {
57  using type = detail::file_stream_device<FormatTag>;
58 };
59 
60 }} // namespace boost::gil
61 
62 #endif
Definition: algorithm.hpp:30
Definition: algorithm.hpp:127