File indexing completed on 2025-02-22 10:53:08
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef ROOT_RDF_RNEWSAMPLENOTIFIER
0012 #define ROOT_RDF_RNEWSAMPLENOTIFIER
0013
0014 #include <TNotifyLink.h>
0015
0016 #include <memory>
0017
0018 namespace ROOT {
0019 namespace Internal {
0020 namespace RDF {
0021
0022 struct RNewSampleFlag {
0023 bool fFlag = false;
0024
0025 public:
0026 void SetFlag() { fFlag = true; }
0027 void UnsetFlag() { fFlag = false; }
0028 bool CheckFlag() const { return fFlag; }
0029 bool Notify()
0030 {
0031 SetFlag();
0032 return true;
0033 }
0034 };
0035
0036 class RNewSampleNotifier {
0037
0038 std::vector<std::unique_ptr<TNotifyLink<RNewSampleFlag>>> fNotifyLink;
0039 std::vector<RNewSampleFlag> fFlags;
0040
0041 public:
0042 RNewSampleNotifier(unsigned int nSlots) : fNotifyLink(nSlots), fFlags(nSlots) {}
0043 bool CheckFlag(unsigned int slot) const { return fFlags[slot].CheckFlag(); }
0044 void SetFlag(unsigned int slot) { fFlags[slot].SetFlag(); }
0045 void UnsetFlag(unsigned int slot) { fFlags[slot].UnsetFlag(); }
0046 TNotifyLink<RNewSampleFlag> &GetChainNotifyLink(unsigned int slot)
0047 {
0048 if (fNotifyLink[slot] == nullptr)
0049 fNotifyLink[slot] = std::make_unique<TNotifyLink<RNewSampleFlag>>(&fFlags[slot]);
0050 return *fNotifyLink[slot];
0051 }
0052 };
0053 }
0054 }
0055 }
0056
0057 #endif