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

mcFunction Class Reference

#include <Function.h>

Inheritance diagram for mcFunction:

Inheritance graph
[legend]
Collaboration diagram for mcFunction:

Collaboration graph
[legend]
List of all members.

Detailed Description

A generic mathematical function.

This class is the class which loads, execute and solves all the user-defined functions (the functions whose scripts are placed in the 'Functions' subfolder).

Definition at line 425 of file Function.h.

Public Member Functions

bool data_isValidContainerFor (mcElementType t) const
 Returns TRUE if this element can safely contain the given element type.
mcWRAPPER void data_SetName (const wxString &str)
mcWRAPPER wxString data_GetName () const
mcWRAPPER mcTextdata_GetNameObj ()
mcWRAPPER const mcTextdata_GetNameObj () const
mcWRAPPER mcBracketdata_GetArgObj ()
mcWRAPPER const mcBracketdata_GetArgObj () const
mcWRAPPER void data_SetNameObj (const mcText &p)
mcWRAPPER void data_SetArgObj (const mcBracket &p)
mcWRAPPER bool data_isRegistered () const
mcWRAPPER void data_SetFncType (int n)
mcWRAPPER int data_GetFncType () const
mcWRAPPER wxScriptFunction * data_GetScript () const
mcWRAPPER void gui_Setup (int fnc)

Static Public Member Functions

static bool LoadScriptFile (const wxString &name)
 Loads the function scripted in the given file.
static wxString GetAllowedScriptFileExtString ()
 mcFunction supports all the script files supported by wxScriptInterpreter.
static wxArrayString GetAllowedScriptFileExt ()
static int data_GetFunctionType (mcElement *p, int n)
 Returns the index of the strFunctions' entry that matches the given array of mcSymbols alternated by mcMultOps (for example, in the expression '52^2 + s*i', if the user presses wxT('n'), the 's*i*n' expression will be recognized by this procedure as the function's name of a registered function.
static int data_GetFunctionType (const wxString &str)

Static Public Attributes

static wxScriptFunctionArray arrFunctions
 The array containing the registered functions.

Private Member Functions

 mcDEFINE_MAIN_CLASS (Function, mcExpElement)


Member Function Documentation

mcWRAPPER const mcBracket& mcFunction::data_GetArgObj  )  const [inline]
 

Definition at line 478 of file Function.h.

References mcWRAPPER.

mcWRAPPER mcBracket& mcFunction::data_GetArgObj  )  [inline]
 

Definition at line 477 of file Function.h.

References mcWRAPPER.

mcWRAPPER int mcFunction::data_GetFncType  )  const [inline]
 

Definition at line 491 of file Function.h.

References mcWRAPPER.

int mcFunction::data_GetFunctionType const wxString &  str  )  [static]
 

Definition at line 109 of file Function.cpp.

References arrFunctions, and mcFUNCTION_TYPE_NOTFOUND.

int mcFunction::data_GetFunctionType mcElement p,
int  n
[static]
 

Returns the index of the strFunctions' entry that matches the given array of mcSymbols alternated by mcMultOps (for example, in the expression '52^2 + s*i', if the user presses wxT('n'), the 's*i*n' expression will be recognized by this procedure as the function's name of a registered function.

This is the only way to recognize functions inside an expression. This function is automatically called by mcPolynomial parser.

Parameters:
p A pointer to the array of mcSymbols/mcMultOp
n The number of mcSymbols+mcMultOps in the given array
Returns:
The function type of mcmcFUNCTION_TYPE_NOTFOUND

Definition at line 86 of file Function.cpp.

References mcElement::data_GetType(), mcET_SYMBOL, and mcFUNCTION_TYPE_NOTFOUND.

Referenced by mcFunctionHelpers::gui_BaseInput(), mcMonomialHelpers::gui_ScanArrayForFunctions(), and mcFunctionHelpers::io_isFunctionBeginChar().

mcWRAPPER wxString mcFunction::data_GetName  )  const [inline]
 

Definition at line 473 of file Function.h.

References mcWRAPPER.

Referenced by mcMonomialHelpers::gui_ReplaceSymbolsWithFunction().

mcWRAPPER const mcText& mcFunction::data_GetNameObj  )  const [inline]
 

Definition at line 475 of file Function.h.

References mcWRAPPER.

mcWRAPPER mcText& mcFunction::data_GetNameObj  )  [inline]
 

Definition at line 474 of file Function.h.

References mcWRAPPER.

mcWRAPPER wxScriptFunction* mcFunction::data_GetScript  )  const [inline]
 

Definition at line 494 of file Function.h.

References mcWRAPPER.

mcWRAPPER bool mcFunction::data_isRegistered  )  const [inline]
 

Definition at line 485 of file Function.h.

References mcWRAPPER.

bool mcFunction::data_isValidContainerFor mcElementType  t  )  const [inline, virtual]
 

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 465 of file Function.h.

References mcET_FUNCTION.

mcWRAPPER void mcFunction::data_SetArgObj const mcBracket p  )  [inline]
 

Definition at line 482 of file Function.h.

References mcWRAPPER.

mcWRAPPER void mcFunction::data_SetFncType int  n  )  [inline]
 

Definition at line 489 of file Function.h.

References mcWRAPPER.

mcWRAPPER void mcFunction::data_SetName const wxString &  str  )  [inline]
 

Definition at line 470 of file Function.h.

References mcWRAPPER.

mcWRAPPER void mcFunction::data_SetNameObj const mcText p  )  [inline]
 

Definition at line 480 of file Function.h.

References mcWRAPPER.

static wxArrayString mcFunction::GetAllowedScriptFileExt  )  [inline, static]
 

Definition at line 442 of file Function.h.

static wxString mcFunction::GetAllowedScriptFileExtString  )  [inline, static]
 

mcFunction supports all the script files supported by wxScriptInterpreter.

Definition at line 440 of file Function.h.

mcWRAPPER void mcFunction::gui_Setup int  fnc  )  [inline]
 

Definition at line 497 of file Function.h.

References mcWRAPPER.

Referenced by mcMonomialHelpers::gui_ReplaceSymbolsWithFunction().

bool mcFunction::LoadScriptFile const wxString &  name  )  [static]
 

Loads the function scripted in the given file.

Definition at line 127 of file Function.cpp.

References arrFunctions, mcKey::DeepCopy(), and mcSAFE_DELETE.

mcFunction::mcDEFINE_MAIN_CLASS Function  ,
mcExpElement 
[private]
 


Member Data Documentation

wxScriptFunctionArray mcFunction::arrFunctions [static]
 

The array containing the registered functions.

Referenced by data_GetFunctionType(), and LoadScriptFile().


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

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

[ Top ]