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

mcSymbolArray Class Reference

#include <MathHelpers.h>

Inheritance diagram for mcSymbolArray:

Inheritance graph
[legend]
Collaboration diagram for mcSymbolArray:

Collaboration graph
[legend]
List of all members.

Detailed Description

An array of mcSymbolProperties with some specific function which works on the array.

Definition at line 885 of file MathHelpers.h.

Public Member Functions

 mcSymbolArray (int type=mcSYM_NOTSET, void(*fnc)(void)=NULL)
virtual ~mcSymbolArray ()
mcSymbolPropertiesdata_AddSymbol (bool bRemovePrevious, const wxString &name, wxFontEncoding enc=wxFONTENCODING_DEFAULT, const mcRealValue &value=0.0, const wxString &inlinedsym=wxEmptyString, const wxString &subscript=wxEmptyString, mcExtRange *domain=NULL)
 math_Adds a new mcSymbolProperties entry to the array, iniziatializing it with the given data and then returning it.
bool data_AddSymbol (const mcSymbolProperties &newsym, bool bRemovePrevious=TRUE)
 math_Adds a copy of the given mcSymbolProperties object to the array.
mcSymbolPropertiesdata_MoveSymbols (int i, mcSymbolArray *parr)
 Moves the i-th symbol to the given mcSymbolArray, removing it from this array and preserving data integrity.
int data_FindSymbol (long flags, const wxString &name, wxFontEncoding enc=wxFONTENCODING_DEFAULT, const mcRealValue &value=0.0, const wxString &subscript=wxEmptyString, const wxString &inlined=wxEmptyString, int occurrence=0) const
 Returns the index of the entry containing a symbol with the same given features; -1 if no such symbols are registered in this array.
int data_FindSymbol (long flags, const mcSymbolProperties &symtofind, int occ=0) const
void data_LinkWithArray (mcSymbolArray *p)
 Links *this with the given array.
INLINE getters/setters. @{
mcSymbolPropertiesdata_GetSymbol (int n)
const mcSymbolPropertiesdata_GetSymbol (int n) const
wxString data_GetSymbolName (int n) const
wxString data_GetSubscript (int n) const
wxString io_GetInlinedSymbol (int n) const
mcRealValue math_GetValue (int n) const
wxFontEncoding data_GetEncoding (int n) const
int data_GetArrayId () const

Public Attributes

void(* m_pAddSymbolCallback )(void)
 The callback function which is called when #math_AddSymbol manages to add a new symbol to the array.

Protected Member Functions

void data_Delete (int n)
 Deletes the n-th entry of the array.
mcAbstractItemdata_GetCopyOf (int n) const
 Copies the n-th object of the array and returns a pointer to it.
void data_ResetLinkedArr ()
 Resets to NULL the m_pArr array of pointers.

Protected Attributes

int m_nSymbolArray
 The ID of this array; all the mcSymbolProperties contained in #m_arrSym should have their mcSymbolProperties::m_nSymbolType variables all set to the same value of m_nSymbolArray.
mcSymbolArraym_pArr [mcMAX_SYMBOL_ARRAY_NUM]
 The list of the arrays to check when trying to add a new symbol.


Constructor & Destructor Documentation

mcSymbolArray::mcSymbolArray int  type = mcSYM_NOTSET,
void(*)(void)  fnc = NULL
[inline]
 

Definition at line 918 of file MathHelpers.h.

References data_ResetLinkedArr(), m_nSymbolArray, and m_pAddSymbolCallback.

virtual mcSymbolArray::~mcSymbolArray  )  [inline, virtual]
 

Definition at line 925 of file MathHelpers.h.

References mcAbstractArray::data_Clear().


Member Function Documentation

bool mcSymbolArray::data_AddSymbol const mcSymbolProperties newsym,
bool  bRemovePrevious = TRUE
 

math_Adds a copy of the given mcSymbolProperties object to the array.

If 'bRemovePrevious' == TRUE then all the symbols with the same name that are found in the array linked with this one (see #LinkWithArray) are removed. If 'bRemovePrevious' == FALSE and another symbol with the same name is already present, then the function does nothing and returns FALSE; this is because all mcSymbolProperties *must* have different names. After the symbol has been added, before returning TRUE, also the m_pAddSymbolCallback function, if not null, is called.

Definition at line 757 of file MathHelpers.cpp.

References mcAbstractArray::data_Add(), mcSymbolProperties::data_Clone(), mcSymbolProperties::data_GetLinkedSym(), mcSymbolProperties::data_GetLinkedSymCount(), data_GetSymbol(), mcSymbolHelpers::data_LinkWith(), mcAbstractArray::data_RemoveAt(), mcSymbolHelpers::data_Unlink(), m_nSymbolArray, mcSymbolProperties::m_nSymbolType, m_pAddSymbolCallback, m_pArr, mcSymbolProperties::math_FindDuplicate(), mcASSERT, mcMAX_SYMBOL_ARRAY_NUM, and mcSYM_NOTFOUND.

mcSymbolProperties * mcSymbolArray::data_AddSymbol bool  bRemovePrevious,
const wxString &  name,
wxFontEncoding  enc = wxFONTENCODING_DEFAULT,
const mcRealValue value = 0.0,
const wxString &  inlinedsym = wxEmptyString,
const wxString &  subscript = wxEmptyString,
mcExtRange domain = NULL
 

math_Adds a new mcSymbolProperties entry to the array, iniziatializing it with the given data and then returning it.

See the other overloading for more info.

Definition at line 739 of file MathHelpers.cpp.

References mcAbstractArray::data_GetCount(), data_GetSymbol(), and m_nSymbolArray.

Referenced by mcSymbol::LoadDefaultSymbols(), and mcSymbol::LoadSymbols().

void mcSymbolArray::data_Delete int  n  )  [inline, protected, virtual]
 

Deletes the n-th entry of the array.

Implements mcAbstractArray.

Definition at line 899 of file MathHelpers.h.

References data_GetSymbol().

int mcSymbolArray::data_FindSymbol long  flags,
const mcSymbolProperties symtofind,
int  occ = 0
const
 

Definition at line 712 of file MathHelpers.cpp.

References mcAbstractArray::data_GetCount(), data_GetEncoding(), data_GetSubscript(), data_GetSymbolName(), io_GetInlinedSymbol(), math_GetValue(), mcSYM_NOTFOUND, mcSYMFIND_MATCH_ENCODING, mcSYMFIND_MATCH_INLINED, mcSYMFIND_MATCH_NAME, mcSYMFIND_MATCH_SUBSCRIPT, and mcSYMFIND_MATCH_VALUE.

int mcSymbolArray::data_FindSymbol long  flags,
const wxString &  name,
wxFontEncoding  enc = wxFONTENCODING_DEFAULT,
const mcRealValue value = 0.0,
const wxString &  subscript = wxEmptyString,
const wxString &  inlined = wxEmptyString,
int  occurrence = 0
const
 

Returns the index of the entry containing a symbol with the same given features; -1 if no such symbols are registered in this array.

Parameters:
str The symbol name to search
bGreek TRUE if the symbol to find is greek
value If not mcmcSYM_INVALID_VALUE, then this is the value of the symbol to search
subscript If not mcmcSYM_INVALID_STRING, this is the subscript of the symbol to search
skip If not mcmcSYM_INVALID_ENTRY, this is the entry to skip

Definition at line 700 of file MathHelpers.cpp.

References mcSYM_NOTSET.

int mcSymbolArray::data_GetArrayId  )  const [inline]
 

Definition at line 1002 of file MathHelpers.h.

References m_nSymbolArray.

Referenced by mcSymbolHelpers::data_Update().

mcAbstractItem* mcSymbolArray::data_GetCopyOf int  n  )  const [inline, protected, virtual]
 

Copies the n-th object of the array and returns a pointer to it.

Those arrays which do not need to use #DeepCopy can safely ignore function; a default implementation which returns NULL is provided.

Reimplemented from mcAbstractArray.

Definition at line 901 of file MathHelpers.h.

References mcSymbolProperties::data_Clone(), data_GetSymbol(), and mcAbstractItem.

wxFontEncoding mcSymbolArray::data_GetEncoding int  n  )  const [inline]
 

Definition at line 1001 of file MathHelpers.h.

References data_GetSymbol(), and mcSymbolProperties::m_fEncoding.

Referenced by data_FindSymbol().

wxString mcSymbolArray::data_GetSubscript int  n  )  const [inline]
 

Definition at line 998 of file MathHelpers.h.

References data_GetSymbol(), and mcSymbolProperties::m_strSubscript.

Referenced by data_FindSymbol(), and mcSymbol::data_GetSubscript().

const mcSymbolProperties* mcSymbolArray::data_GetSymbol int  n  )  const [inline]
 

Definition at line 995 of file MathHelpers.h.

References mcAbstractArray::data_GetItem().

mcSymbolProperties* mcSymbolArray::data_GetSymbol int  n  )  [inline]
 

Definition at line 994 of file MathHelpers.h.

References mcAbstractArray::data_GetItem().

Referenced by mcSymbol::CheckArray(), data_AddSymbol(), data_Delete(), data_GetCopyOf(), data_GetEncoding(), data_GetSubscript(), mcSymbol::data_GetSymbol(), data_GetSymbolName(), data_MoveSymbols(), mcSymbolHelpers::data_SetSymbol(), mcSymbolHelpers::data_Update(), io_GetInlinedSymbol(), mcSymbolHelpers::io_ImportBaseInlinedExpr(), math_GetValue(), mcSolver::math_PreSolve(), and mcBisectSolver::math_SetStartRange().

wxString mcSymbolArray::data_GetSymbolName int  n  )  const [inline]
 

Definition at line 997 of file MathHelpers.h.

References data_GetSymbol(), and mcSymbolProperties::m_strSymbol.

Referenced by data_FindSymbol().

void mcSymbolArray::data_LinkWithArray mcSymbolArray p  )  [inline]
 

Links *this with the given array.

In this way, when you call the #math_AddSymbol function, it will scan the given array to avoid duplicates of symbols with the same name. The function will then remove the symbol in the given array or it will just return FALSE. Anyway, with this system, we can easily prevent array corruption.

Definition at line 981 of file MathHelpers.h.

References m_pArr.

Referenced by mcSymbol::InitSymbols().

mcSymbolProperties * mcSymbolArray::data_MoveSymbols int  i,
mcSymbolArray parr
 

Moves the i-th symbol to the given mcSymbolArray, removing it from this array and preserving data integrity.

Returns a pointer to the new symbol.

Definition at line 862 of file MathHelpers.cpp.

References mcSymbolProperties::data_Clone(), data_GetSymbol(), and mcSAFE_DELETE.

void mcSymbolArray::data_ResetLinkedArr  )  [inline, protected]
 

Resets to NULL the m_pArr array of pointers.

Definition at line 905 of file MathHelpers.h.

References m_pArr, and mcMAX_SYMBOL_ARRAY_NUM.

Referenced by mcSymbolArray().

wxString mcSymbolArray::io_GetInlinedSymbol int  n  )  const [inline]
 

Definition at line 999 of file MathHelpers.h.

References data_GetSymbol(), and mcSymbolProperties::io_GetInlinedSym().

Referenced by data_FindSymbol().

mcRealValue mcSymbolArray::math_GetValue int  n  )  const [inline]
 

Definition at line 1000 of file MathHelpers.h.

References data_GetSymbol(), and mcSymbolProperties::m_fValue.

Referenced by data_FindSymbol().


Member Data Documentation

int mcSymbolArray::m_nSymbolArray [protected]
 

The ID of this array; all the mcSymbolProperties contained in #m_arrSym should have their mcSymbolProperties::m_nSymbolType variables all set to the same value of m_nSymbolArray.

Definition at line 892 of file MathHelpers.h.

Referenced by data_AddSymbol(), data_GetArrayId(), and mcSymbolArray().

void(* mcSymbolArray::m_pAddSymbolCallback)(void)
 

The callback function which is called when #math_AddSymbol manages to add a new symbol to the array.

Referenced by data_AddSymbol(), and mcSymbolArray().

mcSymbolArray* mcSymbolArray::m_pArr[mcMAX_SYMBOL_ARRAY_NUM] [protected]
 

The list of the arrays to check when trying to add a new symbol.

Definition at line 895 of file MathHelpers.h.

Referenced by data_AddSymbol(), data_LinkWithArray(), and data_ResetLinkedArr().


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

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

[ Top ]