Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:10:50

0001 // Author: Brian Bockelman UNL 09/2017
0002 
0003 /*************************************************************************
0004  * Copyright (C) 1995-2017, Rene Brun and Fons Rademakers.               *
0005  * All rights reserved.                                                  *
0006  *                                                                       *
0007  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0008  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0009  *************************************************************************/
0010 
0011 #ifndef ROOT_TIO_FEATURES
0012 #define ROOT_TIO_FEATURES
0013 
0014 #include "Rtypes.h"
0015 
0016 class TBasket;
0017 class TBranch;
0018 class TTree;
0019 
0020 // keep it here to have a note that was removed
0021 // #ifndef R__LESS_INCLUDES
0022 // #include "TBasket.h"
0023 // #include <memory>
0024 // #include <sstream>
0025 // #include <initializer_list>
0026 // #include <typeinfo>
0027 // #include <type_traits> // is_same, enable_if
0028 // #endif
0029 
0030 namespace ROOT {
0031 
0032 
0033 // These are the known, supported, and enabled-by-default features for ROOT IO.
0034 //
0035 // Note that the `kSupported` members for EIOFeatures, Experimental::EIOFeatures, and
0036 // Experiment::EIOUnsupportedFeatures should have no intersection and a union of equal
0037 // to BITS(kIOFeatureCount).
0038 //
0039 enum class EIOFeatures {
0040    kSupported = 0  // Union of all known, supported, and enabled-by-default features (currently none).
0041 };
0042 
0043 
0044 namespace Experimental {
0045 
0046 // These are the known and supported "experimental" features, not enabled by default.
0047 // When these are enabled by default, they will move to `ROOT::EIOFeatures`.
0048 //
0049 // Note that these all show up in TBasket::EIOBits, but it is desired to have the enum be at
0050 // the "ROOT-IO-wide" level and not restricted to TBasket -- even if all the currently-foreseen
0051 // usage of this mechanism somehow involves baskets currently.
0052 enum class EIOFeatures {
0053    kGenerateOffsetMap = BIT(0),
0054    kSupported = kGenerateOffsetMap  // Union of all features in this enum.
0055 };
0056 
0057 
0058 // These are previous experimental features that are not supported in this series.
0059 // NOTE: the intent is that there is never an IO feature that goes into the ROOT:: namespace
0060 // but is unsupported.
0061 enum class EIOUnsupportedFeatures {
0062    kUnsupported = 0  // Union of all features in this enum.
0063 };
0064 
0065 
0066 }  // namespace Experimental
0067 
0068 
0069 class TIOFeatures {
0070 friend class ::TTree;
0071 friend class ::TBranch;
0072 friend class ::TBasket;
0073 
0074 public:
0075    TIOFeatures() {}
0076 
0077    void Clear(EIOFeatures bits);
0078    void Clear(Experimental::EIOUnsupportedFeatures bits);
0079    void Clear(Experimental::EIOFeatures bits);
0080    bool Set(EIOFeatures bits);
0081    bool Set(Experimental::EIOFeatures bits);
0082    bool Set(const std::string &);
0083    bool Test(EIOFeatures bits) const;
0084    bool Test(Experimental::EIOFeatures bits) const;
0085    bool Test(Experimental::EIOUnsupportedFeatures bits) const;
0086    void Print() const;
0087 
0088    // The number of known, defined IO features (supported / unsupported / experimental).
0089    static constexpr int kIOFeatureCount = 1;
0090 
0091 private:
0092    // These methods allow access to the raw bitset underlying
0093    // this object, breaking type safety.  They are necessary for
0094    // efficient interaction with TTree / TBranch / TBasket, but left
0095    // private to prevent users from interacting with the raw bits.
0096    TIOFeatures(UChar_t IOBits) : fIOBits(IOBits) {}
0097    UChar_t GetFeatures() const;
0098    void Set(UChar_t newBits) {fIOBits = newBits;}
0099 
0100    UChar_t fIOBits{0};
0101 };
0102 
0103 }  // namespace ROOT
0104 
0105 #endif  // ROOT_TIO_FEATURES