CommonTools
Utils
src
ExpressionSelectorSetter.h
Go to the documentation of this file.
1
#ifndef CommonTools_Utils_ExpressionSelectorSetter_h
2
#define CommonTools_Utils_ExpressionSelectorSetter_h
3
/* \class reco::parser::ExpressionSelectorSetter
4
*
5
* Creates an implicit Binary selector setter by comparing an expression to 0
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/ExpressionStack.h
"
15
#include "
CommonTools/Utils/src/BinarySelector.h
"
16
#include "
CommonTools/Utils/src/ExpressionNumber.h
"
17
#include "
CommonTools/Utils/src/Comparison.h
"
18
#include "
CommonTools/Utils/interface/Exception.h
"
19
20
#include <functional>
21
22
namespace
reco
{
23
namespace
parser
{
24
class
ExpressionSelectorSetter
{
25
public
:
26
ExpressionSelectorSetter
(
SelectorStack
& selStack,
ExpressionStack
& expStack)
27
:
selStack_
(selStack),
expStack_
(expStack) {}
28
29
void
operator()
(
const
char
* begin,
const
char
*)
const
{
30
if
(
expStack_
.empty())
31
throw
Exception
(begin) <<
"Grammar error: empty expression stack. Please contact developer."
32
<<
"\""
;
33
std::shared_ptr<ExpressionBase> rhs =
expStack_
.back();
34
expStack_
.pop_back();
35
std::shared_ptr<ExpressionBase> lhs(
new
ExpressionNumber
(0.0));
36
std::shared_ptr<ComparisonBase>
comp
(
new
Comparison
<std::not_equal_to<double> >());
37
#ifdef BOOST_SPIRIT_DEBUG
38
BOOST_SPIRIT_DEBUG_OUT <<
"pushing expression selector"
<< std::endl;
39
#endif
40
selStack_
.push_back(
SelectorPtr
(
new
BinarySelector
(lhs,
comp
, rhs)));
41
}
42
43
private
:
44
SelectorStack
&
selStack_
;
45
ExpressionStack
&
expStack_
;
46
};
47
}
// namespace parser
48
}
// namespace reco
49
50
#endif
reco::parser::ExpressionSelectorSetter::ExpressionSelectorSetter
ExpressionSelectorSetter(SelectorStack &selStack, ExpressionStack &expStack)
Definition:
ExpressionSelectorSetter.h:26
reco::parser::ExpressionSelectorSetter::selStack_
SelectorStack & selStack_
Definition:
ExpressionSelectorSetter.h:44
SelectorStack.h
writedatasetfile.parser
parser
Definition:
writedatasetfile.py:7
reco::parser::ExpressionSelectorSetter
Definition:
ExpressionSelectorSetter.h:24
reco
fixed size matrix
Definition:
AlignmentAlgorithmBase.h:45
ExpressionNumber.h
reco::parser::ExpressionSelectorSetter::operator()
void operator()(const char *begin, const char *) const
Definition:
ExpressionSelectorSetter.h:29
AlCaHLTBitMon_QueryRunRegistry.comp
comp
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:249
Exception.h
ExpressionStack.h
reco::parser::Comparison
Definition:
Comparison.h:18
reco::parser::BinarySelector
Definition:
BinarySelector.h:19
reco::parser::ExpressionNumber
Definition:
ExpressionNumber.h:17
reco::parser::SelectorPtr
std::shared_ptr< SelectorBase > SelectorPtr
Definition:
SelectorPtr.h:18
Exception
Definition:
hltDiff.cc:245
reco::parser::ExpressionStack
std::vector< std::shared_ptr< ExpressionBase > > ExpressionStack
Definition:
ExpressionStack.h:19
BinarySelector.h
Comparison.h
reco::parser::ExpressionSelectorSetter::expStack_
ExpressionStack & expStack_
Definition:
ExpressionSelectorSetter.h:45
reco::parser::SelectorStack
std::vector< SelectorPtr > SelectorStack
Definition:
SelectorStack.h:18
Generated for CMSSW Reference Manual by
1.8.16