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< 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 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 96 of file MethodInvoker.h.

Member Typedef Documentation

◆ InvokerMap

Definition at line 98 of file MethodInvoker.h.

◆ SingleInvokerPtr

Definition at line 97 of file MethodInvoker.h.

Constructor & Destructor Documentation

◆ LazyInvoker()

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

Definition at line 144 of file MethodInvoker.cc.

◆ ~LazyInvoker()

LazyInvoker::~LazyInvoker ( )

Definition at line 147 of file MethodInvoker.cc.

147 {}

Member Function Documentation

◆ invoke()

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

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

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

◆ invokeLast()

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

invoke and coerce result to double

Definition at line 174 of file MethodInvoker.cc.

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

174  {
175  pair<edm::ObjectWithDict, bool> ret(o, false);
176  const SingleInvoker* i = nullptr;
177  do {
178  edm::TypeWithDict type = ret.first.typeOf();
179  if (type.isClass()) {
180  type = ret.first.dynamicType();
181  }
182  i = &invoker(type);
183  ret = i->invoke(edm::ObjectWithDict(type, ret.first.address()), v);
184  } while (ret.second == false);
185  return i->retToDouble(ret.first);
186 }
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 149 of file MethodInvoker.cc.

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

Referenced by invoke(), and invokeLast().

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

Member Data Documentation

◆ argsBeforeFixups_

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

Definition at line 102 of file MethodInvoker.h.

Referenced by invoker().

◆ invokers_

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

Definition at line 106 of file MethodInvoker.h.

Referenced by invoker().

◆ name_

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

Definition at line 101 of file MethodInvoker.h.

Referenced by invoker().