ParseExp.cpp File Reference

functions to parse expressions from strings More...

#include <exception>
#include <stack>
#include <queue>
#include <map>
#include <functional>
#include <math.h>
#include <cstdlib>
#include "ParseExp.h"
#include "hugin_utils/utils.h"
#include <panodata/ImageVariableTranslate.h>
#include "panodata/image_variables.h"

Include dependency graph for ParseExp.cpp:

Go to the source code of this file.

Namespaces

namespace  Parser
namespace  Parser::ShuntingYard
namespace  Parser::ShuntingYard::RPNTokens
namespace  Parser::ShuntingYard::Operators

Classes

class  Parser::ShuntingYard::ParseException
 internal exception class for all errors More...
class  Parser::ShuntingYard::RPNTokens::TokenBase
 abstract base class More...
class  Parser::ShuntingYard::RPNTokens::NumericToken
 single numeric token on rpn queue More...
class  Parser::ShuntingYard::RPNTokens::FunctionToken
 unary operator or function on rpn queue More...
class  Parser::ShuntingYard::RPNTokens::BinaryToken
 binary operator on rpn stack More...
class  Parser::ShuntingYard::RPNTokens::IfToken
 if operator on rpn stack More...
class  Parser::ShuntingYard::Operators::OperatorBase
 base class for operator on shunting yards operator stack More...
class  Parser::ShuntingYard::Operators::FunctionOperator
 function or unary operator on shunting yards operator stack More...
class  Parser::ShuntingYard::Operators::BinaryOperator
 binary operator on stack on shunting yards operator stack More...
class  Parser::ShuntingYard::Operators::IfOperator
 if operator on operator stack, used only for ':' token More...

Defines

#define _USE_MATH_DEFINES
#define image_variable(name, type, default_value)
#define image_variable(name, type, default_value)

Typedefs

typedef std::map< std::string,
double > 
Parser::ConstantMap

Functions

void Parser::ShuntingYard::ClearQueue (std::queue< RPNTokens::TokenBase * > &input)
 clear the queue
std::string Parser::ShuntingYard::RemoveWhiteSpaces (const std::string &text)
 remove all whitespaces and convert to lowercase
void Parser::ShuntingYard::InitParser ()
 initialize some internal variables
void Parser::ShuntingYard::CleanUpParser ()
 clean up some internal static variables
std::string Parser::ShuntingYard::FindOperator (const std::string &searchString)
 compare the first characters in string with supportedBinaryOperations, return longest match
bool Parser::ShuntingYard::ConvertToRPN (const std::string &expression, const ConstantMap &constants, std::queue< RPNTokens::TokenBase * > &rpn)
 convert expression to RPN *
bool Parser::ShuntingYard::EvaluateRPN (std::queue< RPNTokens::TokenBase * > &input, double &result)
 evaluate RPN in input
bool Parser::ParseExpression (const std::string &expression, double &result, const ConstantMap &constants, std::string &error)
 parse complete expression in 2 steps
void Parser::ParseSingleVar (ParseVarVec &varVec, const std::string &s, std::ostream &errorStream)
void Parser::ParseVariableString (ParseVarVec &parseVec, const std::string &input, std::ostream &errorStream, void(*func)(ParseVarVec &, const std::string &, std::ostream &))
 parse complete variables string
bool Parser::UpdateSingleVar (HuginBase::Panorama &pano, const Parser::ParseVar &parseVar, const Parser::ConstantMap &constants, size_t imgNr, std::ostream &statusStream, std::ostream &errorStream)
bool Parser::CalculateConstant (HuginBase::Panorama &pano, const Parser::ParseVar &parseVar, Parser::ConstantMap &constants, std::ostream &statusStream, std::ostream &errorStream)

Variables

static std::map< std::string,
Operators::OperatorBase * > 
Parser::ShuntingYard::supportedBinaryOperations
static Operators::OperatorBase * Parser::ShuntingYard::parenthesesOperator = nullptr
static Operators::OperatorBase * Parser::ShuntingYard::ifOperator = nullptr
static Operators::OperatorBase * Parser::ShuntingYard::ifOperatorClose = nullptr
static std::map< std::string,
Operators::FunctionOperator * > 
Parser::ShuntingYard::supportedFunctions


Detailed Description

functions to parse expressions from strings

Author:
T. Modes

Definition in file ParseExp.cpp.


Define Documentation

#define _USE_MATH_DEFINES

Definition at line 33 of file ParseExp.cpp.

#define image_variable ( name,
type,
default_value   ) 

Value:

if (HuginBase::PTOVariableConverterFor##name::checkApplicability(var.varname))\
    {\
        if(img1.name##isLinked())\
        {\
            for(size_t k=j+1; k<pano.getNrOfImages(); k++)\
            {\
                if(img1.name##isLinkedWith(pano.getImage(k)))\
                {\
                    updatedImgs.insert(k);\
                }\
            };\
        };\
    };

#define image_variable ( name,
type,
default_value   ) 

Value:

if (HuginBase::PTOVariableConverterFor##name::checkApplicability(var.varname))\
    {\
        return true;\
    };


Generated on 24 Nov 2017 for Hugintrunk by  doxygen 1.4.7