#include <Symbol.h>
Inheritance diagram for mcSymbol:
In MathCore a symbol can be a parameter, a constant, or an unknown. Users can type any char they want, but if it is not registered in MathCore parameters, constants or unknowns lists, the symbol will be drawn with a different color, to underline that it is not recognized by MathCore.
Definition at line 450 of file Symbol.h.
Static mcSymbol functions and arrays | |
The global arrays containing the registered parameters, constants and unknowns and some related utility functions. | |
static void | InitSymbols () |
Inits the symbol arrays. | |
static void | CleanupSymbols () |
Cleanups the symbol arrays. | |
static mcSymbolArray * | math_FindSymbol (long flags, const wxString &name, wxFontEncoding enc=wxFONTENCODING_DEFAULT, const mcRealValue &value=0.0, const wxString &subscript=wxEmptyString, const wxString &inlined=wxEmptyString, int occ=0, int *entry=NULL, int skipArr=-1) |
Checks if a character is a symbol already registered. | |
static mcSymbolArray * | math_FindSymbol (long flags, const mcSymbolProperties &symtofind, int occurrence=0, int *entry=NULL, int skipArr=-1) |
static void | CheckArray (mcSymbolArray *) |
Checks the given symbol array, resolving errors. | |
static void | CheckSymbols () |
Checks the 4 symbol arrays for invalid data; it automatically deletes errors; this function is not very efficient. | |
static bool | LoadSymbols (const wxXml2Node &main, bool removeprevious=TRUE) |
Parses the given XML tree and loads the symbols stored inside. | |
static void | LoadDefaultSymbols (bool removeprevious=TRUE) |
Loads some default parameters, constants, unknowns: pigreco, the 'e' (base of the natural logarithms), Euler's gamma.... | |
static mcSymbolArray | arrParameters |
List of registered parameters. | |
static mcSymbolArray | arrConstants |
List of registered constants. | |
static mcSymbolArray | arrUnknowns |
List of registered unknowns. | |
static mcSymbolArray | arrUnregistered |
List of unregistered symbols, currently present in the math data. | |
Public Member Functions | |
mcSymbol (const mcSymbolProperties *sym) | |
mcSymbol | operator^ (const mcPolynomial &m) const |
mcSymbol & | operator^= (const mcPolynomial &m) |
virtual void | data_Update () |
data_Updates this symbol, trying to search the | |
bool | data_isValidContainerFor (mcElementType t) const |
Returns TRUE if this element can safely contain the given element type. | |
mcWRAPPER void | data_LinkWith (mcSymbolProperties *prop) |
mcWRAPPER void | data_Unlink () |
mcWRAPPER bool | data_isLinked () const |
mcWRAPPER bool | data_isLinkedWith (const mcSymbolProperties *p) const |
mcWRAPPER wxString | data_GetSubscript () const |
mcWRAPPER wxString | data_GetSymbol () const |
mcWRAPPER const mcSymbolProperties * | data_GetConstProperties () const |
Returns the properties of this symbol. | |
mcWRAPPER mcSymbolProperties * | data_GetProperties () |
Private Member Functions | |
mcDEFINE_MAIN_CLASS (Symbol, mcExpElement) |
|
Definition at line 456 of file Symbol.h. References mcObject::data_SetRefData(). |
|
Checks the given symbol array, resolving errors.
Definition at line 133 of file Symbol.cpp. References arrConstants, arrParameters, arrUnknowns, arrUnregistered, mcSymbolProperties::data_Check(), mcSymbolArray::data_GetSymbol(), mcAbstractArray::data_RemoveAt(), and SEARCH_DUPLICATE_IN. Referenced by CheckSymbols(). |
|
Checks the 4 symbol arrays for invalid data; it automatically deletes errors; this function is not very efficient.
Definition at line 155 of file Symbol.cpp. References arrConstants, arrParameters, arrUnknowns, arrUnregistered, and CheckArray(). Referenced by LoadDefaultSymbols(). |
|
Cleanups the symbol arrays.
Definition at line 193 of file Symbol.cpp. References arrConstants, arrParameters, arrUnknowns, arrUnregistered, and mcAbstractArray::data_Clear(). Referenced by mcMathCore::CleanupMath(). |
|
Returns the properties of this symbol.
Definition at line 626 of file Symbol.h. References mcWRAPPER. Referenced by mcSymbolHelpers::math_CompareThisOnly(). |
|
Definition at line 629 of file Symbol.h. References mcWRAPPER. Referenced by mcElementArrayHelpers::math_GetWrappedSymbol(). |
|
Definition at line 590 of file Symbol.h. References mcSymbolArray::data_GetSubscript(), and mcWRAPPER. |
|
Definition at line 592 of file Symbol.h. References mcSymbolArray::data_GetSymbol(), and mcWRAPPER. Referenced by mcSymbolHelpers::math_isListedBeforeOf(). |
|
Definition at line 585 of file Symbol.h. References mcWRAPPER. |
|
Definition at line 587 of file Symbol.h. References mcWRAPPER. Referenced by mcMonomialHelpers::math_GetMaxDegreeFor(). |
|
Returns TRUE if this element can safely contain the given element type. Without this function a lot of errors could be undetectable:
mcPolynomial pol; // creates a new polynomial mcElement e(pol); // references it [...] // the programmers forgots what "e" references mcFraction f(e); // mcFraction wraps a mcPolynomialHelpers class ! f.data_GetNum(); // CRASH This function must be overridden by mcElement-derived classes in order to provide a list of the mcElementType it can safely contain. Reimplemented from mcExpElement. Definition at line 576 of file Symbol.h. References mcET_SYMBOL. |
|
Definition at line 581 of file Symbol.h. References mcWRAPPER. Referenced by mcElementHelpers::math_EvaluateAt(), and mcElementHelpers::math_GetSymbolList(). |
|
Definition at line 583 of file Symbol.h. References mcWRAPPER. |
|
data_Updates this symbol, trying to search the
Reimplemented from mcElement. Definition at line 571 of file Symbol.h. References mcElement::data_Update(). |
|
Inits the symbol arrays. This function must be called before using any of the following function. Definition at line 167 of file Symbol.cpp. References arrConstants, arrParameters, arrUnknowns, arrUnregistered, and mcSymbolArray::data_LinkWithArray(). Referenced by mcMathCore::SetupMath(). |
|
Loads some default parameters, constants, unknowns: pigreco, the 'e' (base of the natural logarithms), Euler's gamma....
overwriting (if Definition at line 257 of file Symbol.cpp. References arrConstants, arrParameters, arrUnknowns, CheckSymbols(), and mcSymbolArray::data_AddSymbol(). |
|
Parses the given XML tree and loads the symbols stored inside.
If <constant> that has the following accepted properties: name = the name of the constant (must be non-empty) greek = 1 if the constant is a greek character; 0 otherwise subscript = the subscript of the constant (can be empty) inlinedoutput = the inlined representation of this constant (used when exporting as inlined expression) value = the numeric value of the constant <unknown> that accepts the same properties of <constant>, except for VALUE <param> that accepts the same properties of <constant>, except for VALUE So, a valid example of an XML tree to parse would be: <mysymbols> // the node to give to this fnc (name is not important) <param name=wxT("x") greek=wxT("0") subscript=wxT("0") inlinedoutput="a"/> <unknown name=wxT("x") greek=wxT("0") subscript=wxT("") inlinedoutput=""/> <constant name=wxT("p") greek=wxT("1") subscript=wxT("") inlinedoutput=wxT("PI") value="3.14159"/> </mysymbols>
Definition at line 201 of file Symbol.cpp. References arrConstants, arrParameters, arrUnknowns, and mcSymbolArray::data_AddSymbol(). |
|
Definition at line 114 of file Symbol.cpp. References arrConstants, arrParameters, arrUnknowns, arrUnregistered, mcSYM_CONSTANT, mcSYM_PARAMETER, mcSYM_UNKNOWN, mcSYM_UNREGISTERED, and SEARCH_IN_ARRAY2. |
|
Checks if a character is a symbol already registered. If it is, the function returns the identifier code (SYM_***) of the symbol representing the given char and fill the pointer with the entry of that symbol in the respective array; if the given char is not registered in any array, it returns SYM_NOTSET; you can also use the last two arguments to specify one entry of one array to skip.
Definition at line 84 of file Symbol.cpp. References arrConstants, arrParameters, arrUnknowns, arrUnregistered, mcSYM_CONSTANT, mcSYM_PARAMETER, mcSYM_UNKNOWN, mcSYM_UNREGISTERED, and SEARCH_IN_ARRAY. Referenced by mcSymbolHelpers::data_SetSymbol(), mcSymbolHelpers::data_Update(), and mcSymbolHelpers::io_ImportBaseInlinedExpr(). |
|
|
|
Reimplemented from mcElement. Definition at line 459 of file Symbol.h. References mcElement::math_RaiseTo(). |
|
Reimplemented from mcElement. |
|
List of registered constants.
Referenced by CheckArray(), CheckSymbols(), CleanupSymbols(), InitSymbols(), LoadDefaultSymbols(), LoadSymbols(), and math_FindSymbol(). |
|
List of registered parameters.
Referenced by CheckArray(), CheckSymbols(), CleanupSymbols(), InitSymbols(), LoadDefaultSymbols(), LoadSymbols(), and math_FindSymbol(). |
|
List of registered unknowns.
Referenced by CheckArray(), CheckSymbols(), CleanupSymbols(), InitSymbols(), LoadDefaultSymbols(), LoadSymbols(), and math_FindSymbol(). |
|
List of unregistered symbols, currently present in the math data.
Referenced by CheckArray(), CheckSymbols(), CleanupSymbols(), InitSymbols(), and math_FindSymbol(). |
[ Top ] |