Chris@16
|
1 /*
|
Chris@16
|
2 Copyright 2005-2007 Adobe Systems Incorporated
|
Chris@16
|
3
|
Chris@16
|
4 Use, modification and distribution are subject to the Boost Software License,
|
Chris@16
|
5 Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
6 http://www.boost.org/LICENSE_1_0.txt).
|
Chris@16
|
7
|
Chris@16
|
8 See http://opensource.adobe.com/gil for most recent version including documentation.
|
Chris@16
|
9 */
|
Chris@16
|
10
|
Chris@16
|
11 /*************************************************************************************************/
|
Chris@16
|
12
|
Chris@16
|
13 #ifndef GIL_APPLY_OPERATION_HPP
|
Chris@16
|
14 #define GIL_APPLY_OPERATION_HPP
|
Chris@16
|
15
|
Chris@16
|
16 ////////////////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
17 /// \file
|
Chris@16
|
18 /// \brief Implements apply_operation for variants. Optionally performs type reduction
|
Chris@16
|
19 /// \author Lubomir Bourdev and Hailin Jin \n
|
Chris@16
|
20 /// Adobe Systems Incorporated
|
Chris@16
|
21 /// \date 2005-2007 \n Last updated on May 4, 2006
|
Chris@16
|
22 ///
|
Chris@16
|
23 ////////////////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
24
|
Chris@16
|
25 #include "apply_operation_base.hpp"
|
Chris@16
|
26 #include "variant.hpp"
|
Chris@16
|
27
|
Chris@16
|
28 #ifndef GIL_REDUCE_CODE_BLOAT
|
Chris@16
|
29
|
Chris@16
|
30 namespace boost { namespace gil {
|
Chris@16
|
31
|
Chris@16
|
32 /// \ingroup Variant
|
Chris@16
|
33 /// \brief Invokes a generic mutable operation (represented as a unary function object) on a variant
|
Chris@16
|
34 template <typename Types, typename UnaryOp> GIL_FORCEINLINE
|
Chris@16
|
35 typename UnaryOp::result_type apply_operation(variant<Types>& arg, UnaryOp op) {
|
Chris@16
|
36 return apply_operation_base<Types>(arg._bits, arg._index ,op);
|
Chris@16
|
37 }
|
Chris@16
|
38
|
Chris@16
|
39 /// \ingroup Variant
|
Chris@16
|
40 /// \brief Invokes a generic constant operation (represented as a unary function object) on a variant
|
Chris@16
|
41 template <typename Types, typename UnaryOp> GIL_FORCEINLINE
|
Chris@16
|
42 typename UnaryOp::result_type apply_operation(const variant<Types>& arg, UnaryOp op) {
|
Chris@16
|
43 return apply_operation_basec<Types>(arg._bits, arg._index ,op);
|
Chris@16
|
44 }
|
Chris@16
|
45
|
Chris@16
|
46 /// \ingroup Variant
|
Chris@16
|
47 /// \brief Invokes a generic constant operation (represented as a binary function object) on two variants
|
Chris@16
|
48 template <typename Types1, typename Types2, typename BinaryOp> GIL_FORCEINLINE
|
Chris@16
|
49 typename BinaryOp::result_type apply_operation(const variant<Types1>& arg1, const variant<Types2>& arg2, BinaryOp op) {
|
Chris@16
|
50 return apply_operation_base<Types1,Types2>(arg1._bits, arg1._index, arg2._bits, arg2._index, op);
|
Chris@16
|
51 }
|
Chris@16
|
52
|
Chris@16
|
53 } } // namespace boost::gil
|
Chris@16
|
54
|
Chris@16
|
55 #else
|
Chris@16
|
56
|
Chris@16
|
57 #include "reduce.hpp"
|
Chris@16
|
58
|
Chris@16
|
59 #endif
|
Chris@16
|
60
|
Chris@16
|
61 #endif
|