]> git.tdb.fi Git - r2c2.git/blob - source/libmarklin/vehicletype.h
65f69e766d54ca66d48d3bb9000a6f68ab2bad22
[r2c2.git] / source / libmarklin / vehicletype.h
1 /* $Id$
2
3 This file is part of the MSP Märklin suite
4 Copyright © 2010  Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
6 */
7
8 #ifndef LIBMARKLIN_VEHICLETYPE_H_
9 #define LIBMARKLIN_VEHICLETYPE_H_
10
11 #include <msp/datafile/objectloader.h>
12
13 namespace Marklin {
14
15 class VehicleType
16 {
17 public:
18         class Loader: public Msp::DataFile::ObjectLoader<VehicleType>
19         {
20         public:
21                 Loader(VehicleType &);
22         private:
23                 void axle();
24                 void bogie();
25                 void height(float);
26                 void length(float);
27                 void width(float);
28         };
29
30         struct Axle
31         {
32                 class Loader: public Msp::DataFile::ObjectLoader<Axle>
33                 {
34                 public:
35                         Loader(Axle &);
36                 private:
37                         void position(float);
38                         void wheel_diameter(float);
39                 };
40
41                 float position;
42                 float wheel_dia;
43                 bool powered;
44
45                 Axle();
46         };
47
48         struct Bogie
49         {
50                 class Loader: public Msp::DataFile::ObjectLoader<Bogie>
51                 {
52                 public:
53                         Loader(Bogie &);
54                 private:
55                         void axle();
56                         void position(float);
57                 };
58
59                 float position;
60                 std::vector<Axle> axles;
61                 std::string object;
62                 bool rotate_object;
63
64                 Bogie();
65         };
66
67 private:
68         unsigned art_nr;
69         std::string name;
70         float length;
71         float width;
72         float height;
73         std::vector<Axle> axles;
74         std::vector<Bogie> bogies;
75         std::string object;
76
77 public:
78         VehicleType(unsigned);
79         virtual ~VehicleType() { } // XXX temporary
80
81         unsigned get_article_number() const { return art_nr; }
82         const std::string &get_name() const { return name; }
83         float get_length() const { return length; }
84         float get_width() const { return width; }
85         float get_height() const { return height; }
86         const std::vector<Axle> &get_axles() const { return axles; }
87         const std::vector<Bogie> &get_bogies() const { return bogies; }
88         const std::string &get_object() const { return object; }
89 };
90
91 } // namespace Marklin
92
93 #endif