apply_operation_base.hpp File Reference


Detailed Description

Given an object with run-time specified type (denoted as an array of Bits, dynamic index, and a static set of Types) and a generic operation, casts the object to its appropriate type and applies the operation.

Author:
Lubomir Bourdev and Hailin Jin
Adobe Systems Incorporated
Date:
2005-2006
Last updated on May 4, 2006

#include "../../gil_config.hpp"
#include "../../utilities.hpp"
#include <boost/mpl/begin.hpp>
#include <boost/mpl/next.hpp>
#include <boost/mpl/deref.hpp>
#include <boost/mpl/size.hpp>
#include <boost/preprocessor/repeat.hpp>

Go to the source code of this file.


Namespaces

namespace  boost
namespace  boost::gil
namespace  boost::gil::detail

Defines

#define GIL_FWD_TYPEDEFS(z, N, text)   T##N; typedef typename mpl::next<T##N>::type
#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_APPLY_FWD_OP(z, N, text)
#define GIL_GENERATE_APPLY_FWD_OPS(N)   BOOST_PP_REPEAT(N, GIL_APPLY_FWD_OP, BOOST_PP_EMPTY)

Functions

template<typename Types, typename Bits, typename Op>
Op::result_type GIL_FORCEINLINE boost::gil::apply_operation_basec (const Bits &bits, std::size_t index, Op op)
template<typename Types, typename Bits, typename Op>
Op::result_type GIL_FORCEINLINE boost::gil::apply_operation_base (Bits &bits, std::size_t index, Op op)
template<typename Types1, typename Types2, typename Bits1, typename Bits2, typename Op>
static Op::result_type GIL_FORCEINLINE boost::gil::apply_operation_base (const Bits1 &bits1, std::size_t index1, const Bits2 &bits2, std::size_t index2, Op op)

Define Documentation

#define GIL_APPLY_FWD_OP z,
N,
text   ) 
 

Value:

template <> struct apply_operation_fwd_fn<BOOST_PP_ADD(N,1)> {                                      \
        template <typename Types, typename Bits, typename UnaryOp>                                     \
        typename UnaryOp::result_type apply(Bits& bits, std::size_t index, 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, BOOST_PP_EMPTY)                            \
            }                                                                                           \
            throw;                                                                                      \
        }                                                                                               \
        template <typename Types, typename Bits, typename UnaryOp>                                     \
        typename UnaryOp::result_type applyc(const Bits& bits, std::size_t index, 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,BOOST_PP_EMPTY)                       \
            }                                                                                           \
            throw;                                                                                      \
        }                                                                                               \
    };

Copyright © 2006-2007 Adobe Systems Incorporated.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.

Search powered by Google