fuzzylite  6.0
A Fuzzy Logic Control Library in C++
fl::Function::Element Struct Reference

The Element class represents a single element in a formula, be that either a function or an operator. More...

#include <Function.h>

Collaboration diagram for fl::Function::Element:

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 Elementclone () 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...
 

Detailed Description

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.

Member Enumeration Documentation

◆ Type

Determines the type of the element.

Enumerator
Operator 
Function 

Definition at line 78 of file Function.h.

Constructor & Destructor Documentation

◆ Element() [1/3]

fl::Function::Element::Element ( const std::string &  name,
const std::string &  description,
Type  type 
)

◆ Element() [2/3]

fl::Function::Element::Element ( const std::string &  name,
const std::string &  description,
Type  type,
Unary  unary,
int  precedence = 0,
int  associativity = -1 
)

◆ Element() [3/3]

fl::Function::Element::Element ( const std::string &  name,
const std::string &  description,
Type  type,
Binary  binary,
int  precedence = 0,
int  associativity = -1 
)

◆ ~Element()

virtual fl::Function::Element::~Element ( )
virtual

Member Function Documentation

◆ clone()

virtual Element* fl::Function::Element::clone ( ) const
virtual

Clones the element.

Returns
a clone of the element

◆ isFunction()

virtual bool fl::Function::Element::isFunction ( ) const
virtual

Indicates whether the element is a Type::Function.

Returns
whether the element is a Type::Function

◆ isOperator()

virtual bool fl::Function::Element::isOperator ( ) const
virtual

Indicates whether the element is a Type::Operator.

Returns
whether the element is a Type::Operator

◆ toString()

virtual std::string fl::Function::Element::toString ( ) const
virtual

Returns a description of the element and its members.

Returns
a description of the element and its members

Member Data Documentation

◆ arity

int fl::Function::Element::arity

Number of operands required.

Definition at line 92 of file Function.h.

◆ associativity

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

Binary fl::Function::Element::binary

Pointer to binary method.

Definition at line 90 of file Function.h.

◆ description

std::string fl::Function::Element::description

Description of the element.

Definition at line 84 of file Function.h.

◆ name

std::string fl::Function::Element::name

Name of the element.

Definition at line 82 of file Function.h.

◆ precedence

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

Type fl::Function::Element::type

Type of the element.

Definition at line 86 of file Function.h.

◆ unary

Unary fl::Function::Element::unary

Pointer to unary method.

Definition at line 88 of file Function.h.


The documentation for this struct was generated from the following file: