GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TTransientBits.h
Go to the documentation of this file.
1#ifndef TTRANSIENTBITS_H
2#define TTRANSIENTBITS_H
3
4/** \addtogroup Sorting
5 * @{
6 */
7
8////////////////////////////////////////////////////////////////////////////////
9///
10/// \class TTransientBits
11///
12/// Class for storing bits for transient data members
13///
14////////////////////////////////////////////////////////////////////////////////
15
16#include <sstream>
17#include <iostream>
18#include <iomanip>
19#include <string>
20#include <map>
21#include <algorithm>
22
23#include "Rtypes.h"
24
25template <typename T>
27public:
29 explicit TTransientBits(const T& tmp) : fBits(tmp) {}
30 ~TTransientBits() = default;
31
32 TTransientBits(const TTransientBits&) = default;
33 TTransientBits(TTransientBits&&) noexcept = default;
34
35 TTransientBits& operator=(const TTransientBits&) = default;
36 TTransientBits& operator=(TTransientBits&&) noexcept = default;
37
38 void SetBit(T bit, Bool_t flag) { flag ? SetBit(bit) : ClearBit(bit); }
39 void SetBit(T bit) { fBits |= bit; }
40 void ClearBit(T bit) { fBits &= ~bit; }
41 Bool_t TestBit(T bit) const { return fBits & bit; }
42 T TestBits(T bit) const { return (fBits & bit); }
43 template <typename U>
44 void SetBit(U bit, Bool_t flag) { flag ? SetBit(bit) : ClearBit(bit); }
45 template <typename U>
46 void SetBit(U bit) { fBits |= static_cast<typename std::underlying_type<U>::type>(bit); }
47 template <typename U>
48 void ClearBit(U bit) { fBits &= ~static_cast<typename std::underlying_type<U>::type>(bit); }
49 template <typename U>
50 Bool_t TestBit(U bit) const { return fBits & static_cast<typename std::underlying_type<U>::type>(bit); }
51 template <typename U>
52 T TestBits(U bit) const { return (fBits & static_cast<typename std::underlying_type<U>::type>(bit)); }
53
55 {
56 fBits = rhs;
57 return *this;
58 }
59 T Value() const { return fBits; }
60
61 void Clear() { fBits = 0; }
62 void Print() const { std::cout << fBits << std::endl; }
63
65};
66
67/*! @} */
68#endif /* _TTRANSIENTBITS_H_ */
void SetBit(T bit)
~TTransientBits()=default
T TestBits(U bit) const
void SetBit(T bit, Bool_t flag)
void Print() const
TTransientBits & operator=(const T &rhs)
void ClearBit(T bit)
Bool_t TestBit(U bit) const
TTransientBits(TTransientBits &&) noexcept=default
void SetBit(U bit, Bool_t flag)
Bool_t TestBit(T bit) const
TTransientBits(const TTransientBits &)=default
T TestBits(T bit) const
void ClearBit(U bit)
TTransientBits(const T &tmp)
void SetBit(U bit)