Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RDataBlockNotifier.hxx
Go to the documentation of this file.
1// Author: Enrico Guiraud, 2021
2
3/*************************************************************************
4 * Copyright (C) 1995-2021, 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_RDF_RDATABLOCKNOTIFIER
12#define ROOT_RDF_RDATABLOCKNOTIFIER
13
14#include <ROOT/RMakeUnique.hxx>
15#include <TNotifyLink.h>
16
17#include <memory>
18
19namespace ROOT {
20namespace Internal {
21namespace RDF {
22
24 bool fFlag = false;
25
26public:
27 void SetFlag() { fFlag = true; }
28 void UnsetFlag() { fFlag = false; }
29 bool CheckFlag() const { return fFlag; }
30 bool Notify()
31 {
32 SetFlag();
33 return true;
34 }
35};
36
38 // TNotifyLink and RDataBlockFlags per processing slot
39 std::vector<std::unique_ptr<TNotifyLink<RDataBlockFlag>>> fNotifyLink;
40 std::vector<RDataBlockFlag> fFlags;
41
42public:
43 RDataBlockNotifier(unsigned int nSlots) : fNotifyLink(nSlots), fFlags(nSlots) {}
44 bool CheckFlag(unsigned int slot) const { return fFlags[slot].CheckFlag(); }
45 void SetFlag(unsigned int slot) { fFlags[slot].SetFlag(); }
46 void UnsetFlag(unsigned int slot) { fFlags[slot].UnsetFlag(); }
48 {
49 if (fNotifyLink[slot] == nullptr)
50 fNotifyLink[slot] = std::make_unique<TNotifyLink<RDataBlockFlag>>(&fFlags[slot]);
51 return *fNotifyLink[slot];
52 }
53};
54} // namespace RDF
55} // namespace Internal
56} // namespace ROOT
57
58#endif // ROOT_RDF_RDATABLOCKNOTIFIER
TNotifyLink< RDataBlockFlag > & GetChainNotifyLink(unsigned int slot)
std::vector< std::unique_ptr< TNotifyLink< RDataBlockFlag > > > fNotifyLink
bool CheckFlag(unsigned int slot) const
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...