CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

reco::parser::ExpressionVarSetter Struct Reference

#include <ExpressionVarSetter.h>

List of all members.

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

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

Definition at line 20 of file ExpressionVarSetter.h.

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

Member Function Documentation

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

Definition at line 36 of file ExpressionVarSetter.cc.

                                                                           {
  exprStack_.push_back(boost::shared_ptr<ExpressionBase>(new ExpressionLazyVar(lazyMethStack_)));
  lazyMethStack_.clear();
  typeStack_.resize(1);
}
void ExpressionVarSetter::operator() ( const char *  begin,
const char *  end 
) const

Definition at line 9 of file ExpressionVarSetter.cc.

References Exception.

                                                                              {
  //std::cerr << "ExpressionVarSetter: Pushed [" << std::string(begin,end) << "]" << std::endl;  
  if (!methStack_.empty())          push(begin,end);
  else if (!lazyMethStack_.empty()) lazyPush(begin,end);
  else throw Exception(begin) << " Expression didn't parse neither hastily nor lazyly. This must not happen.\n";
}
void ExpressionVarSetter::push ( const char *  begin,
const char *  end 
) const [private]

Definition at line 16 of file ExpressionVarSetter.cc.

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

                                                                       {
  edm::TypeWithDict type = typeStack_.back();
  method::TypeCode retType = reco::typeCode(type);
  if(retType == method::invalid) {
    throw  Exception(begin)
      << "member \"" << methStack_.back().methodName() << "\" has an invalid return type: \"" 
      <<  methStack_.back().returnTypeName() << "\"";
  }
  if(!ExpressionVar::isValidReturnType(retType)) {
     throw Exception(begin)
       << "member \"" << methStack_.back().methodName() 
       << "\" return type is \"" << methStack_.back().returnTypeName() 
       << "\" which is not convertible to double.";
  }
  
  exprStack_.push_back(boost::shared_ptr<ExpressionBase>(new ExpressionVar(methStack_, retType)));
  methStack_.clear();
  typeStack_.resize(1);
}

Member Data Documentation

Definition at line 34 of file ExpressionVarSetter.h.

Definition at line 36 of file ExpressionVarSetter.h.

Definition at line 35 of file ExpressionVarSetter.h.

Definition at line 37 of file ExpressionVarSetter.h.