#include <MethodSetter.h>
Public Member Functions | |
MethodSetter (MethodStack &methStack, LazyMethodStack &lazyMethStack, TypeStack &typeStack, MethodArgumentStack &intStack, bool lazy=false) | |
void | operator() (const char *, const char *) const |
bool | push (const std::string &, const std::vector< AnyMethodArgument > &, const char *, bool deep=true) const |
Private Attributes | |
MethodArgumentStack & | intStack_ |
bool | lazy_ |
LazyMethodStack & | lazyMethStack_ |
MethodStack & | methStack_ |
TypeStack & | typeStack_ |
Definition at line 15 of file MethodSetter.h.
reco::parser::MethodSetter::MethodSetter | ( | MethodStack & | methStack, |
LazyMethodStack & | lazyMethStack, | ||
TypeStack & | typeStack, | ||
MethodArgumentStack & | intStack, | ||
bool | lazy = false |
||
) | [inline, explicit] |
Definition at line 16 of file MethodSetter.h.
: methStack_(methStack), lazyMethStack_(lazyMethStack), typeStack_(typeStack), intStack_(intStack), lazy_(lazy) { }
void MethodSetter::operator() | ( | const char * | begin, |
const char * | end | ||
) | const |
Definition at line 11 of file MethodSetter.cc.
References harvestRelVal::args, begin, Exception, i, and mergeVDriftHistosByStation::name.
{ string name(begin, end); string::size_type parenthesis = name.find_first_of('('); if (*begin == '[' || *begin == '(') { name.insert(0, "operator.."); // operator..[arg]; parenthesis = 10; // ^--- idx = 10 name[8] = *begin; // operator[.[arg]; name[9] = name[name.size()-1]; // operator[][arg]; name[10] = '('; // operator[](arg]; name[name.size()-1] = ')'; // operator[](arg); // we don't actually need the last two, but just for extra care //std::cout << "Transformed {" << string(begin,end) << "} into {"<< name <<"}" << std::endl; } std::vector<AnyMethodArgument> args; if(parenthesis != string::npos) { name.erase(parenthesis, name.size()); if(intStack_.size()==0) throw Exception(begin) << "expected method argument, but non given."; for(vector<AnyMethodArgument>::const_iterator i = intStack_.begin(); i != intStack_.end(); ++i) args.push_back(*i); intStack_.clear(); } string::size_type endOfExpr = name.find_last_of(' '); if(endOfExpr != string::npos) name.erase(endOfExpr, name.size()); //std::cerr << "Pushing [" << name << "] with " << args.size() << " args " << (lazy_ ? "(lazy)" : "(immediate)") << std::endl; if (lazy_) lazyMethStack_.push_back(LazyInvoker(name, args)); // for lazy parsing we just push method name and arguments else push(name, args,begin); // otherwise we really have to resolve the method //std::cerr << "Pushed [" << name << "] with " << args.size() << " args " << (lazy_ ? "(lazy)" : "(immediate)") << std::endl; }
bool reco::parser::MethodSetter::push | ( | const std::string & | , |
const std::vector< AnyMethodArgument > & | , | ||
const char * | , | ||
bool | deep = true |
||
) | const |
Resolve the method, push a MethodInvoker on the MethodStack and it's return type to TypeStack (after stripping "*" and "&") This method is used also by the LazyInvoker to perform the fetch once the final type is known If the object is a Ref/Ptr/RefToBase and the method is not found in that class: 1) it pushes a no-argument 'get()' method 2) if deep = true, it attempts to resolve and push the method on the object to which the edm ref points to. In that case, the MethodStack will contain two more items after this call instead of just one. This behaviour is what you want for non-lazy parsing 2b) if instead deep = false, it just pushes the 'get' on the stack. this will allow the LazyInvoker to then re-discover the runtime type of the pointee The method will:
Referenced by reco::parser::SingleInvoker::SingleInvoker().
Definition at line 39 of file MethodSetter.h.
bool reco::parser::MethodSetter::lazy_ [private] |
Definition at line 40 of file MethodSetter.h.
Definition at line 37 of file MethodSetter.h.
Definition at line 36 of file MethodSetter.h.
TypeStack& reco::parser::MethodSetter::typeStack_ [private] |
Definition at line 38 of file MethodSetter.h.