ATLAS Offline Software
type_tools.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ATHENAKERNEL_TOOLS_TYPE_TOOLS_H
6 #define ATHENAKERNEL_TOOLS_TYPE_TOOLS_H
7 #include <type_traits>
8 
9 namespace type_tools {
11  template <int v>
12  struct Int2Type {
13  enum { value = v };
14  };
15 
18 
19 
29  template <typename T>
30  struct Parameter {
31  private:
33  typedef const TRef const_TRef;
34  static const bool s_isScalar = std::is_scalar<T>::value;
35  public:
39  typedef const_type type;
40  };
41 
42 
50  template <typename T>
51  struct Copy {
52  typedef T type;
53  typedef const T& const_reference;
54  typedef const T* const_pointer;
55  };
56 
58  template <typename T>
59  struct Copy<T*> {
60  typedef const T* type;
61  typedef const T* const_reference;
62  typedef const T* const* const_pointer;
63  };
64 }
65 #endif
66 
type_tools::Parameter::const_type
std::conditional< s_isScalar, T, const T & >::type const_type
Definition: type_tools.h:37
type_tools::Int2Type
assign a type to an integer value
Definition: type_tools.h:12
type_tools::Copy< T * >::const_reference
const T * const_reference
Definition: type_tools.h:61
type_tools::Copy::const_reference
const T & const_reference
Definition: type_tools.h:53
type_tools::Copy< T * >::type
const T * type
Definition: type_tools.h:60
athena.value
value
Definition: athena.py:122
type_tools
Definition: type_tools.h:9
type_tools::Copy< T * >::const_pointer
const T *const * const_pointer
Definition: type_tools.h:62
type_tools::Copy::type
T type
Definition: type_tools.h:52
type_tools::false_tag
Int2Type< 0 > false_tag
Definition: type_tools.h:17
type_tools::Parameter::ptr_type
std::conditional< s_isScalar, T, T * >::type ptr_type
Definition: type_tools.h:38
type_tools::Copy::const_pointer
const T * const_pointer
Definition: type_tools.h:54
type_tools::Parameter
an algorithm to provide an efficient way to pass a parameter: by value for scalars (arithmetic types ...
Definition: type_tools.h:30
type_tools::true_tag
Int2Type< 1 > true_tag
Definition: type_tools.h:16
type_tools::Parameter::type
const_type type
Definition: type_tools.h:39
type_tools::Parameter::ref_type
std::conditional< s_isScalar, T, TRef >::type ref_type
Definition: type_tools.h:36
type_tools::Parameter::s_isScalar
static const bool s_isScalar
Definition: type_tools.h:34
python.PyAthena.v
v
Definition: PyAthena.py:157
type_tools::Parameter::TRef
std::add_lvalue_reference< T >::type TRef
Definition: type_tools.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
type_tools::Parameter::const_TRef
const TRef const_TRef
Definition: type_tools.h:33
type_tools::Copy
an algorithm to define a suitable "copy type": by default use copy-by-value
Definition: type_tools.h:51
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
type_tools::Int2Type::value
@ value
Definition: type_tools.h:13