CommonTools
Utils
src
BinarySelectorSetter.h
Go to the documentation of this file.
1
#ifndef CommonTools_Utils_BinarySelectorSetter_h
2
#define CommonTools_Utils_BinarySelectorSetter_h
3
/* \class reco::parser::BinarySelectorSetter
4
*
5
* Binary selector setter
6
*
7
* \author original version: Chris Jones, Cornell,
8
* adapted by Luca Lista, INFN
9
*
10
* \version $Revision: 1.2 $
11
*
12
*/
13
#include "
CommonTools/Utils/src/SelectorStack.h
"
14
#include "
CommonTools/Utils/src/ComparisonStack.h
"
15
#include "
CommonTools/Utils/src/ExpressionStack.h
"
16
#include "
CommonTools/Utils/src/BinarySelector.h
"
17
#include "
CommonTools/Utils/interface/Exception.h
"
18
19
namespace
reco
{
20
namespace
parser
{
21
class
BinarySelectorSetter
{
22
public
:
23
BinarySelectorSetter
(
SelectorStack
& selStack,
ComparisonStack
& cmpStack,
ExpressionStack
& expStack)
24
:
selStack_
(selStack),
cmpStack_
(cmpStack),
expStack_
(expStack) {}
25
26
void
operator()
(
const
char
* begin,
const
char
*)
const
{
27
if
(
expStack_
.empty())
28
throw
Exception
(begin) <<
"Grammar error: empty expression stack. Please contact developer."
;
29
if
(
cmpStack_
.empty())
30
throw
Exception
(begin) <<
"Grammar error: empty comparator stack. Please contact developer."
31
<<
"\""
;
32
std::shared_ptr<ExpressionBase> rhs =
expStack_
.back();
33
expStack_
.pop_back();
34
std::shared_ptr<ExpressionBase> lhs =
expStack_
.back();
35
expStack_
.pop_back();
36
std::shared_ptr<ComparisonBase>
comp
=
cmpStack_
.back();
37
cmpStack_
.pop_back();
38
#ifdef BOOST_SPIRIT_DEBUG
39
BOOST_SPIRIT_DEBUG_OUT <<
"pushing binary selector"
<< std::endl;
40
#endif
41
selStack_
.push_back(
SelectorPtr
(
new
BinarySelector
(lhs,
comp
, rhs)));
42
}
43
44
private
:
45
SelectorStack
&
selStack_
;
46
ComparisonStack
&
cmpStack_
;
47
ExpressionStack
&
expStack_
;
48
};
49
}
// namespace parser
50
}
// namespace reco
51
52
#endif
reco::parser::BinarySelectorSetter::operator()
void operator()(const char *begin, const char *) const
Definition:
BinarySelectorSetter.h:26
reco::parser::BinarySelectorSetter::expStack_
ExpressionStack & expStack_
Definition:
BinarySelectorSetter.h:47
SelectorStack.h
writedatasetfile.parser
parser
Definition:
writedatasetfile.py:7
reco
fixed size matrix
Definition:
AlignmentAlgorithmBase.h:45
AlCaHLTBitMon_QueryRunRegistry.comp
comp
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:249
reco::parser::BinarySelectorSetter::BinarySelectorSetter
BinarySelectorSetter(SelectorStack &selStack, ComparisonStack &cmpStack, ExpressionStack &expStack)
Definition:
BinarySelectorSetter.h:23
reco::parser::BinarySelectorSetter::selStack_
SelectorStack & selStack_
Definition:
BinarySelectorSetter.h:45
Exception.h
ExpressionStack.h
ComparisonStack.h
reco::parser::BinarySelector
Definition:
BinarySelector.h:19
reco::parser::BinarySelectorSetter
Definition:
BinarySelectorSetter.h:21
reco::parser::BinarySelectorSetter::cmpStack_
ComparisonStack & cmpStack_
Definition:
BinarySelectorSetter.h:46
reco::parser::SelectorPtr
std::shared_ptr< SelectorBase > SelectorPtr
Definition:
SelectorPtr.h:18
Exception
Definition:
hltDiff.cc:246
reco::parser::ExpressionStack
std::vector< std::shared_ptr< ExpressionBase > > ExpressionStack
Definition:
ExpressionStack.h:19
reco::parser::ComparisonStack
std::vector< std::shared_ptr< ComparisonBase > > ComparisonStack
Definition:
ComparisonStack.h:19
BinarySelector.h
reco::parser::SelectorStack
std::vector< SelectorPtr > SelectorStack
Definition:
SelectorStack.h:18
Generated for CMSSW Reference Manual by
1.8.16