Logo ROOT  
Reference Guide
RHistUtils.hxx
Go to the documentation of this file.
1/// \file ROOT/RHistUtils.hxx
2/// \ingroup HistV7
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
21namespace ROOT {
22namespace Experimental {
23
24class RLogChannel;
25/// Log channel for Hist diagnostics.
26RLogChannel &HistLog(); // implemented in RAxis.cxx
27
28namespace Hist {
29
30template <int DIMENSIONS>
31struct 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
56template <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
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Double_t x[n]
Definition: legend1.C:17
RLogChannel & HistLog()
Log channel for Hist diagnostics.
Definition: RAxis.cxx:25
double T(double x)
Definition: ChebyshevPol.h:34
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
RCoordArray(double x, ELEMENTS...el)
Construction with one double per DIMENSION.
Definition: RHistUtils.hxx:39
RCoordArray(T, ELEMENTS...)
Fallback constructor, invoked if the one above fails because of the wrong number of arguments / coord...
Definition: RHistUtils.hxx:44
RCoordArray(const std::array< double, DIMENSIONS > &arr)
Copy-construction from a C++-style array.
Definition: RHistUtils.hxx:53
std::array< double, DIMENSIONS > Base_t
Definition: RHistUtils.hxx:32
RCoordArray(double(&arr)[DIMENSIONS])
Construction from a C-style array.
Definition: RHistUtils.hxx:49
RCoordArray()=default
Default construction.