]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/grouping.hh
release: 0.0.57
[lilypond.git] / lily / include / 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   this is a tree. It groupes notes according to rules
17
18   TODO Documentation. Unhairing
19  */
20 struct Rhythmic_grouping {
21     Array<Rhythmic_grouping*> children;
22     MInterval *interval_;
23     
24     /* *************** */
25
26     Array<MInterval> intervals();
27     MInterval interval()const;
28     Moment length() const;
29     void intersect(MInterval);
30     
31     void operator=(Rhythmic_grouping const&);
32     Rhythmic_grouping(Rhythmic_grouping const&);
33     Rhythmic_grouping(MInterval, int n=1);
34     Rhythmic_grouping();
35     Rhythmic_grouping(Array<Rhythmic_grouping*>);
36     ~Rhythmic_grouping();
37
38     void add_child(Moment start, Moment len);
39     bool child_fit_b(Moment start);
40     void split(Rhythmic_grouping r);
41     void split(Array<MInterval>);
42     void split(int n);
43
44     void print() const;
45     void OK() const;
46
47     Array<int> generate_beams(Array<int>, int&);
48
49     /** multiply self to span #i#.
50       In implementation, this isn't really const, but conceptually it is.
51       */
52     void extend(MInterval i) const;
53     void translate(Moment);
54 private:
55     void init();
56     void junk();
57     void copy(Rhythmic_grouping const&);
58 };
59
60
61 Rhythmic_grouping parse_grouping(Array<int> beat_i_arr, Array<Moment> elt_length_arr);
62
63
64 #endif