Boost GIL


apply_operation.hpp
1 //
2 // Copyright 2005-2007 Adobe Systems Incorporated
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_EXTENSION_DYNAMIC_IMAGE_APPLY_OPERATION_HPP
9 #define BOOST_GIL_EXTENSION_DYNAMIC_IMAGE_APPLY_OPERATION_HPP
10 
11 #include <boost/gil/extension/dynamic_image/apply_operation_base.hpp>
12 #include <boost/gil/extension/dynamic_image/variant.hpp>
13 
14 #ifdef BOOST_GIL_DOXYGEN_ONLY
15 #undef BOOST_GIL_REDUCE_CODE_BLOAT
16 #endif
17 
18 // Implements apply_operation for variants.
19 // Optionally performs type reduction.
20 #ifdef BOOST_GIL_REDUCE_CODE_BLOAT
21 
22 #include <boost/gil/extension/dynamic_image/reduce.hpp>
23 
24 #else
25 
26 namespace boost { namespace gil {
27 
30 template <typename Types, typename UnaryOp> BOOST_FORCEINLINE
31 typename UnaryOp::result_type apply_operation(variant<Types>& arg, UnaryOp op) {
32  return apply_operation_base<Types>(arg._bits, arg._index ,op);
33 }
34 
37 template <typename Types, typename UnaryOp> BOOST_FORCEINLINE
38 typename UnaryOp::result_type apply_operation(const variant<Types>& arg, UnaryOp op) {
39  return apply_operation_basec<Types>(arg._bits, arg._index ,op);
40 }
41 
44 template <typename Types1, typename Types2, typename BinaryOp> BOOST_FORCEINLINE
45 typename BinaryOp::result_type apply_operation(const variant<Types1>& arg1, const variant<Types2>& arg2, BinaryOp op) {
46  return apply_operation_base<Types1,Types2>(arg1._bits, arg1._index, arg2._bits, arg2._index, op);
47 }
48 
49 }} // namespace boost::gil
50 
51 #endif // defined(BOOST_GIL_REDUCE_CODE_BLOAT)
52 
53 #endif
BOOST_FORCEINLINE BinaryOp::result_type apply_operation(const variant< Types1 > &arg1, const variant< Types2 > &arg2, BinaryOp op)
Invokes a generic constant operation (represented as a binary function object) on two variants...
Definition: apply_operation.hpp:45
Represents a concrete instance of a run-time specified type from a set of typesA concept is typically...
Definition: variant.hpp:80