]> git.donarmstrong.com Git - lilypond.git/blob - staff.hh
release: 0.0.3
[lilypond.git] / staff.hh
1 #ifndef STAFF_HH
2 #define STAFF_HH
3
4 #include "score.hh"
5 #include "voice.hh"
6 #include "command.hh"
7
8 struct Staff_column {
9     Score_column *score_column;
10
11     /// fields to collect data vertically.
12     svec<Voice_element *> v_elts;
13     svec<Command *> s_commands;
14     
15     Staff_column(Score_column*s); 
16     bool mus() const ;
17     Mtime when() const;
18     void add(Voice_element*ve);
19     /****************************************************************
20       VIRTUAL
21     ****************************************************************/
22     virtual void process_requests()=0;
23     virtual void process_commands()=0;
24     virtual ~Staff_column() { }
25 };
26
27
28 /// base class for a collection of voices.
29 struct Staff {
30     /// synchronous horizontal stuff
31     PointerList<Voice*> voices;
32
33     /// commands in chronological order
34     PointerList<Command *> commands;
35     PointerList<Staff_column*> cols;
36
37     /// indirections to the Score and PScore
38     Score *score_;
39     PScore *pscore_;
40
41     void add_voice(Voice *v);
42     void add_staff_column(Staff_column *sp);
43
44          
45     /// interpret all requests and add items to #destination#.
46     void process();
47     /**
48     This routines calls virtual functions from Staff, to delegate the
49     interpretation of requests to a derived class of Staff */
50
51     
52     /****************************************************************
53       VIRTUALS
54     ****************************************************************/
55     
56     void setup_staffcols();
57
58     virtual void set_output(PScore * destination)=0;
59     virtual void grant_requests()=0;
60     
61     Staff_column * get_col(Mtime,bool);
62
63     void add_commands(PointerList<Command* >const & sv);
64     /**
65     add all commands from sv.
66
67     PRE
68     sv is time-ordered.
69     */
70     virtual Staff_column * create_col(Score_column * )=0;
71
72     void OK() const;
73     void print() const;
74     Mtime last() const;
75     void clean_cols() ;
76     virtual ~Staff() { } 
77 };
78 #endif