]> git.tdb.fi Git - r2c2.git/blob - source/libmarklin/catalogue.h
4179ea75aa339ceedb781d147d3338a33b152b52
[r2c2.git] / source / libmarklin / catalogue.h
1 #ifndef LIBMARKLIN_CATALOGUE_H_
2 #define LIBMARKLIN_CATALOGUE_H_
3
4 #include <map>
5 #include <msp/datafile/loader.h>
6
7 namespace Marklin {
8
9 class LocoType;
10 class TrackType;
11
12 class Catalogue
13 {
14 public:
15         class Loader: public Msp::DataFile::Loader
16         {
17         public:
18                 Loader(Catalogue &);
19         private:
20                 Catalogue &cat;
21
22                 void locomotive(unsigned);
23                 void track(unsigned);
24         };
25
26 private:
27         std::map<unsigned, TrackType *> tracks;
28         std::map<unsigned, LocoType *> locos;
29
30 public:
31         ~Catalogue();
32
33         TrackType &get_track(unsigned) const;
34         const std::map<unsigned, TrackType *> &get_tracks() const { return tracks; }
35         LocoType &get_locomotive(unsigned) const;
36         const std::map<unsigned, LocoType *> &get_locomotives() const { return locos; }
37         void  load(const std::string &);
38 };
39
40 } // namespace Marklin
41
42 #endif