Imported Upstream version 1.72.0
[platform/upstream/boost.git] / boost / gil / detail / is_channel_integral.hpp
1 //
2 // Copyright 2019 Mateusz Loskot <mateusz at loskot dot net>
3 // Copyright 2005-2007 Adobe Systems Incorporated
4 //
5 // Distributed under the Boost Software License, Version 1.0
6 // See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt
8 //
9 #ifndef BOOST_GIL_DETAIL_IS_CHANNEL_INTEGRAL_HPP
10 #define BOOST_GIL_DETAIL_IS_CHANNEL_INTEGRAL_HPP
11
12 #include <boost/gil/channel.hpp>
13
14 #include <type_traits>
15
16 namespace boost { namespace gil { namespace detail {
17
18 template <typename ChannelValue>
19 struct is_channel_integral : std::is_integral<ChannelValue> {};
20
21 template <int NumBits>
22 struct is_channel_integral<boost::gil::packed_channel_value<NumBits>> : std::true_type {};
23
24 template <typename BitField, int FirstBit, int NumBits, bool IsMutable>
25 struct is_channel_integral
26     <
27         boost::gil::packed_channel_reference<BitField, FirstBit, NumBits, IsMutable>
28     > : std::true_type
29 {};
30
31 template <typename BitField, int NumBits, bool IsMutable>
32 struct is_channel_integral
33     <
34         boost::gil::packed_dynamic_channel_reference<BitField, NumBits, IsMutable>
35     > : std::true_type
36 {};
37
38 template <typename BaseChannelValue, typename MinVal, typename MaxVal>
39 struct is_channel_integral
40     <
41         boost::gil::scoped_channel_value<BaseChannelValue, MinVal, MaxVal>
42     > : std::is_integral<BaseChannelValue>
43 {};
44
45 }}} //namespace boost::gil::detail
46
47 #endif