Logo ROOT   6.16/01
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 "TBasket.h"
15
16#include <initializer_list>
17#include <memory>
18#include <string>
19#include <sstream>
20#include <typeinfo>
21#include <type_traits> // is_same, enable_if
22
23namespace ROOT {
24
25
26// These are the known, supported, and enabled-by-default features for ROOT IO.
27//
28// Note that the `kSupported` members for EIOFeatures, Experimental::EIOFeatures, and
29// Experiment::EIOUnsupportedFeatures should have no intersection and a union of equal
30// to BITS(kIOFeatureCount).
31//
32enum class EIOFeatures {
33 kSupported = 0 // Union of all known, supported, and enabled-by-default features (currently none).
34};
35
36
37namespace Experimental {
38
39// These are the known and supported "experimental" features, not enabled by default.
40// When these are enabled by default, they will move to `ROOT::EIOFeatures`.
41//
42// Note that these all show up in TBasket::EIOBits, but it is desired to have the enum be at
43// the "ROOT-IO-wide" level and not restricted to TBasket -- even if all the currently-foreseen
44// usage of this mechanism somehow involves baskets currently.
45enum class EIOFeatures {
47 kSupported = kGenerateOffsetMap // Union of all features in this enum.
48};
49
50
51// These are previous experimental features that are not supported in this series.
52// NOTE: the intent is that there is never an IO feature that goes into the ROOT:: namespace
53// but is unsupported.
55 kUnsupported = 0 // Union of all features in this enum.
56};
57
58
59} // namespace Experimental
60
61
63friend class ::TTree;
64friend class ::TBranch;
65friend class ::TBasket;
66
67public:
69
70 void Clear(EIOFeatures bits);
73 bool Set(EIOFeatures bits);
75 bool Set(const std::string &);
76 bool Test(EIOFeatures bits) const;
77 bool Test(Experimental::EIOFeatures bits) const;
79 void Print() const;
80
81 // The number of known, defined IO features (supported / unsupported / experimental).
82 static constexpr int kIOFeatureCount = 1;
83
84private:
85 // These methods allow access to the raw bitset underlying
86 // this object, breaking type safety. They are necessary for
87 // efficient interaction with TTree / TBranch / TBasket, but left
88 // private to prevent users from interacting with the raw bits.
89 TIOFeatures(UChar_t IOBits) : fIOBits(IOBits) {}
90 UChar_t GetFeatures() const;
91 void Set(UChar_t newBits) {fIOBits = newBits;}
92
94};
95
96} // namespace ROOT
97
98#endif // ROOT_TIO_FEATURES
unsigned char UChar_t
Definition: RtypesCore.h:34
#define BIT(n)
Definition: Rtypes.h:82
TIOFeatures provides the end-user with the ability to change the IO behavior of data written via a TT...
Definition: TIOFeatures.hxx:62
UChar_t GetFeatures() const
TIOFeatures(UChar_t IOBits)
Definition: TIOFeatures.hxx:89
bool Test(Experimental::EIOUnsupportedFeatures bits) const
void Print() const
Print a human-readable representation of the TIOFeatures to stdout.
bool Set(EIOFeatures bits)
Set a specific IO feature.
bool Test(EIOFeatures bits) const
Test to see if a given feature is set.
void Clear(EIOFeatures bits)
Clear a specific IO feature from this set.
Definition: TIOFeatures.cxx:78
static constexpr int kIOFeatureCount
Definition: TIOFeatures.hxx:82
void Set(UChar_t newBits)
Definition: TIOFeatures.hxx:91
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21