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

math::TMatcher< T > Class Template Reference

#include <matcher.h>

Inheritance diagram for math::TMatcher< T >:

math::TNodeVisitor< T > List of all members.

Public Types

typedef std::map< std::string,
TNode< T > > 
TResult

Static Public Member Functions

bool matchExact (const TMatch< T > *AMatch, const TNode< T > *AExpr, TMatchRegistry< T > *AReg=0)
bool match (const TMatch< T > *AMatch, const TNode< T > *AExpr, TMatchRegistry< T > *AReg=0)
unsigned match (const std::string &AMatch, const TNode< T > *AExpr, TResult &AResult)

Detailed Description

template<class T>
class math::TMatcher< T >

TMatcher<> is a dynamic matching system for symbolic expressions. One application for that is simplifying expressions.

TMatcher<> class is really to be done. But it will rock then. Example:

   TMatcher<T>::TResult matchResult;
   if (TMatcher<T>::match("a+a", expr, machResult))
       return transform(expr, machResult, "2*a+$");
 

the "$" means the remaining part not matched using given template match, here "a+a". Example: if you've a+b+a and want match a+a, then the remaining part is b; if you've a^2+b^(sin(2x)+2)+c^2+c*2*a and want to match a^2+2ab+b^2, then the matched parts is: "a^2+c^2+c*2*a" and the remaining part will be: "b^(sin(2x)+2)".

Definition at line 176 of file matcher.h.


Member Function Documentation

template<class T>
unsigned math::TMatcher< T >::match const std::string &  AMatch,
const TNode< T > *  AExpr,
TResult &  AResult
[static]
 

match matches a given expression template on expression AExpr and puts its result into AResult.

template<class T>
bool math::TMatcher< T >::match const TMatch< T > *  AMatch,
const TNode< T > *  AExpr,
TMatchRegistry< T > *  AReg = 0
[static]
 

returns true when given pattern (AMatch) was matched in given expression (AExpr). The result data is stored into the registry on success only.

template<class T>
bool math::TMatcher< T >::matchExact const TMatch< T > *  AMatch,
const TNode< T > *  AExpr,
TMatchRegistry< T > *  AReg = 0
[static]
 

matchExact returns true when the template (AMatch) represents exactly the test expression (AExpr).


The documentation for this class was generated from the following file:
Generated on Thu Sep 30 21:40:02 2004 for MathTypeLibrary(libmath++) by  doxygen 1.3.8-20040913