Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

mcSymbolProperties Class Reference

#include <MathHelpers.h>

Inheritance diagram for mcSymbolProperties:

Inheritance graph
[legend]
Collaboration diagram for mcSymbolProperties:

Collaboration graph
[legend]
List of all members.

Detailed Description

A little class which holds informations about a specific symbol.

Definition at line 699 of file MathHelpers.h.

Public Member Functions

 mcSymbolProperties (int symtype=mcSYM_NOTSET, const wxString &name=wxEmptyString, wxFontEncoding encoding=wxFONTENCODING_DEFAULT, const mcRealValue &value=0.0, const wxString &inlinedsym=wxEmptyString, const wxString &subscript=wxEmptyString, mcExtRange *domain=NULL, bool evaluating=FALSE)
 Inits this class with default values or user-supplied values.
virtual ~mcSymbolProperties ()
mcSymbolPropertiesdata_Clone () const
 Clones this object returning an identic copy.
wxString io_GetInlinedSym () const
 Returns m_strInlinedSymbol if it's not empty.
wxString io_GetInlinedExpr () const
void data_Check () const
 Checks if this symbol holds valid info.
int math_FindDuplicate (const mcSymbolArray *tosearch, int occ) const
 If a duplicate symbol (for comparison, #isSameAs is used) is found, then the function returns the index of the duplicate entry.
LINKING functions
Link/unlink this class to a mcSymbol

void data_Link (const mcSymbolHelpers *p)
 Links this object with the given symbol.
void data_Unlink (const mcSymbolHelpers *p)
int data_GetLinkedSymCount () const
mcSymbolHelpersdata_GetLinkedSym (int n) const
const mcSymbolHelpersdata_GetSafeLinkedSym () const
 Returns a "safe symbol" associated with this object.
CHECK functions
Instead of reading m_nSymbolType, you can use these....

bool data_isRegistered () const
bool data_isParameter () const
bool data_isUnknown () const
bool data_isConstant () const
bool data_isUnlinked () const
bool data_isSameAs (const mcSymbolProperties &s) const
bool math_isBeingEvaluated () const

Public Attributes

int m_nSymbolType
 A mcSYM_XXX ID that identifies this symbol as a parameter, a constant or an unknown...
wxFontEncoding m_fEncoding
 The encoding of the font which should be used to render this symbol.
wxString m_strSymbol
 The name of the symbol represented by this object.
wxString m_strSubscript
 The subscript associated with this symbol.
mcRealValue m_fValue
 The value of this symbol if it is a constant.
mcExtRangem_pDomain
 The domain of this symbol (if a parameter or unknown).
bool m_bEvaluating
 If TRUE, then this unknown/parameter (this variable is useless for constants) is being used with a specific value (set into m_fValue) and thus it must be considered temporary as a constant.

Protected Attributes

wxString m_strInlinedSymbol
 m_strSymbol string is used.
wxArrayLong m_arrLinkedSymbol
 The list of mcSymbols linked to this class.

Friends

class mcSymbolArray


Constructor & Destructor Documentation

mcSymbolProperties::mcSymbolProperties int  symtype = mcSYM_NOTSET,
const wxString &  name = wxEmptyString,
wxFontEncoding  encoding = wxFONTENCODING_DEFAULT,
const mcRealValue value = 0.0,
const wxString &  inlinedsym = wxEmptyString,
const wxString &  subscript = wxEmptyString,
mcExtRange domain = NULL,
bool  evaluating = FALSE
 

Inits this class with default values or user-supplied values.

Definition at line 592 of file MathHelpers.cpp.

References mcSymbolHelpers::data_LinkWith(), m_bEvaluating, m_fEncoding, m_fValue, m_nSymbolType, m_pDomain, m_strInlinedSymbol, m_strSubscript, and m_strSymbol.

Referenced by data_Clone().

mcSymbolProperties::~mcSymbolProperties  )  [virtual]
 

Definition at line 622 of file MathHelpers.cpp.

References mcSymbolHelpers::data_Unlink(), m_arrLinkedSymbol, and mcASSERT.


Member Function Documentation

void mcSymbolProperties::data_Check  )  const [inline]
 

Checks if this symbol holds valid info.

If something is wrong, then an assert fails.

Definition at line 801 of file MathHelpers.h.

References data_isConstant(), m_fValue, m_nSymbolType, m_strSymbol, mcASSERT, and mcSYM_NOTSET.

Referenced by mcSymbol::CheckArray(), and mcSolver::math_Solve().

mcSymbolProperties* mcSymbolProperties::data_Clone  )  const [inline]
 

Clones this object returning an identic copy.

Remember that mcSymbol arrays cannot contain duplicates.

Definition at line 783 of file MathHelpers.h.

References m_bEvaluating, m_fEncoding, m_fValue, m_nSymbolType, m_pDomain, m_strInlinedSymbol, m_strSubscript, m_strSymbol, and mcSymbolProperties().

Referenced by mcSymbolArray::data_AddSymbol(), mcSymbolArray::data_GetCopyOf(), and mcSymbolArray::data_MoveSymbols().

mcSymbolHelpers* mcSymbolProperties::data_GetLinkedSym int  n  )  const [inline]
 

Definition at line 831 of file MathHelpers.h.

References m_arrLinkedSymbol.

Referenced by mcSymbolArray::data_AddSymbol(), and data_GetSafeLinkedSym().

int mcSymbolProperties::data_GetLinkedSymCount  )  const [inline]
 

Definition at line 830 of file MathHelpers.h.

References m_arrLinkedSymbol.

Referenced by mcSymbolArray::data_AddSymbol().

const mcSymbolHelpers* mcSymbolProperties::data_GetSafeLinkedSym  )  const [inline]
 

Returns a "safe symbol" associated with this object.

This is a reserved mcSymbolHelpers class which is always a valid pointer and is always linked to this mcSymbolProperties.

Definition at line 836 of file MathHelpers.h.

References data_GetLinkedSym(), and mcASSERT.

Referenced by mcElementHelpers::math_ContainsOneOf().

bool mcSymbolProperties::data_isConstant  )  const [inline]
 

Definition at line 850 of file MathHelpers.h.

References m_nSymbolType, and mcSYM_CONSTANT.

Referenced by data_Check(), and mcSymbolHelpers::data_isConstant().

bool mcSymbolProperties::data_isParameter  )  const [inline]
 

Definition at line 848 of file MathHelpers.h.

References m_nSymbolType, and mcSYM_PARAMETER.

Referenced by mcSymbolHelpers::data_isParameter().

bool mcSymbolProperties::data_isRegistered  )  const [inline]
 

Definition at line 847 of file MathHelpers.h.

References m_nSymbolType, and mcSYM_UNREGISTERED.

Referenced by mcSymbolHelpers::data_isRegistered().

bool mcSymbolProperties::data_isSameAs const mcSymbolProperties s  )  const
 

Definition at line 647 of file MathHelpers.cpp.

References io_GetInlinedSym(), m_fEncoding, m_strSubscript, and m_strSymbol.

Referenced by math_FindDuplicate().

bool mcSymbolProperties::data_isUnknown  )  const [inline]
 

Definition at line 849 of file MathHelpers.h.

References m_nSymbolType, and mcSYM_UNKNOWN.

Referenced by mcSymbolHelpers::data_isUnknown().

bool mcSymbolProperties::data_isUnlinked  )  const [inline]
 

Definition at line 851 of file MathHelpers.h.

References m_arrLinkedSymbol.

void mcSymbolProperties::data_Link const mcSymbolHelpers p  )  [inline]
 

Links this object with the given symbol.

Definition at line 827 of file MathHelpers.h.

References m_arrLinkedSymbol.

Referenced by mcSymbolHelpers::data_LinkWith().

void mcSymbolProperties::data_Unlink const mcSymbolHelpers p  )  [inline]
 

Definition at line 828 of file MathHelpers.h.

References m_arrLinkedSymbol.

Referenced by mcSymbolHelpers::data_Unlink(), and mcSymbolHelpers::data_Update().

wxString mcSymbolProperties::io_GetInlinedExpr  )  const [inline]
 

Definition at line 795 of file MathHelpers.h.

References io_GetInlinedSym().

wxString mcSymbolProperties::io_GetInlinedSym  )  const [inline]
 

Returns m_strInlinedSymbol if it's not empty.

Returns m_strSymbol otherwise.

Definition at line 793 of file MathHelpers.h.

References m_strInlinedSymbol, and m_strSymbol.

Referenced by mcSymbolHelpers::data_GetInlinedSymbol(), data_isSameAs(), io_GetInlinedExpr(), and mcSymbolArray::io_GetInlinedSymbol().

int mcSymbolProperties::math_FindDuplicate const mcSymbolArray tosearch,
int  occ
const
 

If a duplicate symbol (for comparison, #isSameAs is used) is found, then the function returns the index of the duplicate entry.

Definition at line 665 of file MathHelpers.cpp.

References mcSymbolHelpers::data_GetSymbol(), data_isSameAs(), mcSYM_NOTFOUND, and mcSYMFIND_MATCH_NAME.

Referenced by mcSymbolArray::data_AddSymbol().

bool mcSymbolProperties::math_isBeingEvaluated  )  const [inline]
 

Definition at line 854 of file MathHelpers.h.

References m_bEvaluating.


Friends And Related Function Documentation

friend class mcSymbolArray [friend]
 

Definition at line 701 of file MathHelpers.h.


Member Data Documentation

wxArrayLong mcSymbolProperties::m_arrLinkedSymbol [protected]
 

The list of mcSymbols linked to this class.

The first entry is reserved for the "safe symbol" associated to this mcSymbolProperties class.

Definition at line 714 of file MathHelpers.h.

Referenced by data_GetLinkedSym(), data_GetLinkedSymCount(), data_isUnlinked(), data_Link(), data_Unlink(), and ~mcSymbolProperties().

bool mcSymbolProperties::m_bEvaluating
 

If TRUE, then this unknown/parameter (this variable is useless for constants) is being used with a specific value (set into m_fValue) and thus it must be considered temporary as a constant.

Note:
This system allows to evaluate a math expression containing unknowns/parameters at a fixed value very quickly. It would be much slower to move all unknowns/ parameters of an expression to mcSymbol::arrConstants just for a call to math_Evaluate() and then undo the change, moving them all back to arrUnknowns/arrParameters.

Definition at line 763 of file MathHelpers.h.

Referenced by data_Clone(), mcElementHelpers::math_EvaluateAt(), math_isBeingEvaluated(), and mcSymbolProperties().

wxFontEncoding mcSymbolProperties::m_fEncoding
 

The encoding of the font which should be used to render this symbol.

If the renderer cannot set this font encoding then it should use the string returned by #GetInlinedSym().

Definition at line 726 of file MathHelpers.h.

Referenced by data_Clone(), mcSymbolArray::data_GetEncoding(), mcSymbolHelpers::data_isGreekSymbol(), data_isSameAs(), mcSymbolHelpers::data_SetAsGreek(), and mcSymbolProperties().

mcRealValue mcSymbolProperties::m_fValue
 

The value of this symbol if it is a constant.

This variable can be used temporary also when this symbol is an unknown or a parameter... see m_bEvaluating.

Definition at line 744 of file MathHelpers.h.

Referenced by data_Check(), data_Clone(), mcSymbolHelpers::data_GetValue(), mcSymbolHelpers::data_SetValue(), mcElementHelpers::math_EvaluateAt(), mcSymbolArray::math_GetValue(), and mcSymbolProperties().

int mcSymbolProperties::m_nSymbolType
 

A mcSYM_XXX ID that identifies this symbol as a parameter, a constant or an unknown...

Definition at line 721 of file MathHelpers.h.

Referenced by mcSymbolArray::data_AddSymbol(), data_Check(), data_Clone(), data_isConstant(), data_isParameter(), data_isRegistered(), data_isUnknown(), mcSymbolHelpers::data_Update(), and mcSymbolProperties().

mcExtRange* mcSymbolProperties::m_pDomain
 

The domain of this symbol (if a parameter or unknown).

This object also contains info about the set of numbers considered (Z, N, R, C). This is a pointer (and not directly a mcExtRange) for performance reasons (and to save memory for constants).

Definition at line 751 of file MathHelpers.h.

Referenced by data_Clone(), mcSymbolHelpers::data_GetDomain(), and mcSymbolProperties().

wxString mcSymbolProperties::m_strInlinedSymbol [protected]
 

m_strSymbol string is used.

Use #GetInlinedSym() to get this variable.

Definition at line 709 of file MathHelpers.h.

Referenced by data_Clone(), io_GetInlinedSym(), and mcSymbolProperties().

wxString mcSymbolProperties::m_strSubscript
 

The subscript associated with this symbol.

This string can be safely empty.

Definition at line 737 of file MathHelpers.h.

Referenced by data_Clone(), mcSymbolHelpers::data_GetSubscript(), mcSymbolArray::data_GetSubscript(), data_isSameAs(), mcSymbolHelpers::data_SetSubscript(), mcSymbolHelpers::gui_SubInput(), and mcSymbolProperties().

wxString mcSymbolProperties::m_strSymbol
 

The name of the symbol represented by this object.

VERY IMPORTANT: this string should be an ANSI string without any special character and it *must* be UNIQUE among all mcSymbolArrays (this task should be performed by mcSymbolArray::math_AddSymbol).

Definition at line 733 of file MathHelpers.h.

Referenced by data_Check(), data_Clone(), mcSymbolHelpers::data_GetSymbol(), mcSymbolArray::data_GetSymbolName(), data_isSameAs(), io_GetInlinedSym(), and mcSymbolProperties().


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

Documentation generated with Doxygen on Sun Feb 6 17:13:15 2005
Visit MathStudio home page for more info

[ Top ]