]> git.tdb.fi Git - r2c2.git/blob - source/libr2c2/catalogue.h
Remove deprecated datafile statement aliases
[r2c2.git] / source / libr2c2 / catalogue.h
1 #ifndef LIBR2C2_CATALOGUE_H_
2 #define LIBR2C2_CATALOGUE_H_
3
4 #include <map>
5 #include <msp/datafile/objectloader.h>
6 #include "articlenumber.h"
7 #include "layout.h"
8 #include "profile.h"
9
10 namespace R2C2 {
11
12 class SignalType;
13 class TrackType;
14 class VehicleType;
15
16 class Catalogue
17 {
18 public:
19         class Loader: public Msp::DataFile::ObjectLoader<Catalogue>
20         {
21         public:
22                 Loader(Catalogue &);
23         private:
24                 void ballast_profile();
25                 void gauge(float);
26                 void layout();
27                 void rail_profile();
28                 void scale(float, float);
29                 void signal(ArticleNumber);
30                 void track(ArticleNumber);
31                 void vehicle(ArticleNumber);
32         };
33
34         typedef std::map<ArticleNumber, TrackType *> TrackMap;
35         typedef std::map<ArticleNumber, VehicleType *> VehicleMap;
36         typedef std::map<ArticleNumber, SignalType *> SignalMap;
37
38         sigc::signal<void, const TrackType &> signal_track_added;
39         sigc::signal<void, const VehicleType &> signal_vehicle_added;
40         sigc::signal<void, const SignalType &> signal_signal_added;
41
42 private:
43         float scale;
44         float gauge;
45         Profile rail_profile;
46         Profile ballast_profile;
47         Profile path_profile;
48         std::string track_technique;
49         TrackMap tracks;
50         VehicleMap vehicles;
51         SignalMap signals;
52         Layout layout;
53
54 public:
55         Catalogue();
56         ~Catalogue();
57
58         float get_scale() const { return scale; }
59         float get_gauge() const { return gauge; }
60         float get_rail_elevation() const;
61         const Profile &get_rail_profile() const { return rail_profile; }
62         const Profile &get_ballast_profile() const { return ballast_profile; }
63         const Profile &get_path_profile() const { return path_profile; }
64         const std::string &get_track_technique() const { return track_technique; }
65
66         void add_track(TrackType &);
67         const TrackType &get_track(const ArticleNumber &) const;
68         const TrackMap &get_tracks() const { return tracks; }
69
70         void add_vehicle(VehicleType &);
71         const VehicleType &get_vehicle(const ArticleNumber &) const;
72         const VehicleMap &get_vehicles() const { return vehicles; }
73
74         void add_signal(SignalType &);
75         const SignalType &get_signal(const ArticleNumber &) const;
76         const SignalMap &get_signals() const { return signals; }
77
78         Layout &get_layout() { return layout; }
79 };
80
81 } // namespace R2C2
82
83 #endif