Completing basic operations in basic.ml for primitives float, And, Or, Xor, fmod...
[Faustine.git] / interpretor / preprocessor / faust-0.9.47mr3 / compiler / generator / occurences.hh
1 #ifndef __OCCURENCES__
2 #define __OCCURENCES__
3
4 #include "tlib.hh"
5
6
7 class Occurences
8 {
9 const int fXVariability; ///< Extended Variability of the expression
10 int fOccurences[4]; ///< Occurences count according to Contexts
11 bool fMultiOcc; ///< True when exp has multiple occ. or occ. in higher ctxt
12 bool fOutDelayOcc; ///< True when exp has at least one occ. outside a delay
13 int fMinDelay; ///< Minimal fix delay usage
14 int fMaxDelay; ///< Maximal fix delay usage
15
16 public:
17 Occurences(int v, int r);
18
19 Occurences* incOccurences(int v, int r, int d); ///< inc occurences in context v,r,d
20
21 bool hasMultiOccurences() const; ///< true if multiple occurences or occ. in higher ctxt
22 bool hasOutDelayOccurences() const; ///< true if has occurences outside a a delay
23 int getMaxDelay() const; ///< return the maximal delay collected
24 int getMinDelay() const; ///< return the minimal delay collected
25 };
26
27
28 /**
29 * Occurences Markup of a root tree. First create an OccMarkup om,
30 * second om.mark(root) then om.retrieve(subtree)
31 */
32 class OccMarkup
33 {
34 Tree fRootTree; ///< occurences computed within this tree
35 Tree fPropKey; ///< key used to store occurences property
36
37 void incOcc (Tree env, int v, int r, int d, Tree t); ///< inc the occurence of t in context v,r
38 Occurences* getOcc (Tree t); ///< get Occurences property of t or null
39 void setOcc (Tree t, Occurences* occ); ///< set Occurences property of t
40
41 public:
42 void mark(Tree root); ///< start markup of root tree with new unique key
43 Occurences* retrieve(Tree t); ///< occurences of subtree t within root tree
44 };
45
46
47
48 #endif