1 #ifndef LIBR2C2_VEHICLETYPE_H_
2 #define LIBR2C2_VEHICLETYPE_H_
4 #include <msp/datafile/objectloader.h>
6 #include "objecttype.h"
10 class VehicleType: public ObjectType
13 typedef std::map<std::string, unsigned> TagMap;
16 class Loader: public Msp::DataFile::DerivedObjectLoader<VehicleType, ObjectType::Loader>
22 Loader(VehicleType &);
24 virtual void finish();
27 void function(unsigned, const std::string &);
31 void rod(const std::string &);
39 class Loader: public Msp::DataFile::ObjectLoader<Axle>
45 void wheel_diameter(float);
61 class Loader: public Msp::DataFile::ObjectLoader<Bogie>
67 Loader(VehicleType &, Bogie &);
76 std::vector<Axle *> axles;
100 class Loader: public Msp::DataFile::ObjectLoader<RodConstraint>
106 Loader(RodConstraint &, TagMap &);
108 void axis(float, float, float);
109 void local_position(float, float, float);
110 void target_axle(unsigned);
111 void target_position(float, float, float);
112 void target_rod(const std::string &);
117 unsigned target_index;
118 Vector target_position;
119 Vector local_position;
127 class Loader: public Msp::DataFile::ObjectLoader<Rod>
133 Loader(Rod &, TagMap &);
135 template<RodConstraint::Type>
137 void initial_position(float, float, float);
140 Vector initial_position;
141 std::vector<RodConstraint> constraints;
148 class MirrorParametersLoader: public Msp::DataFile::Loader
153 MirrorParametersLoader();
155 void phase_offs(float);
158 typedef std::vector<Axle> AxleArray;
159 typedef std::vector<Bogie> BogieArray;
160 typedef std::vector<Rod> RodArray;
161 typedef std::map<unsigned, std::string> FunctionMap;
165 FunctionMap functions;
171 std::vector<Axle *> fixed_axles;
178 VehicleType(const ArticleNumber &);
180 bool is_locomotive() const { return locomotive; }
181 unsigned get_max_function() const;
182 const FunctionMap &get_functions() const { return functions; }
183 bool get_swap_direction() const { return swap_direction; }
184 float get_length() const { return length; }
185 float get_width() const { return width; }
186 float get_height() const { return height; }
187 const AxleArray &get_axles() const { return axles; }
188 const Axle &get_axle(unsigned) const;
189 const Axle &get_fixed_axle(unsigned) const;
190 const BogieArray &get_bogies() const { return bogies; }
191 const Bogie &get_bogie(unsigned) const;
192 const Axle &get_bogie_axle(unsigned, unsigned) const;
193 const RodArray &get_rods() const { return rods; }
194 const Rod &get_rod(unsigned) const;
195 float get_front_axle_offset() const;
196 float get_back_axle_offset() const;
197 const std::string &get_object() const { return object; }
198 bool get_rotate_object() const { return rotate_object; }