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

Reflex::Object invoke (const Reflex::Object &o, std::vector< Reflex::Object > &v) const
double invokeLast (const Reflex::Object &o, std::vector< Reflex::Object > &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 Reflex::Type &t) const

Private Attributes

std::vector< AnyMethodArgumentargsBeforeFixups_
std::map< void
*, SingleInvokerPtr
invokers_
std::string name_

Detailed Description

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

Definition at line 65 of file MethodInvoker.h.


Member Typedef Documentation

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

Definition at line 79 of file MethodInvoker.h.


Constructor & Destructor Documentation

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

Definition at line 86 of file MethodInvoker.cc.

LazyInvoker::~LazyInvoker ( )

Definition at line 92 of file MethodInvoker.cc.

{
}

Member Function Documentation

Object LazyInvoker::invoke ( const Reflex::Object &  o,
std::vector< Reflex::Object > &  v 
) const

invoke method, returns object that points to result (after stripping '*' and '&') the object is still owned by the LazyInvoker the actual Reflex::Object where the result is stored will be pushed in vector so that, if needed, its destructor can be called

Definition at line 109 of file MethodInvoker.cc.

References reco::parser::SingleInvoker::invoke(), invoker(), and runTheMatrix::ret.

{
    pair<Object, bool> ret(o,false);
    do {    
        Type type = ret.first.TypeOf();
        if (type.IsClass()) type = ret.first.DynamicType();
        ret = invoker(type).invoke(Object(type, ret.first.Address()), v);
    } while (ret.second == false);
    return ret.first; 
}
double LazyInvoker::invokeLast ( const Reflex::Object &  o,
std::vector< Reflex::Object > &  v 
) const

invoke and coerce result to double

Definition at line 121 of file MethodInvoker.cc.

References i, reco::parser::SingleInvoker::invoke(), invoker(), runTheMatrix::ret, and reco::parser::SingleInvoker::retToDouble().

{
    pair<Object, bool> ret(o,false);
    const SingleInvoker *i = 0;
    do {    
        Type type = ret.first.TypeOf();
        if (type.IsClass()) type = ret.first.DynamicType();
        i = & invoker(type);
        ret = i->invoke(Object(type, ret.first.Address()), v);
    } while (ret.second == false);
    return i->retToDouble(ret.first);
}
const SingleInvoker & LazyInvoker::invoker ( const Reflex::Type &  t) const [private]

Definition at line 97 of file MethodInvoker.cc.

References argsBeforeFixups_, invokers_, and name_.

Referenced by invoke(), and invokeLast().

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

Member Data Documentation

Definition at line 78 of file MethodInvoker.h.

Referenced by invoker().

std::map<void *, SingleInvokerPtr> reco::parser::LazyInvoker::invokers_ [mutable, private]

Definition at line 80 of file MethodInvoker.h.

Referenced by invoker().

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

Definition at line 77 of file MethodInvoker.h.

Referenced by invoker().