CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | 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 Types

typedef tbb::concurrent_unordered_map< edm::TypeID, SingleInvokerPtr, edm::TypeIDHasherInvokerMap
 
typedef std::shared_ptr< SingleInvokerSingleInvokerPtr
 

Public Member Functions

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

Private Member Functions

const SingleInvokerinvoker (const edm::TypeWithDict &) const
 

Private Attributes

std::vector< AnyMethodArgumentargsBeforeFixups_
 
InvokerMap invokers_
 
std::string name_
 

Detailed Description

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

Definition at line 126 of file MethodInvoker.h.

Member Typedef Documentation

◆ InvokerMap

Definition at line 128 of file MethodInvoker.h.

◆ SingleInvokerPtr

Definition at line 127 of file MethodInvoker.h.

Constructor & Destructor Documentation

◆ LazyInvoker()

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

Definition at line 145 of file MethodInvoker.cc.

◆ ~LazyInvoker()

LazyInvoker::~LazyInvoker ( )

Definition at line 148 of file MethodInvoker.cc.

148 {}

Member Function Documentation

◆ invoke()

edm::ObjectWithDict LazyInvoker::invoke ( const edm::ObjectWithDict o,
std::vector< StorageManager > &  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 163 of file MethodInvoker.cc.

References reco::parser::SingleInvoker::invoke(), invoker(), EcalTangentSkim_cfg::o, runTheMatrix::ret, and findQualityFiles::v.

163  {
164  pair<edm::ObjectWithDict, bool> ret(o, false);
165  do {
166  edm::TypeWithDict type = ret.first.typeOf();
167  if (type.isClass()) {
168  type = ret.first.dynamicType();
169  }
170  ret = invoker(type).invoke(edm::ObjectWithDict(type, ret.first.address()), v);
171  } while (ret.second == false);
172  return ret.first;
173 }
const SingleInvoker & invoker(const edm::TypeWithDict &) const
ret
prodAgent to be discontinued
std::pair< edm::ObjectWithDict, bool > invoke(const edm::ObjectWithDict &o, std::vector< StorageManager > &v) const

◆ invokeLast()

double LazyInvoker::invokeLast ( const edm::ObjectWithDict o,
std::vector< StorageManager > &  v 
) const

invoke and coerce result to double

Definition at line 175 of file MethodInvoker.cc.

References mps_fire::i, invoker(), EcalTangentSkim_cfg::o, runTheMatrix::ret, and findQualityFiles::v.

175  {
176  pair<edm::ObjectWithDict, bool> ret(o, false);
177  const SingleInvoker* i = nullptr;
178  do {
179  edm::TypeWithDict type = ret.first.typeOf();
180  if (type.isClass()) {
181  type = ret.first.dynamicType();
182  }
183  i = &invoker(type);
184  ret = i->invoke(edm::ObjectWithDict(type, ret.first.address()), v);
185  } while (ret.second == false);
186  return i->retToDouble(ret.first);
187 }
const SingleInvoker & invoker(const edm::TypeWithDict &) const
ret
prodAgent to be discontinued

◆ invoker()

const SingleInvoker & LazyInvoker::invoker ( const edm::TypeWithDict type) const
private

Definition at line 150 of file MethodInvoker.cc.

References argsBeforeFixups_, newFWLiteAna::found, invokers_, and name_.

Referenced by invoke(), and invokeLast().

150  {
151  //std::cout << "LazyInvoker for " << name_ << " called on type " <<
152  // type.qualifiedName() << std::endl;
153  const edm::TypeID thetype(type.typeInfo());
154  auto found = invokers_.find(thetype);
155  if (found != invokers_.cend()) {
156  return *(found->second);
157  }
158  auto to_add = std::make_shared<SingleInvoker>(type, name_, argsBeforeFixups_);
159  auto emplace_result = invokers_.insert(std::make_pair(thetype, to_add));
160  return *(emplace_result.first->second);
161 }
std::vector< AnyMethodArgument > argsBeforeFixups_

Member Data Documentation

◆ argsBeforeFixups_

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

Definition at line 132 of file MethodInvoker.h.

Referenced by invoker().

◆ invokers_

InvokerMap reco::parser::LazyInvoker::invokers_
mutableprivate

Definition at line 136 of file MethodInvoker.h.

Referenced by invoker().

◆ name_

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

Definition at line 131 of file MethodInvoker.h.

Referenced by invoker().