]> git.donarmstrong.com Git - lilypond.git/blob - hdr/grouping.hh
6f89456d8bd5db90d6b93ab027179d9191c95ee3
[lilypond.git] / hdr / grouping.hh
1 /*
2   grouping.hh -- part of LilyPond
3
4   (c) 1996,97 Han-Wen Nienhuys
5 */
6
7 #ifndef GROUPING_HH
8 #define GROUPING_HH
9
10 #include "moment.hh"
11 #include "interval.hh"
12 #include "varray.hh"
13
14 typedef Interval_t<Moment> MInterval;
15
16 /// data structure which represents rhythmic units 
17 struct Rhythmic_grouping {    
18     
19     Array<Rhythmic_grouping*> children;
20     MInterval *interval_;
21     
22     /****************/
23
24     Array<MInterval> intervals();
25     MInterval interval()const;
26     Moment length() const;
27     void intersect(MInterval);
28     
29     void operator=(Rhythmic_grouping const&);
30     Rhythmic_grouping(Rhythmic_grouping const&);
31     Rhythmic_grouping(MInterval, int n=1);
32     Rhythmic_grouping();
33     Rhythmic_grouping(Array<Rhythmic_grouping*>);
34     ~Rhythmic_grouping();
35
36     void add_child(Moment start, Moment len);
37
38     void split(Rhythmic_grouping r);
39     void split(Array<MInterval>);
40     void split(int n);
41
42     void print() const;
43     void OK() const;
44
45     Array<int> generate_beams(Array<int>, int&);
46
47     /// multiply self to span #i#
48     void extend(MInterval i);
49     void translate(Moment);
50 private:
51     void init();
52     void junk();
53     void copy(Rhythmic_grouping const&);
54 };
55 /**
56   this is a tree. It groupes notes according to rules
57   
58  */
59
60 #endif