Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RNewSampleNotifier.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_RNEWSAMPLENOTIFIER
12#define ROOT_RDF_RNEWSAMPLENOTIFIER
13
14#include <TNotifyLink.h>
15
16#include <memory>
17
18namespace ROOT {
19namespace Internal {
20namespace RDF {
21
23 bool fFlag = false;
24
25public:
26 void SetFlag() { fFlag = true; }
27 void UnsetFlag() { fFlag = false; }
28 bool CheckFlag() const { return fFlag; }
29 bool Notify()
30 {
31 SetFlag();
32 return true;
33 }
34};
35
37 // TNotifyLink and RNewSampleFlags per processing slot
38 std::vector<std::unique_ptr<TNotifyLink<RNewSampleFlag>>> fNotifyLink;
39 std::vector<RNewSampleFlag> fFlags;
40
41public:
42 RNewSampleNotifier(unsigned int nSlots) : fNotifyLink(nSlots), fFlags(nSlots) {}
43 bool CheckFlag(unsigned int slot) const { return fFlags[slot].CheckFlag(); }
44 void SetFlag(unsigned int slot) { fFlags[slot].SetFlag(); }
45 void UnsetFlag(unsigned int slot) { fFlags[slot].UnsetFlag(); }
47 {
48 if (fNotifyLink[slot] == nullptr)
49 fNotifyLink[slot] = std::make_unique<TNotifyLink<RNewSampleFlag>>(&fFlags[slot]);
50 return *fNotifyLink[slot];
51 }
52};
53} // namespace RDF
54} // namespace Internal
55} // namespace ROOT
56
57#endif // ROOT_RDF_RDATABLOCKNOTIFIER
std::vector< std::unique_ptr< TNotifyLink< RNewSampleFlag > > > fNotifyLink
bool CheckFlag(unsigned int slot) const
TNotifyLink< RNewSampleFlag > & GetChainNotifyLink(unsigned int slot)
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...