opdecls.hh File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define oln_arith_declare_binrecval_functor_(OPNAME, OPCODE)
#define oln_arith_declare_binrecvalcst_functor_(OPNAME, OPCODE_CST)
#define oln_arith_declare_binrecval_functors_(OPNAME, OPCODE, OPCODE_CST)
#define oln_arith_declare_binfixedtype_functor_(OPNAME, OPCODE, TYPE)
#define oln_arith_declare_binfixedtypecst_functor_(OPNAME, OPCODE_CST, TYPE)
#define oln_arith_declare_binfixedtype_functors_(NAME, TYPE, CODE, CODE_CST)
#define default_functor_return_type_(OPNAME, I1, I2)
 Shortcut.

#define default_functor_type_cst_(OPNAME, I1, T2)
 Shortcut.

#define default_functor_return_type_cst_(OPNAME, I1, T2)   typename default_functor_type_cst_(OPNAME, I1, T2)::result_type
 Shortcut.

#define oln_arith_declare_binop_procs_(OPNAME)
 Declare front-end functions.

#define oln_arith_declare_binopcst_procs_(OPNAME)
 Apply OPNAME with a constant as second operand.

#define oln_arith_declare_all_binop_procs_(OPNAME)
#define oln_arith_declare_nongenericbinop_procs_(OPNAME)
 Same as oln_arith_declare_nongenericbinop_procs_ but for non template functors.

#define oln_arith_declare_nongenericbinopcst_procs_(OPNAME)
 Apply OPNAME with a constant as second operand.

#define oln_arith_declare_all_nongenericbinop_procs_(OPNAME)
#define oln_arith_declare_unfixedtype_functor_(OPNAME, TYPE, OPCODE)
#define oln_arith_declare_nongenericunop_procs_(OPNAME)
#define oln_arith_declare_unop_procs_(OPNAME)


Detailed Description

Operations are defined between two images and between one image and one constant value (with the cst suffix). The two main components are:
  1. Define functors for each operations, taking two values and returning the result.
  2. Define front-end functions applying a functor on the whole image.
  3. Versions are defined, leaving the possibility to specify the return type automatically, manually or using a conversion (from convert).

Todo:
FIXME: These macros should be rewritten / split into real code to make things clearer.

Definition in file opdecls.hh.


Define Documentation

#define default_functor_return_type_ OPNAME,
I1,
I2   ) 
 

Value:

typename f_##OPNAME<oln_value_type(I1),                         \
                      oln_value_type(I2),                               \
                      ntg_return_type(OPNAME,                           \
                                      oln_value_type(I1),               \
                                      oln_value_type(I2))>::result_type
Shortcut.

Definition at line 163 of file opdecls.hh.

#define default_functor_type_cst_ OPNAME,
I1,
T2   ) 
 

Value:

f_##OPNAME##_cst<oln_value_type(I1),                    \
                   T2,                                  \
                   ntg_return_type(OPNAME,              \
                                   oln_value_type(I1),  \
                                   T2)>
Shortcut.

Definition at line 171 of file opdecls.hh.

#define oln_arith_declare_all_binop_procs_ OPNAME   ) 
 

Value:

Definition at line 268 of file opdecls.hh.

#define oln_arith_declare_all_nongenericbinop_procs_ OPNAME   ) 
 

Value:

Definition at line 319 of file opdecls.hh.

#define oln_arith_declare_binfixedtype_functor_ OPNAME,
OPCODE,
TYPE   ) 
 

Value:

struct f_##OPNAME : std::binary_function< const TYPE&, const TYPE&, TYPE> \
    {                                                                         \
      const result_type                                                       \
      operator()(first_argument_type val1,                                    \
                 second_argument_type val2) const                             \
      {                                                                       \
        return OPCODE;                                                        \
      }                                                                       \
    } /* no ; */
For binary functions that work on a single known datatype.

  • OPNAME Will produce the name of the function.
  • OPCODE Operation that may use val1 and val2.
  • TYPE Type that can be used.

Definition at line 123 of file opdecls.hh.

#define oln_arith_declare_binfixedtype_functors_ NAME,
TYPE,
CODE,
CODE_CST   ) 
 

Value:

oln_arith_declare_binfixedtype_functor_ & oln_arith_declare_binfixedtypecst_functor_.

Definition at line 158 of file opdecls.hh.

#define oln_arith_declare_binfixedtypecst_functor_ OPNAME,
OPCODE_CST,
TYPE   ) 
 

Value:

struct f_##OPNAME##_cst: std::unary_function<const TYPE, TYPE >      \
    {                                                                        \
      f_##OPNAME##_cst(TYPE cst) : cst_(cst) {}                              \
                                                                             \
      const result_type                                                      \
      operator()(argument_type val) const                                    \
      {                                                                      \
        return OPCODE_CST;                                                   \
      }                                                                      \
    private:                                                                 \
      TYPE cst_;                                                             \
    } /* no ; */
For Binary functions that work on a single known datatype.

  • OPNAME Will produce the name of the function.
  • OPCODE_CST Operation that may use val1 and cst_
  • TYPE Type that can be used.

Definition at line 141 of file opdecls.hh.

#define oln_arith_declare_binrecval_functor_ OPNAME,
OPCODE   ) 
 

Value:

template<class T1, class T2, class Ret>                         \
    struct f_##OPNAME : std::binary_function<const T1&,                 \
      const T2&,                                                        \
      Ret>                                                              \
    {                                                                   \
      typedef f_##OPNAME self_type;                                     \
      typename self_type::result_type                                   \
      operator()(typename self_type::first_argument_type val1,          \
                 typename self_type::second_argument_type val2) const   \
      {                                                                 \
        return OPCODE;                                                  \
      }                                                                 \
    };                                                                  \
                                                                        \
    template <class T1, class T2 = T1>                                  \
    struct default_f_##OPNAME                                           \
      : public f_##OPNAME< T1, T2, ntg_return_type(OPNAME, T1, T2)>     \
    {}  /* no ; */
Binary functors.

Produce a functor named f_##OPNAME using the code OPCODE.

  • OPNAME Will produce the name of the function
  • OPCODE Operation that may use val1 and val2

Definition at line 55 of file opdecls.hh.

#define oln_arith_declare_binrecval_functors_ OPNAME,
OPCODE,
OPCODE_CST   ) 
 

Value:

Produces an unary function and a binary and a Unary Functor using a constant.

Definition at line 113 of file opdecls.hh.

#define oln_arith_declare_binrecvalcst_functor_ OPNAME,
OPCODE_CST   ) 
 

Value:

template<class T1, class T2, class Ret>                         \
     struct f_##OPNAME##_cst : std::unary_function<const T1&,           \
      Ret>                                                              \
    {                                                                   \
      typedef f_##OPNAME##_cst self_type;                               \
      f_##OPNAME##_cst(T2 cst) : cst_(cst) {}                           \
                                                                        \
      typename self_type::result_type                                   \
      operator()(typename self_type::argument_type val) const           \
      {                                                                 \
        return OPCODE_CST;                                              \
      }                                                                 \
    private:                                                            \
      T2 cst_;                                                          \
    } /* no ; */
Unary functor, using a constant.

Produce a functor named f_##OPNAME using the code OPCODE. The object is constructed using a constant.

  • OPNAME Will produce the name of the function
  • OPCODE_CST Operation that may use val1 and cst_

Definition at line 86 of file opdecls.hh.

#define oln_arith_declare_nongenericbinop_procs_ OPNAME   ) 
 

Value:

/* Standard application of OPNAME */                                            \
    template<class I1, class I2> inline                                                 \
    typename mute<I1, typename f_##OPNAME::result_type>::ret                            \
    OPNAME(const abstract::image<I1>& input1, const abstract::image<I2>& input2)        \
    {                                                                                   \
      return apply2<f_##OPNAME >(input1, input2);                                       \
    }                                                                                   \
                                                                                        \
    /* Same as above, plus conversion.  */                                              \
    template<class C, class B, class I1, class I2> inline                               \
    typename mute<I1,                                                                   \
      typename convoutput<C, B, typename f_##OPNAME::result_type>::ret>::ret            \
    OPNAME(const convert::abstract::conversion<C, B>& conv,                             \
           const abstract::image<I1>& input1, const abstract::image<I2>& input2)        \
    {                                                                                   \
      return apply2(convert::compconv2(conv, f_##OPNAME()),                             \
                    input1, input2);                                                    \
    }
Same as oln_arith_declare_nongenericbinop_procs_ but for non template functors.

Definition at line 273 of file opdecls.hh.

#define oln_arith_declare_nongenericbinopcst_procs_ OPNAME   ) 
 

Value:

template<class I, class T> inline                                       \
    typename mute<I, typename f_##OPNAME##_cst::result_type>::ret       \
    OPNAME##_cst(const abstract::image<I>& input, T val)                \
    {                                                                   \
      return apply(f_##OPNAME##_cst(val), input);                       \
    }                                                                   \
                                                                        \
    /* Same as above, plus conversion.  */                              \
    template<class C, class B, class I, class T> inline                 \
    typename mute<I,                                                    \
      typename convoutput<C, B,                                         \
        typename f_##OPNAME##_cst::result_type>::ret>::ret              \
    OPNAME##_cst(const convert::abstract::conversion<C, B>& conv,       \
                 const abstract::image<I>& input, T val)                \
    {                                                                   \
      return apply(convert::compconv1(conv, f_##OPNAME##_cst(val)),     \
                   input);                                              \
    }
Apply OPNAME with a constant as second operand.

Definition at line 297 of file opdecls.hh.

#define oln_arith_declare_nongenericunop_procs_ OPNAME   ) 
 

Value:

/* Standard application of OPNAME */                                                    \
    template<class I> inline                                                                    \
    typename mute<I, typename f_##OPNAME::result_type>::ret                                     \
    OPNAME(const abstract::image<I>& input1)                                                    \
    {                                                                                           \
      return apply<f_##OPNAME >(input1);                                                        \
    }                                                                                           \
                                                                                                \
    /* Same as above, plus conversion.  */                                                      \
    template<class C, class B, class I> inline                                                  \
    typename mute<I,                                                                            \
      typename convoutput<C, B, typename f_##OPNAME::result_type>::ret>::ret                    \
    OPNAME(const convert::abstract::conversion<C, B>& conv, const abstract::image<I>& input1)   \
    {                                                                                           \
      return apply(convert::compconv2(conv, f_##OPNAME()), input1);                             \
    }

Definition at line 338 of file opdecls.hh.

#define oln_arith_declare_unfixedtype_functor_ OPNAME,
TYPE,
OPCODE   ) 
 

Value:

struct f_##OPNAME : std::unary_function< const TYPE&, TYPE>             \
    {                                                                   \
      const result_type operator()(argument_type val) const             \
      {                                                                 \
        return OPCODE;                                                  \
      }                                                                 \
    } /* no ; */
Unary function for binary functions that work on a single known datatype.

Definition at line 328 of file opdecls.hh.

#define oln_arith_declare_unop_procs_ OPNAME   ) 
 

Value:

/* Standard application of OPNAME */                                                    \
    template<class I> inline                                                                    \
    typename mute<I, typename f_##OPNAME<oln_value_type(I)>::result_type>::ret                  \
    OPNAME(const abstract::image<I>& input1)                                                    \
    {                                                                                           \
      return apply(f_##OPNAME<oln_value_type(I)>(), input1);                                    \
    }                                                                                           \
                                                                                                \
    /* Same as above, plus conversion.  */                                                      \
    template<class C, class B, class I> inline                                                  \
    typename mute<I,                                                                            \
      typename convoutput<C, B,                                                                 \
        typename f_##OPNAME<oln_value_type(I)>::result_type>::ret>::ret                         \
    OPNAME(const convert::abstract::conversion<C>& conv, const abstract::image<I>& input1)      \
    {                                                                                           \
      return apply(convert::compconv2(conv, f_##OPNAME<oln_value_type(I)>()), input1);          \
    }

Definition at line 356 of file opdecls.hh.


Generated on Thu Apr 15 20:13:37 2004 for Olena by doxygen 1.3.6-20040222