|
ROOT
ROOT project
|
Base class for function parsers. More...
#include <function_parser.hpp>


Public Member Functions | |
| virtual | ~FunctionParserBase ()=default |
| virtual std::function< double(double)> | parse ()=0 |
| Pure virtual method to parse the function string. | |
| FunctionParserBase (std::string function_str) | |
| Constructor for FunctionParserBase. | |
Static Public Member Functions | |
| static std::function< double(double)> | parseFunction (const std::string &function_str) |
| Static method to parse a function string and return a callable function. | |
| static bool | isPolynomial (const std::string &expression) |
| Static method to check if the expression is a polynomial. | |
| static bool | isTrigonometric (const std::string &expression) |
| Static method to check if the expression is a trigonometric function. | |
Static Protected Member Functions | |
| static bool | icontains (const std::string &hay, const std::string &needle) |
| Helper static method to check if a string contains a substring (case-insensitive). | |
| static std::string | removeSpaces (const std::string &function_str) |
| Helper static method to remove all whitespace from a string. | |
| static std::vector< std::string > | splitSignTokens (const std::string &expr_no_ws) |
| Helper static method to split an expression into tokens based on sign characters. | |
| static std::pair< double, std::string > | parseOptionalCoefficient (const std::string &token) |
| Helper static method to parse an optional coefficient from a token. | |
Protected Attributes | |
| std::string | function_str |
| The function string to be parsed. | |
Friends | |
| class | FunctionParserBaseTester |
| Friend test fixture class for unit testing. | |
Base class for function parsers.
This abstract class defines the interface for parsing mathematical functions from strings. It includes static methods for dispatching to specific parser subclasses based on the type of function (e.g., polynomial, trigonometric).
|
virtualdefault |
| FunctionParserBase::FunctionParserBase | ( | std::string | function_str | ) |
Constructor for FunctionParserBase.
| function_str | The string representation of the function to be parsed. |
|
staticprotected |
Helper static method to check if a string contains a substring (case-insensitive).
| hay | The string to search within. |
| needle | The substring to search for. |

|
inlinestatic |
Static method to check if the expression is a polynomial.
| expression | The expression string to check. |


|
inlinestatic |
Static method to check if the expression is a trigonometric function.
| expression | The expression string to check. |


|
pure virtual |
Pure virtual method to parse the function string.
Implemented in PolynomialParser, and TrigonometricParser.
|
static |
Static method to parse a function string and return a callable function.
This method determines the type of function represented by the input string and delegates parsing to the appropriate subclass parser.
| function_str | The string representation of the function to be parsed. |


|
staticprotected |
Helper static method to parse an optional coefficient from a token.
| token | The token string to parse. |

|
staticprotected |
Helper static method to remove all whitespace from a string.
| function_str | The input string. |

|
staticprotected |
Helper static method to split an expression into tokens based on sign characters.
| expr_no_ws | The expression string with no whitespace. |

|
friend |
Friend test fixture class for unit testing.
|
protected |
The function string to be parsed.