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.

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 }

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

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

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 }

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

◆ invoker()

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

Definition at line 149 of file MethodInvoker.cc.

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 }

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

Referenced by invoke(), and invokeLast().

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

runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:542
reco::parser::SingleInvoker::invoke
std::pair< edm::ObjectWithDict, bool > invoke(const edm::ObjectWithDict &o, std::vector< edm::ObjectWithDict > &v) const
Definition: MethodInvoker.cc:213
writedatasetfile.args
args
Definition: writedatasetfile.py:18
mps_fire.i
i
Definition: mps_fire.py:428
reco::parser::SingleInvoker
Definition: MethodInvoker.h:63
edm::ObjectWithDict
Definition: ObjectWithDict.h:17
findQualityFiles.v
v
Definition: findQualityFiles.py:179
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:42
reco::parser::LazyInvoker::argsBeforeFixups_
std::vector< AnyMethodArgument > argsBeforeFixups_
Definition: MethodInvoker.h:102
reco::parser::LazyInvoker::invoker
const SingleInvoker & invoker(const edm::TypeWithDict &) const
Definition: MethodInvoker.cc:149
reco::parser::LazyInvoker::name_
std::string name_
Definition: MethodInvoker.h:101
edm::TypeWithDict
Definition: TypeWithDict.h:38
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
reco::parser::LazyInvoker::invokers_
InvokerMap invokers_
Definition: MethodInvoker.h:106
edm::TypeID
Definition: TypeID.h:22
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17