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.3 2011/12/05 16:02:30 eulisse 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 "Reflex/Object.h"
14
15
template
<
typename
T,
bool
DefaultLazyness=false>
16
struct
StringObjectFunction
{
17
StringObjectFunction
(
const
std::string & expr,
bool
lazy=DefaultLazyness) :
18
type_
(Reflex::
Type
::ByTypeInfo(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_
(Reflex::
Type
::ByTypeInfo(typeid(
T
))) {
27
}
28
double
operator()
(
const
T
&
t
)
const
{
29
using namespace
Reflex;
30
Object
o
(
type_
, const_cast<T *>(& t));
31
return
expr_
->value(o);
32
}
33
34
private
:
35
reco::parser::ExpressionPtr
expr_
;
36
Reflex::Type
type_
;
37
};
38
39
#endif
StringObjectFunction
Definition:
StringObjectFunction.h:16
ExpressionBase.h
lumiQTWidget.t
tuple t
Definition:
lumiQTWidget.py:50
susybsm::HSCParticleType::Type
Type
Definition:
HSCParticle.h:20
reco::parser::ExpressionPtr
boost::shared_ptr< ExpressionBase > ExpressionPtr
Definition:
ExpressionBase.h:24
edm::errors::Configuration
Definition:
EDMException.h:40
expressionParser.h
EDMException.h
StringObjectFunction::StringObjectFunction
StringObjectFunction(const reco::parser::ExpressionPtr &expr)
Definition:
StringObjectFunction.h:24
StringObjectFunction::type_
Reflex::Type type_
Definition:
StringObjectFunction.h:36
StringObjectFunction::StringObjectFunction
StringObjectFunction(const std::string &expr, bool lazy=DefaultLazyness)
Definition:
StringObjectFunction.h:17
python.connectstrParser.o
string o
Definition:
connectstrParser.py:70
ExpressionPtr.h
edm::hlt::Exception
error
Definition:
HLTenums.h:24
StringObjectFunction::expr_
reco::parser::ExpressionPtr expr_
Definition:
StringObjectFunction.h:35
T
long double T
Definition:
Basic3DVectorLD.h:59
StringObjectFunction::operator()
double operator()(const T &t) const
Definition:
StringObjectFunction.h:28
Generated for CMSSW Reference Manual by
1.8.5