scalar_ops.h File Reference

#include <cml/et/traits.h>
#include <cml/et/scalar_promotions.h>

Include dependency graph for scalar_ops.h:

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

Go to the source code of this file.

Namespaces

namespace  cml
namespace  cml::et

Defines

#define CML_BINARY_SCALAR_OP(_op_, _op_name_)
 Declare a binary scalar operator, like addition, s1+s2.
#define CML_BINARY_SCALAR_OP_ASSIGN(_op_, _op_name_)
 Declare an op-assignment operator.
#define CML_BOOLEAN_SCALAR_OP(_op_, _op_name_)
 Declare a binary boolean operator, like less-than, s1 < s2.
#define CML_UNARY_SCALAR_OP(_op_, _op_name_)
 Declare a unary scalar operator, like negation.


Detailed Description

Definition in file scalar_ops.h.


Define Documentation

#define CML_BINARY_SCALAR_OP ( _op_,
_op_name_   ) 

Value:

template<typename LeftT, typename RightT> struct _op_name_ {             \
    typedef ExprTraits<LeftT> left_traits;                               \
    typedef ExprTraits<RightT> right_traits;                             \
    typedef typename left_traits::const_reference left_reference;        \
    typedef typename right_traits::const_reference right_reference;      \
    typedef typename left_traits::value_type left_value;                 \
    typedef typename right_traits::value_type right_value;               \
    typedef typename ScalarPromote<left_value,right_value>::type value_type; \
    typedef scalar_result_tag result_tag;                               \
    value_type apply(left_reference left, right_reference right) const { \
        return left _op_ right; }                                        \
};
Declare a binary scalar operator, like addition, s1+s2.

Definition at line 30 of file scalar_ops.h.

#define CML_BINARY_SCALAR_OP_ASSIGN ( _op_,
_op_name_   ) 

Value:

template<typename LeftT, typename RightT> struct _op_name_ {             \
    typedef ExprTraits<LeftT> left_traits;                               \
    typedef ExprTraits<RightT> right_traits;                             \
    typedef typename left_traits::reference left_reference;              \
    typedef typename right_traits::const_reference right_reference;      \
    typedef typename left_traits::value_type left_value;                 \
    typedef typename right_traits::value_type right_value;               \
    typedef typename ScalarPromote<left_value,right_value>::type value_type; \
    typedef scalar_result_tag result_tag;                                \
    value_type apply(left_reference left, right_reference right) const { \
        return left _op_ (LeftT) right; }                                \
};
Declare an op-assignment operator.

Note:
The ExprTraits for both argument types must be defined, LeftT must have an assignment operator, and ExprTraits<LeftT>::reference must specify a type that allows assignment.

Definition at line 50 of file scalar_ops.h.

#define CML_BOOLEAN_SCALAR_OP ( _op_,
_op_name_   ) 

Value:

template<typename LeftT, typename RightT> struct _op_name_ {             \
    typedef ExprTraits<LeftT> left_traits;                               \
    typedef ExprTraits<RightT> right_traits;                             \
    typedef typename left_traits::const_reference left_reference;        \
    typedef typename right_traits::const_reference right_reference;      \
    typedef scalar_result_tag result_tag;                                \
    bool apply(left_reference left, right_reference right) const {       \
        return left _op_ right; }                                        \
};
Declare a binary boolean operator, like less-than, s1 < s2.

The operator should return the appropriate truth value for the operator.

Note:
Both scalar types must have operator<() defined.

Definition at line 70 of file scalar_ops.h.

#define CML_UNARY_SCALAR_OP ( _op_,
_op_name_   ) 

Value:

template<typename ArgT> struct _op_name_ {                              \
    typedef ExprTraits<ArgT> arg_traits;                                \
    typedef typename arg_traits::const_reference arg_reference;         \
    typedef typename arg_traits::value_type value_type;                 \
    typedef scalar_result_tag result_tag;                               \
    value_type apply(arg_reference arg) const { return _op_ arg; }      \
};
Declare a unary scalar operator, like negation.

Definition at line 20 of file scalar_ops.h.


Generated on Sat Jul 18 19:35:36 2009 for CML 1.0 by  doxygen 1.5.9