CMS 3D CMS Logo

Public Member Functions | Private Attributes

reco::parser::SingleInvoker Struct Reference

#include <MethodInvoker.h>

List of all members.

Public Member Functions

std::pair< edm::ObjectWithDict,
bool > 
invoke (const edm::ObjectWithDict &o, std::vector< edm::ObjectWithDict > &v) const
double retToDouble (const edm::ObjectWithDict &o) const
 SingleInvoker (const edm::TypeWithDict &t, const std::string &name, const std::vector< AnyMethodArgument > &args)
void throwFailedConversion (const edm::ObjectWithDict &o) const
 ~SingleInvoker ()

Private Attributes

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

Detailed Description

A bigger brother of the MethodInvoker:

Definition at line 47 of file MethodInvoker.h.


Constructor & Destructor Documentation

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

Definition at line 168 of file MethodInvoker.cc.

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

{
    TypeStack typeStack(1, type);
    LazyMethodStack dummy;
    MethodArgumentStack dummy2;
    MethodSetter setter(invokers_, dummy, typeStack, dummy2, false);
    isRefGet_ = !setter.push(name, args, "LazyInvoker dynamic resolution", false);
    //std::cerr  << "SingleInvoker on type " <<  type.qualifiedName() << ", name " << name << (isRefGet_ ? " is just a ref.get " : " is real") << std::endl;
    if(invokers_.front().isFunction()) {
       edm::TypeWithDict retType = invokers_.front().method().finalReturnType();
       storageNeedsDestructor_ = ExpressionVar::makeStorage(storage_, retType);
    } else {
       storage_ = edm::ObjectWithDict();
       storageNeedsDestructor_ = false;
    }
    retType_ = reco::typeCode(typeStack[1]); // typeStack[0] = type of self, typeStack[1] = type of ret
}
SingleInvoker::~SingleInvoker ( )

Member Function Documentation

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 194 of file MethodInvoker.cc.

References invokers_, isRefGet_, run_regression::ret, storage_, and storageNeedsDestructor_.

Referenced by reco::parser::LazyInvoker::invoke(), and reco::parser::LazyInvoker::invokeLast().

{
    /* std::cerr << "[SingleInvoker::invoke] member " << invokers_.front().method().qualifiedName() << 
                                       " of type " << o.typeOf().qualifiedName() <<
                                       (!isRefGet_ ? " is one shot" : " needs another round") << std::endl; */
    pair<edm::ObjectWithDict,bool> ret(invokers_.front().invoke(o, storage_), !isRefGet_);
    if (storageNeedsDestructor_) {
        //std::cout << "Storage type: " << storage_.typeOf().qualifiedName() << ", I have to call the destructor." << std::endl;
        v.push_back(storage_);
    }
    return ret;
}
double SingleInvoker::retToDouble ( const edm::ObjectWithDict o) const
void SingleInvoker::throwFailedConversion ( const edm::ObjectWithDict o) const

Definition at line 216 of file MethodInvoker.cc.

References edm::errors::Configuration, Exception, invokers_, and edm::ObjectWithDict::typeOf().

Referenced by retToDouble().

                                                                      {
    throw edm::Exception(edm::errors::Configuration)
        << "member \"" << invokers_.back().methodName()
        << "\" return type is \"" << invokers_.back().returnTypeName()
        << "\" retured a \"" << o.typeOf().qualifiedName()
        << "\" which is not convertible to double.";
}

Member Data Documentation

Definition at line 64 of file MethodInvoker.h.

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

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

Definition at line 68 of file MethodInvoker.h.

Referenced by invoke(), and SingleInvoker().

Definition at line 63 of file MethodInvoker.h.

Referenced by retToDouble(), and SingleInvoker().

Definition at line 65 of file MethodInvoker.h.

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

Definition at line 66 of file MethodInvoker.h.

Referenced by invoke(), and SingleInvoker().