00001 #include "PhysicsTools/Utilities/src/ExpressionVarSetter.h" 00002 #include "PhysicsTools/Utilities/src/ExpressionVar.h" 00003 #include "PhysicsTools/Utilities/src/returnType.h" 00004 #include "PhysicsTools/Utilities/interface/Exception.h" 00005 #include <string> 00006 using namespace reco::parser; 00007 using namespace std; 00008 using namespace ROOT::Reflex; 00009 00010 void ExpressionVarSetter::operator()(const char * begin, const char* end) const { 00011 Type type = typeStack_.back(); 00012 method::TypeCode retType = reco::typeCode(type); 00013 if(retType == method::invalid) 00014 throw Exception(begin) 00015 << "member \"" << methStack_.back().method().Name() << "\" has an invalid return type: \"" 00016 << methStack_.back().method().TypeOf().Name() << "\""; 00017 if(!ExpressionVar::isValidReturnType(retType)) 00018 throw Exception(begin) 00019 << "member \"" << methStack_.back().method().Name() 00020 << "\" return type is \"" << methStack_.back().method().TypeOf().Name() 00021 << "\" which is not convertible to double."; 00022 00023 exprStack_.push_back(boost::shared_ptr<ExpressionBase>(new ExpressionVar(methStack_, retType))); 00024 methStack_.clear(); 00025 typeStack_.resize(1); 00026 }