]> git.tdb.fi Git - r2c2.git/blob - source/libmarklin/catalogue.h
Add Id tags and copyright notices to files
[r2c2.git] / source / libmarklin / catalogue.h
1 /* $Id$
2
3 This file is part of the MSP Märklin suite
4 Copyright © 2006-2008 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::Loader
23         {
24         public:
25                 Loader(Catalogue &);
26         private:
27                 Catalogue &cat;
28
29                 void locomotive(unsigned);
30                 void track(unsigned);
31         };
32
33 private:
34         std::map<unsigned, TrackType *> tracks;
35         std::map<unsigned, LocoType *> locos;
36
37 public:
38         ~Catalogue();
39
40         TrackType &get_track(unsigned) const;
41         const std::map<unsigned, TrackType *> &get_tracks() const { return tracks; }
42         LocoType &get_locomotive(unsigned) const;
43         const std::map<unsigned, LocoType *> &get_locomotives() const { return locos; }
44         void  load(const std::string &);
45 };
46
47 } // namespace Marklin
48
49 #endif