]> git.tdb.fi Git - r2c2.git/blob - source/libr2c2/zone.h
Support directionality for zones
[r2c2.git] / source / libr2c2 / zone.h
1 #ifndef LIBR2C2_ZONE_H_
2 #define LIBR2C2_ZONE_H_
3
4 #include <set>
5 #include <string>
6 #include <msp/datafile/objectloader.h>
7 #include "trackchain.h"
8
9 namespace R2C2 {
10
11 class Layout;
12 class Track;
13
14 class Zone: public TrackChain
15 {
16 public:
17         class Loader: public Msp::DataFile::ObjectLoader<Zone>
18         {
19         public:
20                 Loader(Zone &);
21         private:
22                 virtual void finish();
23                 void block(unsigned);
24                 void direction_hint(unsigned, Direction);
25         };
26
27 private:
28         std::string group;
29         std::string qualifier;
30         unsigned number;
31         int up_end;
32
33 public:
34         Zone(Layout &);
35         ~Zone();
36
37         virtual void set_name(const std::string &);
38         void set_name(const std::string &, const std::string &, unsigned);
39 private:
40         void update_name();
41 public:
42         const std::string &get_group() const { return group; }
43         const std::string &get_qualifier() const { return qualifier; }
44         unsigned get_number() const { return number; }
45
46         void set_direction_towards(Track &, Direction);
47         void clear_direction();
48         virtual TrackIter iter_for(Track &, Direction) const;
49 private:
50         TrackIter next_iter(const TrackIter &) const;
51 public:
52         using TrackChain::get_end;
53         TrackIter get_end(Direction) const;
54
55         void save(std::list<Msp::DataFile::Statement> &) const;
56         virtual Msp::DataFile::Statement save_reference() const;
57 };
58
59 } // namespace R2C2
60
61 #endif