ROOT
ROOT project
Loading...
Searching...
No Matches
Public Member Functions | Static Private Member Functions | Friends | List of all members
PolynomialParser Class Reference

Parser class for polynomial functions. More...

#include <function_parser.hpp>

Inheritance diagram for PolynomialParser:
Inheritance graph
Collaboration diagram for PolynomialParser:
Collaboration graph

Public Member Functions

 PolynomialParser (std::string function_str)
 Constructor for PolynomialParser.
 
std::function< double(double)> parse () override
 Parse the polynomial function string.
 
- Public Member Functions inherited from FunctionParserBase
virtual ~FunctionParserBase ()=default
 
 FunctionParserBase (std::string function_str)
 Constructor for FunctionParserBase.
 

Static Private Member Functions

static bool parseTokenAsPolyTerm (const std::string &raw_token, std::function< double(double)> &out_term)
 Helper static method to parse a token as a polynomial term.
 

Friends

class PolynomialParserTester
 Friend test fixture class for unit testing.
 

Additional Inherited Members

- Static Public Member Functions inherited from FunctionParserBase
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 inherited from FunctionParserBase
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 inherited from FunctionParserBase
std::string function_str
 The function string to be parsed.
 

Detailed Description

Parser class for polynomial functions.

This class extends FunctionParserBase and implements parsing logic specific to polynomial functions.

Constructor & Destructor Documentation

◆ PolynomialParser()

PolynomialParser::PolynomialParser ( std::string  function_str)

Constructor for PolynomialParser.

Parameters
function_strThe string representation of the polynomial function to be parsed.

Member Function Documentation

◆ parse()

std::function< double(double)> PolynomialParser::parse ( )
overridevirtual

Parse the polynomial function string.

Returns
A std::function<double(double)> representing the parsed polynomial function.

Implements FunctionParserBase.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parseTokenAsPolyTerm()

bool PolynomialParser::parseTokenAsPolyTerm ( const std::string &  raw_token,
std::function< double(double)> &  out_term 
)
staticprivate

Helper static method to parse a token as a polynomial term.

Parameters
raw_tokenThe token string to parse.
out_termA reference to store the resulting polynomial term function.
Returns
true if the token was successfully parsed as a polynomial term, false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ PolynomialParserTester

friend class PolynomialParserTester
friend

Friend test fixture class for unit testing.


The documentation for this class was generated from the following files: