]> git.tdb.fi Git - r2c2.git/blob - source/libr2c2/catalogue.h
c0c6674c2a028e9ae44adc76ffdbba92761306b8
[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 TrackType;
13 class VehicleType;
14
15 class Catalogue
16 {
17 public:
18         class Loader: public Msp::DataFile::ObjectLoader<Catalogue>
19         {
20         public:
21                 Loader(Catalogue &);
22         private:
23                 void ballast_profile();
24                 void gauge(float);
25                 void layout();
26                 void rail_profile();
27                 void scale(float, float);
28                 void track(unsigned);
29                 void track(ArticleNumber);
30                 void vehicle(unsigned);
31                 void vehicle(ArticleNumber);
32         };
33
34         typedef std::map<ArticleNumber, TrackType *> TrackMap;
35         typedef std::map<ArticleNumber, VehicleType *> VehicleMap;
36
37         sigc::signal<void, const TrackType &> signal_track_added;
38         sigc::signal<void, const VehicleType &> signal_vehicle_added;
39
40 private:
41         float scale;
42         float gauge;
43         Profile rail_profile;
44         Profile ballast_profile;
45         Profile path_profile;
46         std::string track_technique;
47         TrackMap tracks;
48         VehicleMap vehicles;
49         Layout layout;
50
51 public:
52         Catalogue();
53         ~Catalogue();
54
55         float get_scale() const { return scale; }
56         float get_gauge() const { return gauge; }
57         float get_rail_elevation() const;
58         const Profile &get_rail_profile() const { return rail_profile; }
59         const Profile &get_ballast_profile() const { return ballast_profile; }
60         const Profile &get_path_profile() const { return path_profile; }
61         const std::string &get_track_technique() const { return track_technique; }
62
63         void add_track(TrackType &);
64         const TrackType &get_track(const ArticleNumber &) const;
65         const TrackMap &get_tracks() const { return tracks; }
66
67         void add_vehicle(VehicleType &);
68         const VehicleType &get_vehicle(const ArticleNumber &) const;
69         const VehicleMap &get_vehicles() const { return vehicles; }
70
71         Layout &get_layout() { return layout; }
72 };
73
74 } // namespace R2C2
75
76 #endif