]> git.tdb.fi Git - r2c2.git/blob - source/libmarklin/catalogue.h
5d88c28dcd0dac2543421bad27e6ced57da3e0ba
[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 "profile.h"
14
15 namespace Marklin {
16
17 class LocoType;
18 class TrackType;
19
20 class Catalogue
21 {
22 public:
23         class Loader: public Msp::DataFile::BasicLoader<Catalogue>
24         {
25         public:
26                 Loader(Catalogue &);
27         private:
28                 void ballast_profile();
29                 void gauge(float);
30                 void locomotive(unsigned);
31                 void rail_profile();
32                 void scale(float, float);
33                 void track(unsigned);
34         };
35
36 private:
37         float scale;
38         float gauge;
39         Profile rail_profile;
40         Profile ballast_profile;
41         std::map<unsigned, TrackType *> tracks;
42         std::map<unsigned, LocoType *> locos;
43
44 public:
45         Catalogue();
46         ~Catalogue();
47
48         float get_scale() const { return scale; }
49         float get_gauge() const { return gauge; }
50         const Profile &get_rail_profile() const { return rail_profile; }
51         const Profile &get_ballast_profile() const { return ballast_profile; }
52         TrackType &get_track(unsigned) const;
53         const std::map<unsigned, TrackType *> &get_tracks() const { return tracks; }
54         LocoType &get_locomotive(unsigned) const;
55         const std::map<unsigned, LocoType *> &get_locomotives() const { return locos; }
56 };
57
58 } // namespace Marklin
59
60 #endif