CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | 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>

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 More...
 
 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.

120  :
121  name_(name),
123 {
124 }
dictionary args
std::vector< AnyMethodArgument > argsBeforeFixups_
Definition: MethodInvoker.h:86
LazyInvoker::~LazyInvoker ( )

Definition at line 126 of file MethodInvoker.cc.

127 {
128 }

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.

144 {
145  pair<edm::ObjectWithDict, bool> ret(o,false);
146  do {
147  edm::TypeWithDict type = ret.first.typeOf();
148  if (type.isClass()) type = ret.first.dynamicType();
149  ret = invoker(type).invoke(edm::ObjectWithDict(type, ret.first.address()), v);
150  } while (ret.second == false);
151  return ret.first;
152 }
type
Definition: HCALResponse.h:21
std::pair< edm::ObjectWithDict, bool > invoke(const edm::ObjectWithDict &o, std::vector< edm::ObjectWithDict > &v) const
bool isClass() const
const SingleInvoker & invoker(const edm::TypeWithDict &t) const
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().

156 {
157  pair<edm::ObjectWithDict, bool> ret(o,false);
158  const SingleInvoker *i = 0;
159  do {
160  edm::TypeWithDict type = ret.first.typeOf();
161  if (type.isClass()) type = ret.first.dynamicType();
162  i = & invoker(type);
163  ret = i->invoke(edm::ObjectWithDict(type, ret.first.address()), v);
164  } while (ret.second == false);
165  return i->retToDouble(ret.first);
166 }
type
Definition: HCALResponse.h:21
int i
Definition: DBlmapReader.cc:9
std::pair< edm::ObjectWithDict, bool > invoke(const edm::ObjectWithDict &o, std::vector< edm::ObjectWithDict > &v) const
bool isClass() const
double retToDouble(const edm::ObjectWithDict &o) const
const SingleInvoker & invoker(const edm::TypeWithDict &t) const
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().

132 {
133  //std::cout << "LazyInvoker for " << name_ << " called on type " << type.qualifiedName() << std::endl;
135  if (!invoker) {
136  //std::cout << " Making new invoker for " << name_ << " on type " << type.qualifiedName() << std::endl;
137  invoker.reset(new SingleInvoker(type, name_, argsBeforeFixups_));
138  }
139  return * invoker;
140 }
type
Definition: HCALResponse.h:21
boost::shared_ptr< SingleInvoker > SingleInvokerPtr
Definition: MethodInvoker.h:87
const SingleInvoker & invoker(const edm::TypeWithDict &t) const
std::vector< AnyMethodArgument > argsBeforeFixups_
Definition: MethodInvoker.h:86
std::map< edm::TypeID, SingleInvokerPtr > invokers_
Definition: MethodInvoker.h:88

Member Data Documentation

std::vector<AnyMethodArgument> reco::parser::LazyInvoker::argsBeforeFixups_
private

Definition at line 86 of file MethodInvoker.h.

Referenced by invoker().

std::map<edm::TypeID, SingleInvokerPtr> reco::parser::LazyInvoker::invokers_
mutableprivate

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().