test
Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
CommonTools
Utils
interface
StringObjectFunction.h
Go to the documentation of this file.
1
#ifndef CommonTools_Utils_StringObjectFunction_h
2
#define CommonTools_Utils_StringObjectFunction_h
3
/* \class StringCutObjectSelector
4
*
5
* \author Luca Lista, INFN
6
*
7
* $Id: StringObjectFunction.h,v 1.4 2012/06/26 21:09:37 wmtan Exp $
8
*/
9
#include "
FWCore/Utilities/interface/EDMException.h
"
10
#include "
CommonTools/Utils/src/ExpressionPtr.h
"
11
#include "
CommonTools/Utils/src/ExpressionBase.h
"
12
#include "
CommonTools/Utils/interface/expressionParser.h
"
13
#include "
FWCore/Utilities/interface/ObjectWithDict.h
"
14
15
template
<
typename
T,
bool
DefaultLazyness=false>
16
struct
StringObjectFunction
{
17
StringObjectFunction
(
const
std::string
& expr,
bool
lazy=DefaultLazyness) :
18
type_
(typeid(
T
)) {
19
if
(! reco::parser::expressionParser<T>(expr,
expr_
, lazy)) {
20
throw
edm::Exception
(
edm::errors::Configuration
,
21
"failed to parse \""
+ expr +
"\""
);
22
}
23
}
24
StringObjectFunction
(
const
reco::parser::ExpressionPtr
& expr) :
25
expr_
(expr),
26
type_
(typeid(
T
)) {
27
}
28
double
operator()
(
const
T
&
t
)
const
{
29
edm::ObjectWithDict
o
(
type_
, const_cast<T *>(& t));
30
return
expr_
->value(o);
31
}
32
33
private
:
34
reco::parser::ExpressionPtr
expr_
;
35
edm::TypeWithDict
type_
;
36
};
37
38
#endif
edm::ObjectWithDict
Definition:
ObjectWithDict.h:17
StringObjectFunction
Definition:
StringObjectFunction.h:16
ExpressionBase.h
Exception
Definition:
hltDiff.cc:290
lumiQTWidget.t
tuple t
Definition:
lumiQTWidget.py:50
connectstrParser.o
string o
Definition:
connectstrParser.py:70
reco::parser::ExpressionPtr
boost::shared_ptr< ExpressionBase > ExpressionPtr
Definition:
ExpressionBase.h:22
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:255
edm::errors::Configuration
Definition:
EDMException.h:37
expressionParser.h
EDMException.h
ObjectWithDict.h
StringObjectFunction::StringObjectFunction
StringObjectFunction(const reco::parser::ExpressionPtr &expr)
Definition:
StringObjectFunction.h:24
StringObjectFunction::StringObjectFunction
StringObjectFunction(const std::string &expr, bool lazy=DefaultLazyness)
Definition:
StringObjectFunction.h:17
StringObjectFunction::type_
edm::TypeWithDict type_
Definition:
StringObjectFunction.h:35
ExpressionPtr.h
StringObjectFunction::expr_
reco::parser::ExpressionPtr expr_
Definition:
StringObjectFunction.h:34
edm::TypeWithDict
Definition:
TypeWithDict.h:38
T
long double T
Definition:
Basic3DVectorLD.h:57
StringObjectFunction::operator()
double operator()(const T &t) const
Definition:
StringObjectFunction.h:28
Generated for CMSSW Reference Manual by
1.8.5