Class implementing various functions, e.g sin, cos, etc. More...
#include <ExpressionParser.h>
Public Types | |
enum | Function { NONE , ACOS , ASIN , ATAN , ABS , EXP , LOG , LOG10 , SIN , SINH , TAN , TANH , SQRT , COS , COSH , ATAN2 , MOD , POW , ROUND , TRUNC , CEIL , FLOOR , HYPOT , CATH , LIST , TUPLE , MSCALE , MINVERT , CREATE , STR , HIDDENREF , HREF , AGGREGATES , SUM , AVERAGE , STDDEV , COUNT , MIN , MAX , LAST } |
Public Types inherited from App::Expression | |
typedef std::vector< Component * > | ComponentList |
enum | DepOption { DepNormal , DepHidden , DepAll } |
Public Member Functions | |
FunctionExpression (const App::DocumentObject *_owner=nullptr, Function _f=NONE, std::string &&name=std::string(), std::vector< Expression * > _args=std::vector< Expression * >()) | |
const std::vector< Expression * > & | getArgs () const |
Function | getFunction () const |
virtual bool | isTouched () const override |
Determine whether the expressions is considered touched, i.e one or both of its arguments are touched. More... | |
virtual Expression * | simplify () const override |
Try to simplify the expression, i.e calculate all constant expressions. More... | |
virtual | ~FunctionExpression () |
Public Member Functions inherited from App::UnitExpression | |
const Base::Quantity & | getQuantity () const |
double | getScaler () const |
const Base::Unit & | getUnit () const |
const std::string | getUnitString () const |
double | getValue () const |
void | setQuantity (const Base::Quantity &_quantity) |
void | setUnit (const Base::Quantity &_quantity) |
Set unit information. More... | |
virtual Expression * | simplify () const override |
Simplify the expression. More... | |
UnitExpression (const App::DocumentObject *_owner=nullptr, const Base::Quantity &_quantity=Base::Quantity(), const std::string &_unitStr=std::string()) | |
~UnitExpression () | |
Public Member Functions inherited from App::Expression | |
virtual void | addComponent (Component *component) |
bool | adjustLinks (const std::set< App::DocumentObject * > &inList) |
Expression * | copy () const |
Expression * | eval () const |
Expression (const App::DocumentObject *_owner) | |
void | getDepObjects (std::map< App::DocumentObject *, bool > &, std::vector< std::string > *labels=nullptr) const |
std::map< App::DocumentObject *, bool > | getDepObjects (std::vector< std::string > *labels=nullptr) const |
void | getDeps (ExpressionDeps &deps, int option=DepNormal) const |
ExpressionDeps | getDeps (int option=DepNormal) const |
std::map< App::ObjectIdentifier, bool > | getIdentifiers () const |
void | getIdentifiers (std::map< App::ObjectIdentifier, bool > &) const |
App::DocumentObject * | getOwner () const |
Py::Object | getPyValue () const |
boost::any | getValueAsAny () const |
bool | hasComponent () const |
ExpressionPtr | importSubNames (const std::map< std::string, std::string > &nameMap) const |
bool | isSame (const Expression &other, bool checkComment=true) const |
virtual bool | isTouched () const |
virtual int | priority () const |
ExpressionPtr | replaceObject (const App::DocumentObject *parent, App::DocumentObject *oldObj, App::DocumentObject *newObj) const |
virtual Expression * | simplify () const =0 |
std::string | toString (bool persistent=false, bool checkPriority=false, int indent=0) const |
void | toString (std::ostream &os, bool persistent=false, bool checkPriority=false, int indent=0) const |
ExpressionPtr | updateLabelReference (App::DocumentObject *obj, const std::string &ref, const char *newLabel) const |
void | visit (ExpressionVisitor &v) |
virtual | ~Expression () |
Public Member Functions inherited from Base::BaseClass | |
BaseClass () | |
Construction. More... | |
BaseClass (const BaseClass &)=default | |
virtual PyObject * | getPyObject () |
This method returns the Python wrapper for a C++ object. More... | |
virtual Type | getTypeId () const |
bool | isDerivedFrom (const Type type) const |
BaseClass & | operator= (const BaseClass &)=default |
virtual void | setPyObject (PyObject *) |
virtual | ~BaseClass () |
Destruction. More... | |
Static Public Member Functions | |
static Py::Object | evaluate (const Expression *owner, int type, const std::vector< Expression * > &args) |
Static Public Member Functions inherited from App::Expression | |
static Component * | createComponent (const std::string &n) |
static Component * | createComponent (Expression *e1, Expression *e2=nullptr, Expression *e3=nullptr, bool isRange=false) |
static Expression * | parse (const App::DocumentObject *owner, const std::string &buffer) |
Static Public Member Functions inherited from Base::BaseClass | |
static void * | create () |
static Type | getClassTypeId () |
static void | init () |
Static Protected Member Functions | |
static Py::Object | evalAggregate (const Expression *owner, int type, const std::vector< Expression * > &args) |
Static Protected Member Functions inherited from Base::BaseClass | |
static void | initSubclass (Base::Type &toInit, const char *ClassName, const char *ParentName, Type::instantiationMethod method=nullptr) |
Protected Attributes | |
std::vector< Expression * > | args |
Function | f |
Function to execute. More... | |
std::string | fname |
Protected Attributes inherited from App::UnitExpression | |
PyObject * | cache = nullptr |
Protected Attributes inherited from App::Expression | |
ComponentList | components |
App::DocumentObject * | owner |
The document object used to access unqualified variables (i.e local scope) More... | |
Additional Inherited Members | |
Public Attributes inherited from App::Expression | |
std::string | comment |
friend | ExpressionVisitor |
Class implementing various functions, e.g sin, cos, etc.
FunctionExpression::FunctionExpression | ( | const App::DocumentObject * | _owner = nullptr , |
Function | _f = NONE , |
||
std::string && | name = std::string() , |
||
std::vector< Expression * > | _args = std::vector<Expression*>() |
||
) |
References ABS, ACOS, AGGREGATES, args, ASIN, ATAN, ATAN2, AVERAGE, CATH, CEIL, COS, COSH, COUNT, CREATE, EXP, FLOOR, HIDDENREF, HREF, HYPOT, LAST, LIST, LOG, LOG10, MAX, MIN, MINVERT, MOD, MSCALE, NONE, POW, ROUND, SIN, SINH, SQRT, STDDEV, STR, SUM, TAN, TANH, TRUNC, and TUPLE.
Referenced by simplify().
|
virtual |
References args.
|
staticprotected |
References args, AVERAGE, COUNT, Base::BaseClass::getClassTypeId(), App::ExtensionContainer::getPropertyByName(), App::PropertyQuantity::getQuantityValue(), App::RangeExpression::getRange(), App::PropertyInteger::getValue(), App::PropertyFloat::getValue(), MAX, MIN, App::Expression::owner, App::pyFromQuantity(), App::pyToQuantity(), STDDEV, and SUM.
Referenced by evaluate().
|
static |
References ABS, ACOS, AGGREGATES, args, ASIN, ATAN, ATAN2, CATH, CEIL, COS, COSH, CREATE, evalAggregate(), EXP, FLOOR, Base::fmod(), Base::BaseClass::getClassTypeId(), App::Expression::getOwner(), App::Expression::getPyValue(), HIDDENREF, HREF, HYPOT, LIST, LOG, LOG10, MINVERT, MOD, MSCALE, POW, Base::pow(), App::pyToQuantity(), ROUND, SIN, SINH, SQRT, STR, TAN, TANH, TRUNC, TUPLE, and draftgeoutils.general::vec().
Referenced by Spreadsheet_legacy.Spreadsheet::evaluate(), and Spreadsheet_legacy.Spreadsheet::isNumeric().
const std::vector< Expression * > & App::FunctionExpression::getArgs | ( | ) | const |
Function App::FunctionExpression::getFunction | ( | ) | const |
|
overridevirtual |
Determine whether the expressions is considered touched, i.e one or both of its arguments are touched.
Reimplemented from App::Expression.
References args.
|
overridevirtual |
Try to simplify the expression, i.e calculate all constant expressions.
Reimplemented from App::UnitExpression.
References args, App::Expression::eval(), fname, FunctionExpression(), App::Expression::owner, and App::Expression::simplify().
|
protected |
Referenced by evalAggregate(), evaluate(), FunctionExpression(), isTouched(), MengerSponge.MengerThread::run(), simplify(), and ~FunctionExpression().
|
protected |
Function to execute.
|
protected |
Referenced by simplify().