CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
reco::parser::SingleInvoker Struct Reference

#include <MethodInvoker.h>

Inheritance diagram for reco::parser::SingleInvoker:

Public Member Functions

std::pair< edm::ObjectWithDict, bool > invoke (const edm::ObjectWithDict &o, std::vector< edm::ObjectWithDict > &v) const
 
double retToDouble (const edm::ObjectWithDict &) const
 convert the output of invoke to a double, if possible More...
 
 SingleInvoker (const edm::TypeWithDict &, const std::string &name, const std::vector< AnyMethodArgument > &args)
 
void throwFailedConversion (const edm::ObjectWithDict &) const
 
 ~SingleInvoker ()
 

Private Attributes

std::vector< MethodInvokerinvokers_
 
bool isRefGet_
 true if this invoker just pops out a ref and returns (ref.get(), false) More...
 
method::TypeCode retType_
 
edm::ObjectWithDict storage_
 
bool storageNeedsDestructor_
 

Detailed Description

A bigger brother of the MethodInvoker:

Definition at line 65 of file MethodInvoker.h.

Constructor & Destructor Documentation

◆ SingleInvoker()

SingleInvoker::SingleInvoker ( const edm::TypeWithDict type,
const std::string &  name,
const std::vector< AnyMethodArgument > &  args 
)

Definition at line 188 of file MethodInvoker.cc.

190  {
191  TypeStack typeStack(1, type);
193  MethodArgumentStack dummy2;
194  MethodSetter setter(invokers_, dummy, typeStack, dummy2, false);
195  isRefGet_ = !setter.push(name, args, "LazyInvoker dynamic resolution", false);
196  //std::cerr << "SingleInvoker on type " << type.qualifiedName() <<
197  // ", name " << name << (isRefGet_ ? " is just a ref.get " : " is real") <<
198  // std::endl;
199  if (invokers_.front().isFunction()) {
200  edm::TypeWithDict retType = invokers_.front().method().finalReturnType();
202  } else {
204  storageNeedsDestructor_ = false;
205  }
206  // typeStack[0] = type of self
207  // typeStack[1] = type of ret
208  retType_ = reco::typeCode(typeStack[1]);
209 }

References writedatasetfile::args, invokers_, isRefGet_, reco::parser::ExpressionVar::makeStorage(), Skims_PA_cff::name, reco::parser::MethodSetter::push(), retType_, storage_, storageNeedsDestructor_, and reco::typeCode().

◆ ~SingleInvoker()

SingleInvoker::~SingleInvoker ( )

Member Function Documentation

◆ invoke()

pair< edm::ObjectWithDict, bool > SingleInvoker::invoke ( const edm::ObjectWithDict o,
std::vector< edm::ObjectWithDict > &  v 
) const

If the member is found in object o, evaluate and return (value,true) If the member is not found but o is a Ref/RefToBase/Ptr, (return o.get(), false) the actual edm::ObjectWithDict where the result is stored will be pushed in vector so that, if needed, its destructor can be called

Definition at line 213 of file MethodInvoker.cc.

214  {
215  // std::cerr << "[SingleInvoker::invoke] member " <<
216  // invokers_.front().method().qualifiedName() <<
217  // " of type " <<
218  // o.typeOf().qualifiedName() <<
219  // (!isRefGet_ ? " is one shot" : " needs another round") <<
220  // std::endl;
221  pair<edm::ObjectWithDict, bool> ret(invokers_.front().invoke(o, storage_), !isRefGet_);
223  //std::cerr << "Storage type: " << storage_.typeOf().qualifiedName() <<
224  // ", I have to call the destructor." << std::endl;
225  v.push_back(storage_);
226  }
227  return ret;
228 }

References invokers_, isRefGet_, EcalTangentSkim_cfg::o, runTheMatrix::ret, storage_, storageNeedsDestructor_, and findQualityFiles::v.

Referenced by reco::parser::LazyInvoker::invoke().

◆ retToDouble()

double SingleInvoker::retToDouble ( const edm::ObjectWithDict o) const

convert the output of invoke to a double, if possible

Definition at line 230 of file MethodInvoker.cc.

230  {
233  }
235 }

References reco::parser::ExpressionVar::isValidReturnType(), EcalTangentSkim_cfg::o, reco::parser::ExpressionVar::objToDouble(), retType_, and throwFailedConversion().

◆ throwFailedConversion()

void SingleInvoker::throwFailedConversion ( const edm::ObjectWithDict o) const

Definition at line 237 of file MethodInvoker.cc.

237  {
239  << "member \"" << invokers_.back().methodName() << "\" return type is \"" << invokers_.back().returnTypeName()
240  << "\" retured a \"" << o.typeOf().qualifiedName() << "\" which is not convertible to double.";
241 }

References edm::errors::Configuration, Exception, invokers_, and EcalTangentSkim_cfg::o.

Referenced by retToDouble().

Member Data Documentation

◆ invokers_

std::vector<MethodInvoker> reco::parser::SingleInvoker::invokers_
private

Definition at line 68 of file MethodInvoker.h.

Referenced by invoke(), SingleInvoker(), and throwFailedConversion().

◆ isRefGet_

bool reco::parser::SingleInvoker::isRefGet_
private

true if this invoker just pops out a ref and returns (ref.get(), false)

Definition at line 72 of file MethodInvoker.h.

Referenced by invoke(), and SingleInvoker().

◆ retType_

method::TypeCode reco::parser::SingleInvoker::retType_
private

Definition at line 67 of file MethodInvoker.h.

Referenced by retToDouble(), and SingleInvoker().

◆ storage_

edm::ObjectWithDict reco::parser::SingleInvoker::storage_
mutableprivate

Definition at line 69 of file MethodInvoker.h.

Referenced by invoke(), SingleInvoker(), and ~SingleInvoker().

◆ storageNeedsDestructor_

bool reco::parser::SingleInvoker::storageNeedsDestructor_
private

Definition at line 70 of file MethodInvoker.h.

Referenced by invoke(), and SingleInvoker().

runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:355
writedatasetfile.args
args
Definition: writedatasetfile.py:18
edm::ObjectWithDict
Definition: ObjectWithDict.h:17
reco::parser::SingleInvoker::storage_
edm::ObjectWithDict storage_
Definition: MethodInvoker.h:69
reco::parser::SingleInvoker::storageNeedsDestructor_
bool storageNeedsDestructor_
Definition: MethodInvoker.h:70
findQualityFiles.v
v
Definition: findQualityFiles.py:179
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:36
reco::parser::SingleInvoker::invokers_
std::vector< MethodInvoker > invokers_
Definition: MethodInvoker.h:68
reco::parser::SingleInvoker::isRefGet_
bool isRefGet_
true if this invoker just pops out a ref and returns (ref.get(), false)
Definition: MethodInvoker.h:72
reco::typeCode
TypeCode typeCode(const edm::TypeWithDict &t)
Definition: returnType.cc:39
edm::TypeWithDict
Definition: TypeWithDict.h:38
reco::parser::SingleInvoker::throwFailedConversion
void throwFailedConversion(const edm::ObjectWithDict &) const
Definition: MethodInvoker.cc:237
reco::parser::TypeStack
std::vector< edm::TypeWithDict > TypeStack
Definition: TypeStack.h:17
reco::parser::ExpressionVar::objToDouble
static double objToDouble(const edm::ObjectWithDict &obj, method::TypeCode type)
Definition: ExpressionVar.cc:142
reco::parser::ExpressionVar::delStorage
static void delStorage(edm::ObjectWithDict &)
Definition: ExpressionVar.cc:45
reco::parser::SingleInvoker::retType_
method::TypeCode retType_
Definition: MethodInvoker.h:67
type
type
Definition: HCALResponse.h:21
reco::parser::ExpressionVar::makeStorage
static bool makeStorage(edm::ObjectWithDict &obj, const edm::TypeWithDict &retType)
Definition: ExpressionVar.cc:60
reco::parser::MethodSetter
Definition: MethodSetter.h:17
reco::parser::LazyMethodStack
std::vector< LazyInvoker > LazyMethodStack
Definition: MethodStack.h:18
Exception
Definition: hltDiff.cc:246
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
reco::parser::MethodArgumentStack
std::vector< AnyMethodArgument > MethodArgumentStack
Definition: MethodArgumentStack.h:17
dummy
Definition: DummySelector.h:38
reco::parser::ExpressionVar::isValidReturnType
static bool isValidReturnType(method::TypeCode)
Definition: ExpressionVar.cc:78
edm::errors::Configuration
Definition: EDMException.h:36