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/detail/mp11.hpp>
12 #include <boost/gil/io/device.hpp>
13 #include <boost/gil/io/path_spec.hpp>
14 
15 #include <type_traits>
16 
17 namespace boost { namespace gil {
18 
19 template< typename T
20  , typename FormatTag
21  , class Enable = void
22  >
23 struct get_read_device
24 {};
25 
26 template <typename Device, typename FormatTag>
27 struct get_read_device
28 <
29  Device,
30  FormatTag,
31  typename std::enable_if
32  <
33  mp11::mp_and
34  <
35  detail::is_adaptable_input_device<FormatTag, Device>,
36  is_format_tag<FormatTag>
37  >::value
38  >::type
39 >
40 {
41  using type = typename detail::is_adaptable_input_device
42  <
43  FormatTag,
44  Device
45  >::device_type;
46 };
47 
48 template <typename String, typename FormatTag>
49 struct get_read_device
50 <
51  String,
52  FormatTag,
53  typename std::enable_if
54  <
55  mp11::mp_and
56  <
57  detail::is_supported_path_spec<String>,
58  is_format_tag<FormatTag>
59  >::value
60  >::type
61 >
62 {
63  using type = detail::file_stream_device<FormatTag>;
64 };
65 
66 } // namespace gil
67 } // namespace boost
68 
69 #endif
defined(BOOST_NO_CXX17_HDR_MEMORY_RESOURCE)
Definition: algorithm.hpp:36