ROOT   master Reference Guide
TIOFeatures.hxx
Go to the documentation of this file.
1 // Author: Brian Bockelman UNL 09/2017
2
3 /*************************************************************************
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
17 class TBranch;
18 class TTree;
19
20 // keep it here to have a note that was removed
21 // #ifndef R__LESS_INCLUDES
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;
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:
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
Returns the available number of logical cores.
Definition: RNumpyDS.hxx:30
void Clear(EIOFeatures bits)
Clear a specific IO feature from this set.
Definition: TIOFeatures.cxx:80
#define BIT(n)
Definition: Rtypes.h:83
bool Set(EIOFeatures bits)
Set a specific IO feature.
TIOFeatures provides the end-user with the ability to change the IO behavior of data written via a TT...
Definition: TIOFeatures.hxx:69
bool Test(EIOFeatures bits) const
Test to see if a given feature is set.
UChar_t GetFeatures() const
void Print() const
Print a human-readable representation of the TIOFeatures to stdout.
void Set(UChar_t newBits)
Definition: TIOFeatures.hxx:98
Manages buffers for branches of a Tree.