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
154 MirrorParametersLoader();
156 void filt(const std::string &);
157 void phase_offs(float);
160 typedef std::vector<Axle> AxleArray;
161 typedef std::vector<Bogie> BogieArray;
162 typedef std::vector<Rod> RodArray;
163 typedef std::map<unsigned, std::string> FunctionMap;
167 FunctionMap functions;
173 std::vector<Axle *> fixed_axles;
180 VehicleType(const ArticleNumber &);
182 bool is_locomotive() const { return locomotive; }
183 unsigned get_max_function() const;
184 const FunctionMap &get_functions() const { return functions; }
185 bool get_swap_direction() const { return swap_direction; }
186 float get_length() const { return length; }
187 float get_width() const { return width; }
188 float get_height() const { return height; }
189 const AxleArray &get_axles() const { return axles; }
190 const Axle &get_axle(unsigned) const;
191 const Axle &get_fixed_axle(unsigned) const;
192 const BogieArray &get_bogies() const { return bogies; }
193 const Bogie &get_bogie(unsigned) const;
194 const Axle &get_bogie_axle(unsigned, unsigned) const;
195 const RodArray &get_rods() const { return rods; }
196 const Rod &get_rod(unsigned) const;
197 float get_front_axle_offset() const;
198 float get_back_axle_offset() const;
199 const std::string &get_object() const { return object; }
200 bool get_rotate_object() const { return rotate_object; }