Boost GIL


get_read_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_READ_DEVICE_HPP
9 #define BOOST_GIL_IO_GET_READ_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
21  , typename FormatTag
22  , class Enable = void
23  >
24 struct get_read_device
25 {};
26 
27 template <typename Device, typename FormatTag>
28 struct get_read_device
29 <
30  Device,
31  FormatTag,
32  typename std::enable_if
33  <
34  mpl::and_
35  <
36  detail::is_adaptable_input_device<FormatTag, Device>,
37  is_format_tag<FormatTag>
38  >::value
39  >::type
40 >
41 {
42  using type = typename detail::is_adaptable_input_device
43  <
44  FormatTag,
45  Device
46  >::device_type;
47 };
48 
49 template <typename String, typename FormatTag>
50 struct get_read_device
51 <
52  String,
53  FormatTag,
54  typename std::enable_if
55  <
56  mpl::and_
57  <
58  detail::is_supported_path_spec<String>,
59  is_format_tag<FormatTag>
60  >::value
61  >::type
62 >
63 {
64  using type = detail::file_stream_device<FormatTag>;
65 };
66 
67 } // namespace gil
68 } // namespace boost
69 
70 #endif
Definition: algorithm.hpp:30
Definition: algorithm.hpp:127