FAUST compiler  0.9.9.6b8
mterm.hh
Go to the documentation of this file.
00001 #ifndef __MTERM__
00002 #define __MTERM__
00003 
00004 #include <stdio.h>
00005 #include <assert.h>
00006 #include "tlib.hh"
00007 #include "signals.hh"
00008 #include "sigprint.hh"
00009 #include "simplify.hh"
00010 #include "normalize.hh"
00011 #include "sigorderrules.hh"
00012 #include <map>
00013 #include <list>
00014 
00015 using namespace std;
00016 
00021 class mterm
00022 {
00023 
00024     Tree            fCoef;                      
00025     map<Tree,int>   fFactors;                   
00026 
00027  public:
00028     mterm ();                                   
00029     mterm (int k);                              
00030     mterm (double k);                           
00031     mterm (Tree t);                             
00032     mterm (const mterm& m);                     
00033     
00034     void cleanup();                             
00035     bool isNotZero() const;                     
00036     bool isNegative() const;                    
00037 
00038     const mterm& operator = (const mterm& m);   
00039 
00040     const mterm& operator *= (Tree m);          
00041     const mterm& operator /= (Tree m);          
00042 
00043     const mterm& operator += (const mterm& m);  
00044     const mterm& operator -= (const mterm& m);  
00045     
00046     const mterm& operator *= (const mterm& m);  
00047     const mterm& operator /= (const mterm& m);  
00048 
00049     mterm operator * (const mterm& m) const;    
00050     mterm operator / (const mterm& m) const;    
00051     ostream& print(ostream& dst) const;         
00052     
00053     int complexity() const;                     
00054     Tree normalizedTree(bool sign=false, 
00055                         bool neg=false) const;  
00056     Tree signatureTree() const;                 
00057 
00058     bool hasDivisor (const mterm& n) const;     
00059     friend mterm gcd (const mterm& m1, const mterm& m2);    
00060 };
00061 
00062 inline ostream& operator << (ostream& s, const mterm& m) { return m.print(s); }
00063 
00064 
00065 #endif