class Map

A basic map, which every other element in Kalamaris inherits. More...

Definition#include <kalamaris/map.h>
Inherited byColor, Constant, InternalProcedure, MapInternal, MapVariableArguments, MapVariableArgumentsInternal, Matrix, MatrixExtract, Operator, Variable
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Public Static Methods

Public Members

Protected Methods

Protected Members


Detailed Description

The basic element. Map can be anything (by inheriting it), but it's nearly nothing by default.

A Map object just has a pointer to another Map object, and when you make it do anything, it passes the command to the next Map object.

QString m_isAClassName

[ protected: ]

bool m_forceEvaluation

[ protected: ]

QStringList  split (const QChar &sep, const QString &str)

[ protected: ]

Splits a string in several strings, separated by sep. The difference with QStringList::split, is that this method takes care of (basic) syntaxis, not to break things like : f(x,y,g(a,b)) in (x , y , g(a , b)) instead of (x, y, g(a,b) )

QString m_definition

[ protected: ]

QString m_name

[ protected: ]

unsigned int m_nParameters

[ protected: ]

QStringList * m_parameterList

[ protected: ]

class Parameter ** m_parameters

[ protected: ]

Map * m_tree

[ protected: ]

static QDict maps

int  checkParamTypes (const QDict <Map> &vars)

[ protected: const]

Check each parameter to see if they have correct data types. Returns true if everything is ok, false if it's not.

 Map (const QString &nam,int)

[ protected: ]

 Map (const QString &decl=QString(), const QStringList &params=QStringList(), const QString &nam=QString(), bool parsedefinition=true)

 Map (const Map &m)

 ~Map ()

[virtual]

void  setName (const QString &nam,bool insertInDict=true)

inline void  setForceEvaluation ( bool b=false )

inline int  forceEvaluation ( void )

[const]

void  propagateForceEvaluation ( bool b=true )

[virtual]

Mapcopy (void)

[const virtual]

void  setParameterExpression (unsigned int i,const QString &expr)

[virtual]

void  setParameterExpression (unsigned int i, Map *expr)

[virtual]

void  setParameterExpression (unsigned int i, Parameter *expr)

[virtual]

void  setParameters (const QString &params)

Parses the parameters and call setParameterExpression automatically The parameter should be in the form "14,x+2" for a call in the form f(14,x+2)

QDict <Map> * evalParams (const QDict <Map> &vars)

Evaluates the parameters and stores them in a new QDict object. For example, if the function is f(x,z) and is used as this : 2*f(3*x,y+1), and vars contains { x=5, y=6 }, then the QDict object this function returns contains { x=15, y=6, z=7 }.

Note that you must delete the pointer that this function returns after using it !

Mapeval (const QDict <Map> &vars)

[virtual]

Mapderive (const class Variable &var, const QDict <Map> &vars)

[virtual]

Derivates (symbolically) the current map with respect to the variable var.

MapfunctionFactory (const QString &name)

[static]

Searches in the pool of maps for one with name "name", constructs a new map object of the same type and returns it

Mapparse (QString def)

[static]

Parses a string and creates a map object.

void  printDebug (const QString &tab=QString())

[const]

void  debugMaps (const QDict <Map>&vars)

[const]

QString  string (void)

[const virtual]

QString  htmlString (void)

[const virtual]

QString  helpPrefix (void)

[static]

QString  help (void)

[const virtual]

QString  helpPostfix (void)

[static]

inline QString  name (void)

[const]

QString  isA (void)

[const]

bool  isA (QString s)

[const]

bool  isConstant (void)

[const virtual]

Returns true if this map doesn't depend on any variable. The difference with isA("Constant") is that this also check (when implemented) for constant matrices.

inline bool  isInternal (void)

[const virtual]

bool  isInternal (const QString &name)

[static]

Mapsimplify ()

[virtual]

Returns a simplified form of this Map if possible. If there's no simplified form, it returns 0L .

void  simplifyFunction ()

Simplifies the tree calling simplify and substituting it with the simplified form. Note that it's "not desirable" to call this method on non-Map classes.

Mapadd (Map * &m1, Map * &m2, bool managem1=false, bool managem2=false)

[static]

Binary operations for maps. The nice thing about these methods is that they are quite optimized to do always the best thing with the pointers. For example, when you sum two temporary maps (and tell Map::add to "manage" them), they're not copied, but used directly.

With managem1 and managem2, you specify that you aren't going to need that pointer anymore, so instead of deleting it yourself in the next line, you tell Map::add to do whatever it wants with it, so if it isn't going to be used, it will be deleted. If you use true as value for managem1 or managem2, be sure to not reference that variable anymore, as it may be deleted ! (in this case, it will be set to 0L).

Mapsub (Map * &m1, Map * &m2, bool managem1=false, bool managem2=false)

[static]

Mapmul (Map * &m1, Map * &m2, bool managem1=false, bool managem2=false)

[static]

Mapdiv (Map * &m1, Map * &m2, bool managem1=false, bool managem2=false)

[static]

Mappow (Map * &m1, Map * &m2, bool managem1=false, bool managem2=false)

[static]

Mapadd2 (Map * m1, Map * m2, bool managem1=false, bool managem2=false)

[static]

These functions are provided for convience and should be used with extreme care

Mapsub2 (Map * m1, Map * m2, bool managem1=false, bool managem2=false)

[static]

Mapmul2 (Map * m1, Map * m2, bool managem1=false, bool managem2=false)

[static]

Mapdiv2 (Map * m1, Map * m2, bool managem1=false, bool managem2=false)

[static]

Mappow2 (Map * m1, Map * m2, bool managem1=false, bool managem2=false)

[static]

unsigned int  nArgs (void)

[const]

Returns the number of arguments

Mapargument (unsigned int i)

[const]

Returns the map used as i-th argument.

inline Parameterparameter (unsigned int i)

[const]

Returns the parameter at the i-th position.

inline Tt (void)

[const virtual]

Returns a T object if this is a Constant Map. else, it returns 0L It's not neccesary to check if this->isA("Constant") since it's a virtual method.

inline TMatrixtmatrix (void)

[const virtual]

Returns a TMatrix object if this is a Matrix Map. else, it returns 0L It's not neccesary to check if this->isA("Matrix") since it's a virtual method.