CMS 3D CMS Logo

Public Member Functions | Private Types | Private Member Functions | Private Attributes

reco::parser::LazyInvoker Struct Reference

Keeps different SingleInvokers for each dynamic type of the objects passed to invoke() More...

#include <MethodInvoker.h>

List of all members.

Public Member Functions

edm::ObjectWithDict invoke (const edm::ObjectWithDict &o, std::vector< edm::ObjectWithDict > &v) const
double invokeLast (const edm::ObjectWithDict &o, std::vector< edm::ObjectWithDict > &v) const
 invoke and coerce result to double
 LazyInvoker (const std::string &name, const std::vector< AnyMethodArgument > &args)
 ~LazyInvoker ()

Private Types

typedef boost::shared_ptr
< SingleInvoker
SingleInvokerPtr

Private Member Functions

const SingleInvokerinvoker (const edm::TypeWithDict &t) const

Private Attributes

std::vector< AnyMethodArgumentargsBeforeFixups_
std::map< edm::TypeID,
SingleInvokerPtr
invokers_
std::string name_

Detailed Description

Keeps different SingleInvokers for each dynamic type of the objects passed to invoke()

Definition at line 73 of file MethodInvoker.h.


Member Typedef Documentation

typedef boost::shared_ptr<SingleInvoker> reco::parser::LazyInvoker::SingleInvokerPtr [private]

Definition at line 87 of file MethodInvoker.h.


Constructor & Destructor Documentation

LazyInvoker::LazyInvoker ( const std::string &  name,
const std::vector< AnyMethodArgument > &  args 
) [explicit]

Definition at line 120 of file MethodInvoker.cc.

LazyInvoker::~LazyInvoker ( )

Definition at line 126 of file MethodInvoker.cc.

{
}

Member Function Documentation

edm::ObjectWithDict LazyInvoker::invoke ( const edm::ObjectWithDict o,
std::vector< edm::ObjectWithDict > &  v 
) const

invoke method, returns object that points to result (after stripping '*' and '&') the object is still owned by the LazyInvoker 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 143 of file MethodInvoker.cc.

References reco::parser::SingleInvoker::invoke(), invoker(), edm::TypeWithDict::isClass(), and run_regression::ret.

{
    pair<edm::ObjectWithDict, bool> ret(o,false);
    do {    
        edm::TypeWithDict type = ret.first.typeOf();
        if (type.isClass()) type = ret.first.dynamicType();
        ret = invoker(type).invoke(edm::ObjectWithDict(type, ret.first.address()), v);
    } while (ret.second == false);
    return ret.first; 
}
double LazyInvoker::invokeLast ( const edm::ObjectWithDict o,
std::vector< edm::ObjectWithDict > &  v 
) const

invoke and coerce result to double

Definition at line 155 of file MethodInvoker.cc.

References i, reco::parser::SingleInvoker::invoke(), invoker(), edm::TypeWithDict::isClass(), run_regression::ret, and reco::parser::SingleInvoker::retToDouble().

{
    pair<edm::ObjectWithDict, bool> ret(o,false);
    const SingleInvoker *i = 0;
    do {    
        edm::TypeWithDict type = ret.first.typeOf();
        if (type.isClass()) type = ret.first.dynamicType();
        i = & invoker(type);
        ret = i->invoke(edm::ObjectWithDict(type, ret.first.address()), v);
    } while (ret.second == false);
    return i->retToDouble(ret.first);
}
const SingleInvoker & LazyInvoker::invoker ( const edm::TypeWithDict t) const [private]

Definition at line 131 of file MethodInvoker.cc.

References argsBeforeFixups_, edm::TypeWithDict::id(), invokers_, and name_.

Referenced by invoke(), and invokeLast().

{
    //std::cout << "LazyInvoker for " << name_ << " called on type " << type.qualifiedName() << std::endl;
    SingleInvokerPtr & invoker = invokers_[edm::TypeID(type.id())];
    if (!invoker) {
        //std::cout << "  Making new invoker for " << name_ << " on type " << type.qualifiedName() << std::endl;
        invoker.reset(new SingleInvoker(type, name_, argsBeforeFixups_));
    } 
    return * invoker;
}

Member Data Documentation

Definition at line 86 of file MethodInvoker.h.

Referenced by invoker().

Definition at line 88 of file MethodInvoker.h.

Referenced by invoker().

std::string reco::parser::LazyInvoker::name_ [private]

Definition at line 85 of file MethodInvoker.h.

Referenced by invoker().