X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Fvehicletype.cpp;h=4f640193d025f433a86c81a2d5813c112200890d;hb=460c64181aca1a134d74cb15ea4ad3bb4f275b60;hp=b9c6ed2f72fe093c37043d3504bc226b225abe84;hpb=37af7970d9cefcf40ae58ca06ca8469f56b0cc13;p=r2c2.git diff --git a/source/libr2c2/vehicletype.cpp b/source/libr2c2/vehicletype.cpp index b9c6ed2..4f64019 100644 --- a/source/libr2c2/vehicletype.cpp +++ b/source/libr2c2/vehicletype.cpp @@ -27,6 +27,36 @@ unsigned VehicleType::get_max_function() const return (--functions.end())->first; } +const VehicleType::Axle &VehicleType::get_axle(unsigned i) const +{ + if(i>=axles.size()) + throw InvalidParameterValue("Axle index out of range"); + return axles[i]; +} + +const VehicleType::Bogie &VehicleType::get_bogie(unsigned i) const +{ + if(i>=bogies.size()) + throw InvalidParameterValue("Axle index out of range"); + return bogies[i]; +} + +const VehicleType::Axle &VehicleType::get_bogie_axle(unsigned i, unsigned j) const +{ + if(i>=bogies.size()) + throw InvalidParameterValue("Axle index out of range"); + if(j>=bogies[i].axles.size()) + throw InvalidParameterValue("Axle index out of range"); + return bogies[i].axles[j]; +} + +const VehicleType::Rod &VehicleType::get_rod(unsigned i) const +{ + if(i>=rods.size()) + throw InvalidParameterValue("Rod index out of range"); + return rods[i]; +} + float VehicleType::get_front_axle_offset() const { float front = length/2;