X-Git-Url: https://scm.cri.ensmp.fr/git/Faustine.git/blobdiff_plain/c7f552fd8888da2f0d8cfb228fe0f28d3df3a12c..b4b6f2ea75b9f0f3ca918f5b84016610bf7a4d4f:/interpretor/preprocessor/faust-0.9.47mr3/compiler/headers/occurences.hh diff --git a/interpretor/preprocessor/faust-0.9.47mr3/compiler/headers/occurences.hh b/interpretor/preprocessor/faust-0.9.47mr3/compiler/headers/occurences.hh new file mode 100644 index 0000000..8276311 --- /dev/null +++ b/interpretor/preprocessor/faust-0.9.47mr3/compiler/headers/occurences.hh @@ -0,0 +1,48 @@ +#ifndef __OCCURENCES__ +#define __OCCURENCES__ + +#include "tlib.hh" + + +class Occurences +{ + const int fXVariability; ///< Extended Variability of the expression + int fOccurences[4]; ///< Occurences count according to Contexts + bool fMultiOcc; ///< True when exp has multiple occ. or occ. in higher ctxt + bool fOutDelayOcc; ///< True when exp has at least one occ. outside a delay + int fMinDelay; ///< Minimal fix delay usage + int fMaxDelay; ///< Maximal fix delay usage + + public: + Occurences(int v, int r); + + Occurences* incOccurences(int v, int r, int d); ///< inc occurences in context v,r,d + + bool hasMultiOccurences() const; ///< true if multiple occurences or occ. in higher ctxt + bool hasOutDelayOccurences() const; ///< true if has occurences outside a a delay + int getMaxDelay() const; ///< return the maximal delay collected + int getMinDelay() const; ///< return the minimal delay collected +}; + + +/** + * Occurences Markup of a root tree. First create an OccMarkup om, + * second om.mark(root) then om.retrieve(subtree) + */ +class OccMarkup +{ + Tree fRootTree; ///< occurences computed within this tree + Tree fPropKey; ///< key used to store occurences property + + void incOcc (Tree env, int v, int r, int d, Tree t); ///< inc the occurence of t in context v,r + Occurences* getOcc (Tree t); ///< get Occurences property of t or null + void setOcc (Tree t, Occurences* occ); ///< set Occurences property of t + + public: + void mark(Tree root); ///< start markup of root tree with new unique key + Occurences* retrieve(Tree t); ///< occurences of subtree t within root tree +}; + + + +#endif