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 &);
32 void rod(const std::string &);
40 class Loader: public Msp::DataFile::ObjectLoader<Axle>
46 void wheel_diameter(float);
62 class Loader: public Msp::DataFile::ObjectLoader<Bogie>
68 Loader(VehicleType &, Bogie &);
77 std::vector<Axle *> axles;
101 class Loader: public Msp::DataFile::ObjectLoader<RodConstraint>
107 Loader(RodConstraint &, TagMap &);
109 void axis(float, float, float);
110 void local_position(float, float, float);
111 void target_axle(unsigned);
112 void target_position(float, float, float);
113 void target_rod(const std::string &);
118 unsigned target_index;
119 Vector target_position;
120 Vector local_position;
128 class Loader: public Msp::DataFile::ObjectLoader<Rod>
134 Loader(Rod &, TagMap &);
136 template<RodConstraint::Type>
138 void initial_position(float, float, float);
141 Vector initial_position;
142 std::vector<RodConstraint> constraints;
149 class MirrorParametersLoader: public Msp::DataFile::Loader
155 MirrorParametersLoader();
157 void filt(const std::string &);
158 void phase_offs(float);
161 typedef std::vector<Axle> AxleArray;
162 typedef std::vector<Bogie> BogieArray;
163 typedef std::vector<Rod> RodArray;
164 typedef std::map<unsigned, std::string> FunctionMap;
168 FunctionMap functions;
175 std::vector<Axle *> fixed_axles;
185 bool is_locomotive() const { return locomotive; }
186 unsigned get_max_function() const;
187 const FunctionMap &get_functions() const { return functions; }
188 bool get_swap_direction() const { return swap_direction; }
189 float get_gauge() const { return gauge; }
190 float get_length() const { return length; }
191 float get_width() const { return width; }
192 float get_height() const { return height; }
193 const AxleArray &get_axles() const { return axles; }
194 const Axle &get_axle(unsigned) const;
195 const Axle &get_fixed_axle(unsigned) const;
196 const BogieArray &get_bogies() const { return bogies; }
197 const Bogie &get_bogie(unsigned) const;
198 const Axle &get_bogie_axle(unsigned, unsigned) const;
199 const RodArray &get_rods() const { return rods; }
200 const Rod &get_rod(unsigned) const;
201 float get_front_axle_offset() const;
202 float get_back_axle_offset() const;
203 const std::string &get_object() const { return object; }
204 bool get_rotate_object() const { return rotate_object; }
205 float get_maximum_speed() const { return max_speed; }