]> git.tdb.fi Git - r2c2.git/blob - source/libmarklin/catalogue.h
4ce6fb1b712de8daa3d32f988d5ec5d43f0b6623
[r2c2.git] / source / libmarklin / catalogue.h
1 /* $Id$
2
3 This file is part of the MSP Märklin suite
4 Copyright © 2006-2009  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
14 namespace Marklin {
15
16 class LocoType;
17 class TrackType;
18
19 class Catalogue
20 {
21 public:
22         class Loader: public Msp::DataFile::BasicLoader<Catalogue>
23         {
24         public:
25                 Loader(Catalogue &);
26         private:
27                 void locomotive(unsigned);
28                 void track(unsigned);
29         };
30
31 private:
32         std::map<unsigned, TrackType *> tracks;
33         std::map<unsigned, LocoType *> locos;
34
35 public:
36         ~Catalogue();
37
38         TrackType &get_track(unsigned) const;
39         const std::map<unsigned, TrackType *> &get_tracks() const { return tracks; }
40         LocoType &get_locomotive(unsigned) const;
41         const std::map<unsigned, LocoType *> &get_locomotives() const { return locos; }
42 };
43
44 } // namespace Marklin
45
46 #endif