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