libpnicore
op_traits.hpp
1 //
2 // (c) Copyright 2011 DESY, Eugen Wintersberger <eugen.wintersberger@desy.de>
3 //
4 // This file is part of libpnicore.
5 //
6 // libpnicore is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // libpnicore is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with libpnicore. If not, see <http://www.gnu.org/licenses/>.
18 //
19 // ============================================================================
20 //
21 // Created on: Jul 25,2012
22 // Author: Eugen Wintersberger <eugen.wintersberger@desy.de>
23 //
24 #pragma once
25 
26 #include "../../arrays/scalar.hpp"
27 
28 namespace pni{
29 namespace core{
30 
42  template<typename OT>
43  struct op_trait
44  {
46  typedef OT const& ref_type;
47  };
48 
49  //-------------------------------------------------------------------------
59  template<typename T>
60  struct op_trait<scalar<T> >
61  {
64  };
65 
66  //-------------------------------------------------------------------------
79  template<
80  typename OP1,
81  typename OPT2
82  >
83  struct array_trait
84  {
86  typedef typename OP1::map_type map_type;
88  typedef typename OP1::inplace_arithmetic inplace_arithmetic;
89  };
90 
91  //-------------------------------------------------------------------------
104  template<
105  typename OP1,
106  typename T
107  >
108  struct array_trait<OP1,scalar<T>>
109  {
111  typedef typename OP1::map_type map_type;
113  typedef typename OP1::inplace_arithmetic inplace_arithmetic;
114  };
115 
116  //-------------------------------------------------------------------------
129  template<
130  typename T,
131  typename OP1
132  >
133  struct array_trait<scalar<T>,OP1>
134  {
136  typedef typename OP1::map_type map_type;
138  typedef typename OP1::inplace_arithmetic inplace_arithmetic;
139  };
140 
141 //end of namespace
142 }
143 }
OP1::map_type map_type
index map type
Definition: op_traits.hpp:136
OP1::inplace_arithmetic inplace_arithmetic
inplace arithmetic type
Definition: op_traits.hpp:88
OP1::map_type map_type
index map type
Definition: op_traits.hpp:86
OP1::map_type map_type
index map type
Definition: op_traits.hpp:111
OT const & ref_type
reference type for the operand
Definition: op_traits.hpp:46
Definition: add_op.hpp:29
OP1::inplace_arithmetic inplace_arithmetic
inplace arithmetic type
Definition: op_traits.hpp:113
Scalar template for scalar values.
Definition: scalar.hpp:48
array trait for expression templates
Definition: op_traits.hpp:83
scalar< T > ref_type
reference type for a scalar operand
Definition: op_traits.hpp:63
OP1::inplace_arithmetic inplace_arithmetic
inplace arithmetic type
Definition: op_traits.hpp:138
operator reference trait
Definition: op_traits.hpp:43