The Element class represents a single element in a formula, be that either a function or an operator. More...
#include <Function.h>
Public Types | |
enum | Type { Operator, Function } |
Determines the type of the element. More... | |
Public Member Functions | |
Element (const std::string &name, const std::string &description, Type type) | |
Element (const std::string &name, const std::string &description, Type type, Unary unary, int precedence=0, int associativity=-1) | |
Element (const std::string &name, const std::string &description, Type type, Binary binary, int precedence=0, int associativity=-1) | |
virtual | ~Element () |
virtual bool | isOperator () const |
Indicates whether the element is a Type::Operator. More... | |
virtual bool | isFunction () const |
Indicates whether the element is a Type::Function. More... | |
virtual Element * | clone () const |
Clones the element. More... | |
virtual std::string | toString () const |
Returns a description of the element and its members. More... | |
Public Attributes | |
std::string | name |
Name of the element. More... | |
std::string | description |
Description of the element. More... | |
Type | type |
Type of the element. More... | |
Unary | unary |
Pointer to unary method. More... | |
Binary | binary |
Pointer to binary method. More... | |
int | arity |
Number of operands required. More... | |
int | precedence |
Precedence of the element: clarifies which procedures should be performed first in a given mathematical expression (https://en.wikipedia.org/wiki/Order_of_operations) More... | |
int | associativity |
Associativity of the element: determines how operators of the same precedence are grouped in the absence of parentheses (https://en.wikipedia.org/wiki/Operator_associativity) More... | |
The Element class represents a single element in a formula, be that either a function or an operator.
If the Element represents a function, the function can be Unary or Binary, that is, the function take one or two parameters (respectively). Else, if the Element represents an operator, the parameters to be defined are its arity
, its precedence
, and its associativity
.
Definition at line 73 of file Function.h.
Determines the type of the element.
Enumerator | |
---|---|
Operator | |
Function |
Definition at line 78 of file Function.h.
fl::Function::Element::Element | ( | const std::string & | name, |
const std::string & | description, | ||
Type | type | ||
) |
fl::Function::Element::Element | ( | const std::string & | name, |
const std::string & | description, | ||
Type | type, | ||
Unary | unary, | ||
int | precedence = 0 , |
||
int | associativity = -1 |
||
) |
fl::Function::Element::Element | ( | const std::string & | name, |
const std::string & | description, | ||
Type | type, | ||
Binary | binary, | ||
int | precedence = 0 , |
||
int | associativity = -1 |
||
) |
|
virtual |
|
virtual |
Clones the element.
|
virtual |
Indicates whether the element is a Type::Function.
|
virtual |
Indicates whether the element is a Type::Operator.
|
virtual |
Returns a description of the element and its members.
int fl::Function::Element::arity |
Number of operands required.
Definition at line 92 of file Function.h.
int fl::Function::Element::associativity |
Associativity of the element: determines how operators of the same precedence are grouped in the absence of parentheses (https://en.wikipedia.org/wiki/Operator_associativity)
Definition at line 100 of file Function.h.
Binary fl::Function::Element::binary |
Pointer to binary method.
Definition at line 90 of file Function.h.
std::string fl::Function::Element::description |
Description of the element.
Definition at line 84 of file Function.h.
std::string fl::Function::Element::name |
Name of the element.
Definition at line 82 of file Function.h.
int fl::Function::Element::precedence |
Precedence of the element: clarifies which procedures should be performed first in a given mathematical expression (https://en.wikipedia.org/wiki/Order_of_operations)
Definition at line 96 of file Function.h.
Type fl::Function::Element::type |
Type of the element.
Definition at line 86 of file Function.h.
Unary fl::Function::Element::unary |
Pointer to unary method.
Definition at line 88 of file Function.h.