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 Attributes
reco::parser::SingleInvoker Struct Reference

#include <MethodInvoker.h>

Inheritance diagram for reco::parser::SingleInvoker:

Public Member Functions

std::pair< Reflex::Object, bool > invoke (const Reflex::Object &o, std::vector< Reflex::Object > &v) const
 
double retToDouble (const Reflex::Object &o) const
 
 SingleInvoker (const Reflex::Type &t, const std::string &name, const std::vector< AnyMethodArgument > &args)
 
void throwFailedConversion (const Reflex::Object &o) const
 
 ~SingleInvoker ()
 

Private Attributes

std::vector< MethodInvokerinvokers_
 
bool isRefGet_
 true if this invoker just pops out a ref and returns (ref.get(), false) More...
 
method::TypeCode retType_
 
Reflex::Object storage_
 
bool storageNeedsDestructor_
 

Detailed Description

A bigger brother of the MethodInvoker:

Definition at line 39 of file MethodInvoker.h.

Constructor & Destructor Documentation

SingleInvoker::SingleInvoker ( const Reflex::Type &  t,
const std::string &  name,
const std::vector< AnyMethodArgument > &  args 
)

Definition at line 134 of file MethodInvoker.cc.

References invokers_, isRefGet_, reco::parser::ExpressionVar::makeStorage(), reco::parser::MethodSetter::push(), retType_, storage_, storageNeedsDestructor_, and reco::typeCode().

137 {
138  TypeStack typeStack(1, type);
139  LazyMethodStack dummy;
140  MethodArgumentStack dummy2;
141  MethodSetter setter(invokers_, dummy, typeStack, dummy2, false);
142  isRefGet_ = !setter.push(name, args, "LazyInvoker dynamic resolution", false);
143  //std::cerr << "SingleInvoker on type " << type.Name(QUALIFIED|SCOPED) << ", name " << name << (isRefGet_ ? " is just a ref.get " : " is real") << std::endl;
145  retType_ = reco::typeCode(typeStack[1]); // typeStack[0] = type of self, typeStack[1] = type of ret
146 }
type
Definition: HCALResponse.h:22
method::TypeCode retType_
Definition: MethodInvoker.h:55
bool isRefGet_
true if this invoker just pops out a ref and returns (ref.get(), false)
Definition: MethodInvoker.h:60
std::vector< AnyMethodArgument > MethodArgumentStack
TypeCode typeCode(const Type &t)
Definition: returnType.cc:21
std::vector< LazyInvoker > LazyMethodStack
Definition: MethodStack.h:18
dictionary args
static bool makeStorage(Reflex::Object &obj, const Reflex::Member &member)
std::vector< MethodInvoker > invokers_
Definition: MethodInvoker.h:56
std::vector< Reflex::Type > TypeStack
Definition: TypeStack.h:17
SingleInvoker::~SingleInvoker ( )

Definition at line 148 of file MethodInvoker.cc.

References reco::parser::ExpressionVar::delStorage(), and storage_.

149 {
151 }
static void delStorage(Reflex::Object &obj)

Member Function Documentation

pair< Object, bool > SingleInvoker::invoke ( const Reflex::Object &  o,
std::vector< Reflex::Object > &  v 
) const

If the member is found in object o, evaluate and return (value,true) If the member is not found but o is a Ref/RefToBase/Ptr, (return o.get(), false) the actual Reflex::Object where the result is stored will be pushed in vector so that, if needed, its destructor can be called

Definition at line 154 of file MethodInvoker.cc.

References invokers_, isRefGet_, run_regression::ret, storage_, and storageNeedsDestructor_.

Referenced by reco::parser::LazyInvoker::invoke(), and reco::parser::LazyInvoker::invokeLast().

155 {
156  /* std::cerr << "[SingleInvoker::invoke] member " << invokers_.front().method().Name(QUALIFIED|SCOPED) <<
157  " of type " << o.TypeOf().Name(QUALIFIED|SCOPED) <<
158  (!isRefGet_ ? " is one shot" : " needs another round") << std::endl; */
159  pair<Object,bool> ret(invokers_.front().invoke(o, storage_), !isRefGet_);
161  //std::cout << "Storage type: " << storage_.TypeOf().Name(QUALIFIED|SCOPED) << ", I have to call the destructor." << std::endl;
162  v.push_back(storage_);
163  }
164  return ret;
165 }
bool isRefGet_
true if this invoker just pops out a ref and returns (ref.get(), false)
Definition: MethodInvoker.h:60
std::vector< MethodInvoker > invokers_
Definition: MethodInvoker.h:56
mathSSE::Vec4< T > v
double SingleInvoker::retToDouble ( const Reflex::Object &  o) const

Definition at line 168 of file MethodInvoker.cc.

References reco::parser::ExpressionVar::isValidReturnType(), reco::parser::ExpressionVar::objToDouble(), retType_, and throwFailedConversion().

Referenced by reco::parser::LazyInvoker::invokeLast().

168  {
171  }
173 }
method::TypeCode retType_
Definition: MethodInvoker.h:55
static bool isValidReturnType(method::TypeCode)
void throwFailedConversion(const Reflex::Object &o) const
static double objToDouble(const Reflex::Object &obj, method::TypeCode type)
void SingleInvoker::throwFailedConversion ( const Reflex::Object &  o) const

Definition at line 176 of file MethodInvoker.cc.

References edm::errors::Configuration, edm::hlt::Exception, and invokers_.

Referenced by retToDouble().

176  {
178  << "member \"" << invokers_.back().method().Name(QUALIFIED)
179  << "\" return type is \"" << invokers_.back().method().TypeOf().Name(QUALIFIED)
180  << "\" retured a \"" << o.TypeOf().Name(QUALIFIED)
181  << "\" which is not convertible to double.";
182 }
std::vector< MethodInvoker > invokers_
Definition: MethodInvoker.h:56

Member Data Documentation

std::vector<MethodInvoker> reco::parser::SingleInvoker::invokers_
private

Definition at line 56 of file MethodInvoker.h.

Referenced by invoke(), SingleInvoker(), and throwFailedConversion().

bool reco::parser::SingleInvoker::isRefGet_
private

true if this invoker just pops out a ref and returns (ref.get(), false)

Definition at line 60 of file MethodInvoker.h.

Referenced by invoke(), and SingleInvoker().

method::TypeCode reco::parser::SingleInvoker::retType_
private

Definition at line 55 of file MethodInvoker.h.

Referenced by retToDouble(), and SingleInvoker().

Reflex::Object reco::parser::SingleInvoker::storage_
mutableprivate

Definition at line 57 of file MethodInvoker.h.

Referenced by invoke(), SingleInvoker(), and ~SingleInvoker().

bool reco::parser::SingleInvoker::storageNeedsDestructor_
private

Definition at line 58 of file MethodInvoker.h.

Referenced by invoke(), and SingleInvoker().