CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
reco::parser::ExpressionVarSetter Struct Reference

#include <ExpressionVarSetter.h>

Public Member Functions

 ExpressionVarSetter (ExpressionStack &exprStack, MethodStack &methStack, LazyMethodStack &lazyMethStack, TypeStack &typeStack)
 
void operator() (const char *, const char *) const
 

Private Member Functions

void lazyPush (const char *, const char *) const
 
void push (const char *, const char *) const
 

Private Attributes

ExpressionStackexprStack_
 
LazyMethodStacklazyMethStack_
 
MethodStackmethStack_
 
TypeStacktypeStack_
 

Detailed Description

Definition at line 19 of file ExpressionVarSetter.h.

Constructor & Destructor Documentation

◆ ExpressionVarSetter()

reco::parser::ExpressionVarSetter::ExpressionVarSetter ( ExpressionStack exprStack,
MethodStack methStack,
LazyMethodStack lazyMethStack,
TypeStack typeStack 
)
inline

Definition at line 20 of file ExpressionVarSetter.h.

24  : exprStack_(exprStack), methStack_(methStack), lazyMethStack_(lazyMethStack), typeStack_(typeStack) {}

Member Function Documentation

◆ lazyPush()

void ExpressionVarSetter::lazyPush ( const char *  begin,
const char *  end 
) const
private

Definition at line 36 of file ExpressionVarSetter.cc.

36  {
37  exprStack_.push_back(std::shared_ptr<ExpressionBase>(new ExpressionLazyVar(lazyMethStack_)));
38  lazyMethStack_.clear();
39  typeStack_.resize(1);
40 }

◆ operator()()

void ExpressionVarSetter::operator() ( const char *  begin,
const char *  end 
) const

Definition at line 9 of file ExpressionVarSetter.cc.

9  {
10  //std::cerr << "ExpressionVarSetter: Pushed [" << std::string(begin,end) << "]" << std::endl;
11  if (!methStack_.empty())
12  push(begin, end);
13  else if (!lazyMethStack_.empty())
14  lazyPush(begin, end);
15  else
16  throw Exception(begin) << " Expression didn't parse neither hastily nor lazyly. This must not happen.\n";
17 }

References begin, end, and Exception.

◆ push()

void ExpressionVarSetter::push ( const char *  begin,
const char *  end 
) const
private

Definition at line 19 of file ExpressionVarSetter.cc.

19  {
22  if (retType == method::invalid) {
23  throw Exception(begin) << "member \"" << methStack_.back().methodName() << "\" has an invalid return type: \""
24  << methStack_.back().returnTypeName() << "\"";
25  }
26  if (!ExpressionVar::isValidReturnType(retType)) {
27  throw Exception(begin) << "member \"" << methStack_.back().methodName() << "\" return type is \""
28  << methStack_.back().returnTypeName() << "\" which is not convertible to double.";
29  }
30 
31  exprStack_.push_back(std::shared_ptr<ExpressionBase>(new ExpressionVar(methStack_, retType)));
32  methStack_.clear();
33  typeStack_.resize(1);
34 }

References begin, Exception, reco::method::invalid, reco::parser::ExpressionVar::isValidReturnType(), and reco::typeCode().

Referenced by esMonitoring.LineHistoryEnd::write(), and esMonitoring.LineHistoryStart::write().

Member Data Documentation

◆ exprStack_

ExpressionStack& reco::parser::ExpressionVarSetter::exprStack_
private

Definition at line 31 of file ExpressionVarSetter.h.

◆ lazyMethStack_

LazyMethodStack& reco::parser::ExpressionVarSetter::lazyMethStack_
private

Definition at line 33 of file ExpressionVarSetter.h.

◆ methStack_

MethodStack& reco::parser::ExpressionVarSetter::methStack_
private

Definition at line 32 of file ExpressionVarSetter.h.

◆ typeStack_

TypeStack& reco::parser::ExpressionVarSetter::typeStack_
private

Definition at line 34 of file ExpressionVarSetter.h.

reco::parser::ExpressionVarSetter::methStack_
MethodStack & methStack_
Definition: ExpressionVarSetter.h:32
reco::parser::ExpressionVarSetter::push
void push(const char *, const char *) const
Definition: ExpressionVarSetter.cc:19
end
#define end
Definition: vmac.h:39
reco::parser::ExpressionVarSetter::lazyMethStack_
LazyMethodStack & lazyMethStack_
Definition: ExpressionVarSetter.h:33
reco::typeCode
TypeCode typeCode(const edm::TypeWithDict &t)
Definition: returnType.cc:39
edm::TypeWithDict
Definition: TypeWithDict.h:38
reco::parser::ExpressionVar
Evaluate an object's method or datamember (or chain of them) to get a number.
Definition: ExpressionVar.h:23
reco::method::TypeCode
TypeCode
Definition: TypeCode.h:13
reco::parser::ExpressionVarSetter::exprStack_
ExpressionStack & exprStack_
Definition: ExpressionVarSetter.h:31
type
type
Definition: HCALResponse.h:21
reco::parser::ExpressionLazyVar
Definition: ExpressionVar.h:58
reco::method::invalid
Definition: TypeCode.h:26
Exception
Definition: hltDiff.cc:246
reco::parser::ExpressionVarSetter::lazyPush
void lazyPush(const char *, const char *) const
Definition: ExpressionVarSetter.cc:36
reco::parser::ExpressionVar::isValidReturnType
static bool isValidReturnType(method::TypeCode)
Definition: ExpressionVar.cc:78
reco::parser::ExpressionVarSetter::typeStack_
TypeStack & typeStack_
Definition: ExpressionVarSetter.h:34
begin
#define begin
Definition: vmac.h:32