NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
FunctionDefinition Class Reference

This class implements a single function definition. It is managed by the Define class. More...

#include <define.hpp>

Collaboration diagram for FunctionDefinition:

Public Member Functions

 FunctionDefinition (const std::string &_sDefinitionString="")
 Constructor of the FunctionDefinition class. Creates a definition from the passed definition string. More...
 
FunctionDefinitionoperator= (const FunctionDefinition &)
 Assignment operator overload for the Function definition class. More...
 
std::string parse (const std::string &_sArgList)
 This member function parses the call to the contained function definition and returns a function definition string containing the passed values. More...
 
std::string exportFunction () const
 This member function creates the save string used for writing to the definition file. More...
 
bool importFunction (const std::string &_sExportedString)
 This member function imports a previously exported definition string and distributes its contents along the member variables. More...
 
std::string getDefinition () const
 This member function returns the definition of the function without the appended parameters. More...
 
bool appendComment (const std::string &_sComment)
 This member function appends a comment, which might be set after the definition. More...
 

Public Attributes

std::string sName
 
std::string sSignature
 
std::string sDefinitionString
 
std::string sParsedDefinitionString
 
std::string sComment
 
std::vector< std::string > vArguments
 

Private Member Functions

bool decodeDefinition ()
 This private member function decodes the definition in the private member variable "sDefinitionString" into single fields. More...
 
bool splitAndValidateArguments ()
 This private member function validates the arguments of the function definition. More...
 
bool convertToValues ()
 This private member function converts the selected of the passed variables into their values. More...
 
bool replaceArgumentOccurences ()
 This private member function replaces all occurences of the passed arguments with the corresponding new placeholders. More...
 

Detailed Description

This class implements a single function definition. It is managed by the Define class.

Definition at line 42 of file define.hpp.

Constructor & Destructor Documentation

◆ FunctionDefinition()

FunctionDefinition::FunctionDefinition ( const std::string &  _sDefinitionString = "")

Constructor of the FunctionDefinition class. Creates a definition from the passed definition string.

Parameters
_sDefinitionStringconst string&

Definition at line 37 of file define.cpp.

References decodeDefinition(), and sDefinitionString.

Here is the call graph for this function:

Member Function Documentation

◆ appendComment()

bool FunctionDefinition::appendComment ( const std::string &  _sComment)

This member function appends a comment, which might be set after the definition.

Parameters
_sCommentconst string&
Returns
bool

Definition at line 250 of file define.cpp.

References findParameter(), getArgAtPos(), sComment, and sDefinitionString.

Here is the call graph for this function:

◆ convertToValues()

bool FunctionDefinition::convertToValues ( )
private

This private member function converts the selected of the passed variables into their values.

Returns
bool

Definition at line 422 of file define.cpp.

References checkDelimiter(), mu::ParserBase::Eval(), findParameter(), getArgAtPos(), NumeReKernel::getInstance(), NumeReKernel::getParser(), Settings::getPrecision(), NumeReKernel::getSettings(), mu::ParserBase::GetUsedVar(), sDefinitionString, mu::ParserBase::SetExpr(), sParsedDefinitionString, and toString().

Referenced by decodeDefinition().

Here is the call graph for this function:

◆ decodeDefinition()

bool FunctionDefinition::decodeDefinition ( )
private

This private member function decodes the definition in the private member variable "sDefinitionString" into single fields.

Returns
bool

Definition at line 302 of file define.cpp.

References convertToValues(), findParameter(), SyntaxError::FUNCTION_NAMES_MUST_NOT_CONTAIN_SIGN, getArgAtPos(), getMatchingParenthesis(), SyntaxError::invalid_position, isMultiValue(), SyntaxError::NO_NUMBER_AT_POS_1, replaceArgumentOccurences(), sComment, sDefinitionString, sName, sParsedDefinitionString, splitAndValidateArguments(), sSignature, and StripSpaces().

Referenced by FunctionDefinition().

Here is the call graph for this function:

◆ exportFunction()

string FunctionDefinition::exportFunction ( ) const

This member function creates the save string used for writing to the definition file.

Returns
string

Definition at line 173 of file define.cpp.

References sDefinitionString, sName, sParsedDefinitionString, and vArguments.

◆ getDefinition()

string FunctionDefinition::getDefinition ( ) const

This member function returns the definition of the function without the appended parameters.

Returns
string

Definition at line 278 of file define.cpp.

References sDefinitionString, and StripSpaces().

Referenced by FunctionDefinitionManager::defineFunc().

Here is the call graph for this function:

◆ importFunction()

bool FunctionDefinition::importFunction ( const std::string &  _sExportedString)

This member function imports a previously exported definition string and distributes its contents along the member variables.

Parameters
_sExportedStringconst string&
Returns
bool

Definition at line 195 of file define.cpp.

References findParameter(), getArgAtPos(), getMatchingParenthesis(), sComment, sDefinitionString, sName, sParsedDefinitionString, sSignature, StripSpaces(), and vArguments.

Referenced by FunctionDefinitionManager::load().

Here is the call graph for this function:

◆ operator=()

FunctionDefinition & FunctionDefinition::operator= ( const FunctionDefinition _def)

Assignment operator overload for the Function definition class.

Parameters
_defconst FunctionDefinition&
Returns
FunctionDefinition&

Definition at line 54 of file define.cpp.

References sComment, sDefinitionString, sName, sParsedDefinitionString, sSignature, and vArguments.

◆ parse()

string FunctionDefinition::parse ( const std::string &  _sArgList)

This member function parses the call to the contained function definition and returns a function definition string containing the passed values.

Parameters
_sArgListconst string&
Returns
string

Definition at line 77 of file define.cpp.

References getNextArgument(), SyntaxError::invalid_position, sDefinitionString, sParsedDefinitionString, StripSpaces(), SyntaxError::TOO_MANY_ARGS_FOR_DEFINE, and vArguments.

Here is the call graph for this function:

◆ replaceArgumentOccurences()

bool FunctionDefinition::replaceArgumentOccurences ( )
private

This private member function replaces all occurences of the passed arguments with the corresponding new placeholders.

Returns
bool

Definition at line 465 of file define.cpp.

References checkDelimiter(), sParsedDefinitionString, and vArguments.

Referenced by decodeDefinition().

Here is the call graph for this function:

◆ splitAndValidateArguments()

bool FunctionDefinition::splitAndValidateArguments ( )
private

This private member function validates the arguments of the function definition.

Returns
bool

Definition at line 373 of file define.cpp.

References SyntaxError::ELLIPSIS_MUST_BE_LAST_ARG, SyntaxError::FUNCTION_ARGS_MUST_NOT_CONTAIN_SIGN, getMatchingParenthesis(), getNextArgument(), SyntaxError::invalid_position, sDefinitionString, StripSpaces(), and vArguments.

Referenced by decodeDefinition().

Here is the call graph for this function:

Member Data Documentation

◆ sComment

std::string FunctionDefinition::sComment

Definition at line 49 of file define.hpp.

Referenced by appendComment(), decodeDefinition(), importFunction(), and operator=().

◆ sDefinitionString

std::string FunctionDefinition::sDefinitionString

◆ sName

std::string FunctionDefinition::sName

◆ sParsedDefinitionString

std::string FunctionDefinition::sParsedDefinitionString

◆ sSignature

std::string FunctionDefinition::sSignature

Definition at line 46 of file define.hpp.

Referenced by decodeDefinition(), importFunction(), and operator=().

◆ vArguments

std::vector<std::string> FunctionDefinition::vArguments

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