math::TMatcher< T > Class Template Reference

`#include <matcher.h>`

Inheritance diagram for math::TMatcher< T >:
[legend]
Collaboration diagram for math::TMatcher< T >:
[legend]

## Public Types

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

## Static Public Member Functions

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

## Additional Inherited Members

## 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 >

static 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 >

static 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 >

static 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:

- matcher.h