|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r57555 - trunk/boost/gil/extension/dynamic_image
From: chhenning_at_[hidden]
Date: 2009-11-10 14:56:18
Author: chhenning
Date: 2009-11-10 14:56:17 EST (Tue, 10 Nov 2009)
New Revision: 57555
URL: http://svn.boost.org/trac/boost/changeset/57555
Log:
Added missing code to now be able to override apply_operation with a dynamic image ( variant ) AND a separate Info object. This fix enables such functionality.
Text files modified:
trunk/boost/gil/extension/dynamic_image/apply_operation_base.hpp | 23 +++++++++++++++++++++++
trunk/boost/gil/extension/dynamic_image/variant.hpp | 3 +++
2 files changed, 26 insertions(+), 0 deletions(-)
Modified: trunk/boost/gil/extension/dynamic_image/apply_operation_base.hpp
==============================================================================
--- trunk/boost/gil/extension/dynamic_image/apply_operation_base.hpp (original)
+++ trunk/boost/gil/extension/dynamic_image/apply_operation_base.hpp 2009-11-10 14:56:17 EST (Tue, 10 Nov 2009)
@@ -69,6 +69,9 @@
#define GIL_FWD_CASE(z, N, SUM) case N: return op(*gil_reinterpret_cast<typename mpl::deref<T##N>::type*>(&bits));
#define GIL_FWD_CONST_CASE(z, N, SUM) case N: return op(*gil_reinterpret_cast_c<const typename mpl::deref<T##N>::type*>(&bits));
+#define GIL_FWD_CASE_WITH_INFO(z, N, SUM) case N: return op(*gil_reinterpret_cast<typename mpl::deref<T##N>::type*>(&bits), info);
+#define GIL_FWD_CONST_CASE_WITH_INFO(z, N, SUM) case N: return op(*gil_reinterpret_cast_c<const typename mpl::deref<T##N>::type*>(&bits), info);
+
#define GIL_APPLY_FWD_OP(z, N, text) \
template <> struct apply_operation_fwd_fn<BOOST_PP_ADD(N,1)> { \
template <typename Types, typename Bits, typename UnaryOp> \
@@ -91,6 +94,26 @@
} \
throw; \
} \
+ template <typename Types, typename Info, typename Bits, typename UnaryOp> \
+ typename UnaryOp::result_type apply(Bits& bits, std::size_t index, const Info& info, UnaryOp op) const { \
+ typedef typename mpl::begin<Types>::type \
+ BOOST_PP_REPEAT(N, GIL_FWD_TYPEDEFS, BOOST_PP_EMPTY) \
+ T##N; \
+ switch (index) { \
+ BOOST_PP_REPEAT(BOOST_PP_ADD(N,1), GIL_FWD_CASE_WITH_INFO, BOOST_PP_EMPTY) \
+ } \
+ throw; \
+ } \
+ template <typename Types, typename Bits, typename Info, typename UnaryOp> \
+ typename UnaryOp::result_type applyc(const Bits& bits, std::size_t index, const Info& info, UnaryOp op) const { \
+ typedef typename mpl::begin<Types>::type \
+ BOOST_PP_REPEAT(N, GIL_FWD_TYPEDEFS, BOOST_PP_EMPTY) \
+ T##N; \
+ switch (index) { \
+ BOOST_PP_REPEAT(BOOST_PP_ADD(N,1), GIL_FWD_CONST_CASE_WITH_INFO,BOOST_PP_EMPTY) \
+ } \
+ throw; \
+ } \
};
#define GIL_GENERATE_APPLY_FWD_OPS(N) BOOST_PP_REPEAT(N, GIL_APPLY_FWD_OP, BOOST_PP_EMPTY)
Modified: trunk/boost/gil/extension/dynamic_image/variant.hpp
==============================================================================
--- trunk/boost/gil/extension/dynamic_image/variant.hpp (original)
+++ trunk/boost/gil/extension/dynamic_image/variant.hpp 2009-11-10 14:56:17 EST (Tue, 10 Nov 2009)
@@ -119,6 +119,9 @@
template <typename T> bool current_type_is() const { return type_id<T>()==_index; }
+ base_t bits() const { return _bits; }
+ std::size_t index() const { return _index; }
+
private:
template <typename T> static std::size_t type_id() { return detail::type_to_index<Types,T>::value; }
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk