]> git.tdb.fi Git - r2c2.git/blob - source/libmarklin/catalogue.h
Add vehicles
[r2c2.git] / source / libmarklin / catalogue.h
1 /* $Id$
2
3 This file is part of the MSP Märklin suite
4 Copyright © 2006-2010  Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
6 */
7
8 #ifndef LIBMARKLIN_CATALOGUE_H_
9 #define LIBMARKLIN_CATALOGUE_H_
10
11 #include <map>
12 #include <msp/datafile/loader.h>
13 #include "layout.h"
14 #include "profile.h"
15
16 namespace Marklin {
17
18 class LocoType;
19 class TrackType;
20 class VehicleType;
21
22 class Catalogue
23 {
24 public:
25         class Loader: public Msp::DataFile::BasicLoader<Catalogue>
26         {
27         public:
28                 Loader(Catalogue &);
29         private:
30                 void ballast_profile();
31                 void gauge(float);
32                 void layout();
33                 void locomotive(unsigned);
34                 void rail_profile();
35                 void scale(float, float);
36                 void track(unsigned);
37         };
38
39         sigc::signal<void, const TrackType &> signal_track_added;
40         sigc::signal<void, const LocoType &> signal_loco_added;
41
42 private:
43         float scale;
44         float gauge;
45         Profile rail_profile;
46         Profile ballast_profile;
47         Profile path_profile;
48         std::map<unsigned, TrackType *> tracks;
49         std::map<unsigned, LocoType *> locos;
50         Layout layout;
51
52 public:
53         Catalogue();
54         ~Catalogue();
55
56         float get_scale() const { return scale; }
57         float get_gauge() const { return gauge; }
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
62         void add_track(TrackType &);
63         const TrackType &get_track(unsigned) const;
64         const std::map<unsigned, TrackType *> &get_tracks() const { return tracks; }
65
66         void add_locomotive(LocoType &);
67         const LocoType &get_locomotive(unsigned) const;
68         const std::map<unsigned, LocoType *> &get_locomotives() const { return locos; }
69
70         Layout &get_layout() { return layout; }
71 };
72
73 } // namespace Marklin
74
75 #endif