New directory tree, with preprocessor/ inside interpretor/.
[Faustine.git] / interpretor / preprocessor / faust-0.9.47mr3 / compiler / headers / aterm.hh
1 #ifndef __ATERM__
2 #define __ATERM__
3
4 #include <stdio.h>
5 #include <assert.h>
6 #include "tlib.hh"
7 #include "signals.hh"
8 #include "sigprint.hh"
9 #include "simplify.hh"
10 #include "normalize.hh"
11 #include "sigorderrules.hh"
12 #include <map>
13 #include <list>
14
15 #include "mterm.hh"
16
17 using namespace std;
18
19 /**
20 * Implements a additive term, a set of mterms added together
21 * m1 + m2 + m3 + ...
22 */
23 class aterm
24 {
25
26 map<Tree,mterm> fSig2MTerms; ///< mapping between signatures and corresponding mterms
27
28 public:
29 aterm (); ///< create an empty aterm (equivalent to 0)
30 aterm (Tree t); ///< create a aterm from an additive exp
31 //aterm (const aterm& a); ///< create a copy of an aterm
32
33 const aterm& operator += (Tree t); ///< add in place an additive expression tree
34 const aterm& operator -= (Tree t); ///< add in place an additive expression tree
35
36 const aterm& operator += (const mterm& m); ///< add in place an mterm
37 const aterm& operator -= (const mterm& m); ///< add in place an mterm
38 Tree normalizedTree() const; ///< return the corresponding normalized expression tree
39
40 ostream& print(ostream& dst) const; ///< print a aterm m1 + m2 + m3 +...
41 mterm greatestDivisor() const; ///< return the greatest divisor of any two mterms
42 aterm factorize(const mterm& d); ///< reorganize the aterm by factorizing d
43 };
44
45 inline ostream& operator << (ostream& s, const aterm& a) { return a.print(s); }
46
47
48 #endif