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 &) 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 90 of file MethodInvoker.h.

Member Typedef Documentation

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

Definition at line 97 of file MethodInvoker.h.

Constructor & Destructor Documentation

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

Definition at line 177 of file MethodInvoker.cc.

LazyInvoker::~LazyInvoker ( )

Definition at line 184 of file MethodInvoker.cc.

185 {
186 }

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

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

206 {
207  pair<edm::ObjectWithDict, bool> ret(o, false);
208  do {
209  edm::TypeWithDict type = ret.first.typeOf();
210  if (type.isClass()) {
211  type = ret.first.dynamicType();
212  }
213  ret = invoker(type).invoke(edm::ObjectWithDict(type, ret.first.address()), v);
214  }
215  while (ret.second == false);
216  return ret.first;
217 }
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 &) const
double LazyInvoker::invokeLast ( const edm::ObjectWithDict o,
std::vector< edm::ObjectWithDict > &  v 
) const

invoke and coerce result to double

Definition at line 221 of file MethodInvoker.cc.

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

223 {
224  pair<edm::ObjectWithDict, bool> ret(o, false);
225  const SingleInvoker* i = 0;
226  do {
227  edm::TypeWithDict type = ret.first.typeOf();
228  if (type.isClass()) {
229  type = ret.first.dynamicType();
230  }
231  i = &invoker(type);
232  ret = i->invoke(edm::ObjectWithDict(type, ret.first.address()), v);
233  }
234  while (ret.second == false);
235  return i->retToDouble(ret.first);
236 }
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
const SingleInvoker & invoker(const edm::TypeWithDict &) const
double retToDouble(const edm::ObjectWithDict &) const
convert the output of invoke to a double, if possible
const SingleInvoker & LazyInvoker::invoker ( const edm::TypeWithDict type) const
private

Definition at line 190 of file MethodInvoker.cc.

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

Referenced by invoke(), and invokeLast().

191 {
192  //std::cout << "LazyInvoker for " << name_ << " called on type " <<
193  // type.qualifiedName() << std::endl;
195  if (!invoker) {
196  //std::cout << " Making new invoker for " << name_ << " on type " <<
197  // type.qualifiedName() << std::endl;
198  invoker.reset(new SingleInvoker(type, name_, argsBeforeFixups_));
199  }
200  return *invoker;
201 }
boost::shared_ptr< SingleInvoker > SingleInvokerPtr
Definition: MethodInvoker.h:97
std::type_info const & typeInfo() const
const SingleInvoker & invoker(const edm::TypeWithDict &) const
std::vector< AnyMethodArgument > argsBeforeFixups_
Definition: MethodInvoker.h:93
std::map< edm::TypeID, SingleInvokerPtr > invokers_
Definition: MethodInvoker.h:98

Member Data Documentation

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

Definition at line 93 of file MethodInvoker.h.

Referenced by invoker().

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

Definition at line 98 of file MethodInvoker.h.

Referenced by invoker().

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

Definition at line 92 of file MethodInvoker.h.

Referenced by invoker().