summaryrefslogtreecommitdiff
path: root/staff.hh
blob: 49439f373bfafc8c1419a0c2c6126b29e6614254 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#ifndef STAFF_HH
#define STAFF_HH

#include "score.hh"
#include "voice.hh"
#include "command.hh"

struct Staff_column {
    Score_column *score_column;

    /// fields to collect data vertically.
    svec<Voice_element *> v_elts;
    svec<Command *> s_commands;
    
    Staff_column(Score_column*s); 
    bool mus() const ;
    Mtime when() const;
    void add(Voice_element*ve);
    /****************************************************************
      VIRTUAL
    ****************************************************************/
    virtual void process_requests()=0;
    virtual void process_commands()=0;
    virtual ~Staff_column() { }
};


/// base class for a collection of voices.
struct Staff {
    /// synchronous horizontal stuff
    PointerList<Voice*> voices;

    /// commands in chronological order
    PointerList<Command *> commands;
    PointerList<Staff_column*> cols;

    /// indirections to the Score and PScore
    Score *score_;
    PScore *pscore_;

    void add_voice(Voice *v);
    void add_staff_column(Staff_column *sp);

	 
    /// interpret all requests and add items to #destination#.
    void process();
    /**
    This routines calls virtual functions from Staff, to delegate the
    interpretation of requests to a derived class of Staff */

    
    /****************************************************************
      VIRTUALS
    ****************************************************************/
    
    void setup_staffcols();

    virtual void set_output(PScore * destination)=0;
    virtual void grant_requests()=0;
    
    Staff_column * get_col(Mtime,bool);

    void add_commands(PointerList<Command* >const & sv);
    /**
    add all commands from sv.

    PRE
    sv is time-ordered.
    */
    virtual Staff_column * create_col(Score_column * )=0;

    void OK() const;
    void print() const;
    Mtime last() const;
    void clean_cols() ;
    virtual ~Staff() { } 
};
#endif