ROOT
6.16/01
Reference Guide
tree
dataframe
src
RSlotStack.cxx
Go to the documentation of this file.
1
// Author: Enrico Guiraud, Danilo Piparo CERN 03/2017
2
3
/*************************************************************************
4
* Copyright (C) 1995-2018, 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
#include <
ROOT/TSeq.hxx
>
12
#include <
ROOT/RDF/RSlotStack.hxx
>
13
#include <
TError.h
>
// R__ASSERT
14
15
ROOT::Internal::RDF::RSlotStack::RSlotStack
(
unsigned
int
size) : fSize(size)
16
{
17
for
(
auto
i :
ROOT::TSeqU
(size))
fStack
.push(i);
18
}
19
20
void
ROOT::Internal::RDF::RSlotStack::ReturnSlot
(
unsigned
int
slot)
21
{
22
ROOT::TRWSpinLockWriteGuard
guard(fRWLock);
23
R__ASSERT
(fStack.size() < fSize &&
"Trying to put back a slot to a full stack!"
);
24
fStack.push(slot);
25
}
26
27
unsigned
int
ROOT::Internal::RDF::RSlotStack::GetSlot
()
28
{
29
ROOT::TRWSpinLockWriteGuard
guard(fRWLock);
30
R__ASSERT
(!fStack.empty() &&
"Trying to pop a slot from an empty stack!"
);
31
const
auto
slot = fStack.top();
32
fStack.pop();
33
return
slot;
34
}
RSlotStack.hxx
TError.h
R__ASSERT
#define R__ASSERT(e)
Definition:
TError.h:96
TSeq.hxx
ROOT::Internal::RDF::RSlotStack::ReturnSlot
void ReturnSlot(unsigned int slotNumber)
Definition:
RSlotStack.cxx:20
ROOT::Internal::RDF::RSlotStack::fStack
std::stack< unsigned int > fStack
Definition:
RSlotStack.hxx:29
ROOT::Internal::RDF::RSlotStack::RSlotStack
RSlotStack()=delete
ROOT::Internal::RDF::RSlotStack::GetSlot
unsigned int GetSlot()
Definition:
RSlotStack.cxx:27
ROOT::TRWSpinLockWriteGuard
Definition:
TRWSpinLock.hxx:51
ROOT::TSeq
A pseudo container class which is a generator of indices.
Definition:
TSeq.hxx:66