Logo ROOT  
Reference Guide
TIOFeatures.hxx
Go to the documentation of this file.
1 // Author: Brian Bockelman UNL 09/2017
2 
3 /*************************************************************************
4  * Copyright (C) 1995-2017, Rene Brun and Fons Rademakers. *
5  * All rights reserved. *
6  * *
7  * For the licensing terms see $ROOTSYS/LICENSE. *
8  * For the list of contributors see $ROOTSYS/README/CREDITS. *
9  *************************************************************************/
10 
11 #ifndef ROOT_TIO_FEATURES
12 #define ROOT_TIO_FEATURES
13 
14 #include "Rtypes.h"
15 
16 class TBasket;
17 class TBranch;
18 class TTree;
19 
20 // keep it here to have a note that was removed
21 // #ifndef R__LESS_INCLUDES
22 // #include "TBasket.h"
23 // #include <memory>
24 // #include <sstream>
25 // #include <initializer_list>
26 // #include <typeinfo>
27 // #include <type_traits> // is_same, enable_if
28 // #endif
29 
30 namespace ROOT {
31 
32 
33 // These are the known, supported, and enabled-by-default features for ROOT IO.
34 //
35 // Note that the `kSupported` members for EIOFeatures, Experimental::EIOFeatures, and
36 // Experiment::EIOUnsupportedFeatures should have no intersection and a union of equal
37 // to BITS(kIOFeatureCount).
38 //
39 enum class EIOFeatures {
40  kSupported = 0 // Union of all known, supported, and enabled-by-default features (currently none).
41 };
42 
43 
44 namespace Experimental {
45 
46 // These are the known and supported "experimental" features, not enabled by default.
47 // When these are enabled by default, they will move to `ROOT::EIOFeatures`.
48 //
49 // Note that these all show up in TBasket::EIOBits, but it is desired to have the enum be at
50 // the "ROOT-IO-wide" level and not restricted to TBasket -- even if all the currently-foreseen
51 // usage of this mechanism somehow involves baskets currently.
52 enum class EIOFeatures {
54  kSupported = kGenerateOffsetMap // Union of all features in this enum.
55 };
56 
57 
58 // These are previous experimental features that are not supported in this series.
59 // NOTE: the intent is that there is never an IO feature that goes into the ROOT:: namespace
60 // but is unsupported.
62  kUnsupported = 0 // Union of all features in this enum.
63 };
64 
65 
66 } // namespace Experimental
67 
68 
69 class TIOFeatures {
70 friend class ::TTree;
71 friend class ::TBranch;
72 friend class ::TBasket;
73 
74 public:
76 
77  void Clear(EIOFeatures bits);
80  bool Set(EIOFeatures bits);
81  bool Set(Experimental::EIOFeatures bits);
82  bool Set(const std::string &);
83  bool Test(EIOFeatures bits) const;
84  bool Test(Experimental::EIOFeatures bits) const;
86  void Print() const;
87 
88  // The number of known, defined IO features (supported / unsupported / experimental).
89  static constexpr int kIOFeatureCount = 1;
90 
91 private:
92  // These methods allow access to the raw bitset underlying
93  // this object, breaking type safety. They are necessary for
94  // efficient interaction with TTree / TBranch / TBasket, but left
95  // private to prevent users from interacting with the raw bits.
96  TIOFeatures(UChar_t IOBits) : fIOBits(IOBits) {}
97  UChar_t GetFeatures() const;
98  void Set(UChar_t newBits) {fIOBits = newBits;}
99 
101 };
102 
103 } // namespace ROOT
104 
105 #endif // ROOT_TIO_FEATURES
ROOT::TIOFeatures::TIOFeatures
TIOFeatures()
Definition: TIOFeatures.hxx:75
ROOT::TIOFeatures::TIOFeatures
TIOFeatures(UChar_t IOBits)
Definition: TIOFeatures.hxx:96
ROOT::Experimental::EIOFeatures
EIOFeatures
Definition: TIOFeatures.hxx:52
ROOT::TIOFeatures::Test
bool Test(EIOFeatures bits) const
Test to see if a given feature is set.
Definition: TIOFeatures.cxx:239
TTree
Definition: TTree.h:79
ROOT::TIOFeatures
Definition: TIOFeatures.hxx:69
ROOT::Experimental::EIOFeatures::kGenerateOffsetMap
@ kGenerateOffsetMap
TBranch
Definition: TBranch.h:89
ROOT::TIOFeatures::Print
void Print() const
Print a human-readable representation of the TIOFeatures to stdout.
Definition: TIOFeatures.cxx:197
ROOT::TIOFeatures::Clear
void Clear(EIOFeatures bits)
Clear a specific IO feature from this set.
Definition: TIOFeatures.cxx:80
BIT
#define BIT(n)
Definition: Rtypes.h:85
ROOT::EIOFeatures
EIOFeatures
Definition: TIOFeatures.hxx:39
ROOT::Experimental::EIOUnsupportedFeatures
EIOUnsupportedFeatures
Definition: TIOFeatures.hxx:61
ROOT::Experimental::EIOUnsupportedFeatures::kUnsupported
@ kUnsupported
ROOT::TIOFeatures::Set
bool Set(EIOFeatures bits)
Set a specific IO feature.
Definition: TIOFeatures.cxx:139
ROOT::TIOFeatures::GetFeatures
UChar_t GetFeatures() const
Definition: TIOFeatures.cxx:250
ROOT::Experimental::EIOFeatures::kSupported
@ kSupported
ROOT::EIOFeatures::kSupported
@ kSupported
TBasket
Definition: TBasket.h:34
UChar_t
unsigned char UChar_t
Definition: RtypesCore.h:38
ROOT::TIOFeatures::Set
void Set(UChar_t newBits)
Definition: TIOFeatures.hxx:98
ROOT::TIOFeatures::fIOBits
UChar_t fIOBits
Definition: TIOFeatures.hxx:100
ROOT::TIOFeatures::kIOFeatureCount
static constexpr int kIOFeatureCount
Definition: TIOFeatures.hxx:89
Rtypes.h
ROOT
VSD Structures.
Definition: StringConv.hxx:21