Logo ROOT  
Reference Guide
RHistUtils.hxx
Go to the documentation of this file.
1 /// \file ROOT/RHistUtils.hxx
2 /// \ingroup Hist ROOT7
3 /// \author Axel Naumann <axel@cern.ch>
4 /// \date 2016-06-01
5 /// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
6 
7 /*************************************************************************
8  * Copyright (C) 1995-2016, Rene Brun and Fons Rademakers. *
9  * All rights reserved. *
10  * *
11  * For the licensing terms see $ROOTSYS/LICENSE. *
12  * For the list of contributors see $ROOTSYS/README/CREDITS. *
13  *************************************************************************/
14 
15 #ifndef ROOT7_RHistUtils
16 #define ROOT7_RHistUtils
17 
18 #include <array>
19 #include <type_traits>
20 
21 namespace ROOT {
22 namespace Experimental {
23 
24 class RLogChannel;
25 /// Log channel for Hist diagnostics.
26 RLogChannel &HistLog(); // implemented in RAxis.cxx
27 
28 namespace Hist {
29 
30 template <int DIMENSIONS>
31 struct RCoordArray: std::array<double, DIMENSIONS> {
32  using Base_t = std::array<double, DIMENSIONS>;
33 
34  /// Default construction.
35  RCoordArray() = default;
36 
37  /// Construction with one `double` per `DIMENSION`.
38  template<class...ELEMENTS, class = typename std::enable_if<sizeof...(ELEMENTS) + 1 == DIMENSIONS>::type>
39  RCoordArray(double x, ELEMENTS...el): Base_t{{x, el...}} {}
40 
41  /// Fallback constructor, invoked if the one above fails because of the wrong number of
42  /// arguments / coordinates.
43  template<class T, class...ELEMENTS, class = typename std::enable_if<sizeof...(ELEMENTS) + 1 != DIMENSIONS>::type>
44  RCoordArray(T, ELEMENTS...) {
45  static_assert(sizeof...(ELEMENTS) + 1 == DIMENSIONS, "Number of coordinates does not match DIMENSIONS");
46  }
47 
48  /// Construction from a C-style array.
49  RCoordArray(double (&arr)[DIMENSIONS]): Base_t(arr) {}
50 
51  /// Copy-construction from a C++-style array.
52  /// (No need for a move-constructor, it isn't any better for doubles)
53  RCoordArray(const std::array<double, DIMENSIONS>& arr): Base_t(arr) {}
54 };
55 
56 template <int DIMENSIONS>
57 //using CoordArray_t = std::array<double, DIMENSIONS>;
59 
60 
61 } // namespace Hist
62 } // namespace Experimental
63 } // namespace ROOT
64 
65 #endif //ROOT7_THistUtils_h
ROOT::Experimental::Hist::RCoordArray::Base_t
std::array< double, DIMENSIONS > Base_t
Definition: RHistUtils.hxx:32
x
Double_t x[n]
Definition: legend1.C:17
ROOT::Experimental::HistLog
RLogChannel & HistLog()
Log channel for Hist diagnostics.
Definition: RAxis.cxx:25
ROOT::Experimental::Hist::RCoordArray::RCoordArray
RCoordArray(const std::array< double, DIMENSIONS > &arr)
Copy-construction from a C++-style array.
Definition: RHistUtils.hxx:53
ROOT::Experimental::Hist::RCoordArray::RCoordArray
RCoordArray(double x, ELEMENTS...el)
Construction with one double per DIMENSION.
Definition: RHistUtils.hxx:39
ROOT::Experimental::Hist::RCoordArray::RCoordArray
RCoordArray(T, ELEMENTS...)
Fallback constructor, invoked if the one above fails because of the wrong number of arguments / coord...
Definition: RHistUtils.hxx:44
ROOT::Experimental::Hist::RCoordArray
Definition: RHistUtils.hxx:31
ROOT::Experimental::Hist::RCoordArray::RCoordArray
RCoordArray()=default
Default construction.
ROOT::Math::Chebyshev::T
double T(double x)
Definition: ChebyshevPol.h:34
ROOT::Experimental::Hist::RCoordArray::RCoordArray
RCoordArray(double(&arr)[DIMENSIONS])
Construction from a C-style array.
Definition: RHistUtils.hxx:49
type
int type
Definition: TGX11.cxx:121
ROOT
VSD Structures.
Definition: EExecutionPolicy.hxx:4