31 : currentTag(
TAG_VEHICLES), skip(false), currentGear(1) {
46 std::string
getAttributeValue(
const char* attributeName,
const XERCES_CPP_NAMESPACE::Attributes& attrs) {
53 const XMLCh*
const qname,
54 const XERCES_CPP_NAMESPACE::Attributes& attrs) {
163 const XMLCh*
const qname) {
185 for (
int i = 0; i < (int)
gearRatios.size(); i++) {
258 if (mapType !=
"poly") {
259 throw ProcessError(
"Invalid engine map type. Only \"poly\" is supported for now");
270 std::stringstream ss;
271 ss <<
"Invalid gear number " << number <<
". Please check that gears are inserted in order";
290 std::stringstream ss;
291 ss <<
"Maximum degree for the engine polynomial is " <<
MAX_POLY_DEGREE <<
". Please check your model's data";
295 for (
int i = 0; i < (int)attrs.getLength(); i++) {
316 return attrs.getIndex(
transcode(attribute));
320 std::string strValue;
322 if (attributeIndex == -1) {
326 return transcode(attrs.getValue(attributeIndex));
335 std::stringstream ss;
343 std::stringstream ss;
344 ss <<
"Missing attribute \"" << attribute <<
"\" for tag " << tag;
351 std::stringstream ss;
352 ss <<
"I don't know what to do with this tag: " << tag;
void computeCoefficients()
#define ENGINE_TAG_GEAR_RATIO
#define ENGINE_TAG_DRAG_CAIR
void loadWheelsData(const XERCES_CPP_NAMESPACE::Attributes &attrs)
struct GearShiftingRules shiftingRule
std::string parseStringAttribute(std::string tag, const char *attribute, const XERCES_CPP_NAMESPACE::Attributes &attrs)
void loadBrakesData(const XERCES_CPP_NAMESPACE::Attributes &attrs)
double parsePolynomialCoefficient(int index, const XERCES_CPP_NAMESPACE::Attributes &attrs)
void loadDifferentialData(const XERCES_CPP_NAMESPACE::Attributes &attrs)
void raiseUnknownTagError(std::string tag)
#define ENGINE_TAG_SHIFTING_DELTARPM
double tiresFrictionCoefficient
#define ENGINE_TAG_WHEELS
#define ENGINE_TAG_DRAG_SECTION
#define ENGINE_TAG_BRAKES
double parseDoubleAttribute(std::string tag, const char *attribute, const XERCES_CPP_NAMESPACE::Attributes &attrs)
#define ENGINE_TAG_VEHICLE_ID
std::string transcode(const XMLCh *const qname)
#define ENGINE_TAG_ENGINE_TYPE
void loadEngineModelData(const XERCES_CPP_NAMESPACE::Attributes &attrs)
#define ENGINE_TAG_GEAR_DIFFERENTIAL
#define ENGINE_TAG_ENGINE_MINRPM
void loadDragData(const XERCES_CPP_NAMESPACE::Attributes &attrs)
EngineParameters engineParameters
#define ENGINE_TAG_ENGINE_CYLINDERS
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter ...
#define ENGINE_TAG_ENGINE_EFFICIENCY
#define ENGINE_TAG_MASS_MASS
#define ENGINE_TAG_ENGINE
std::string vehicleToLoad
#define ENGINE_TAG_ENGINE_TAU_EX
void loadMassData(const XERCES_CPP_NAMESPACE::Attributes &attrs)
static int toInt(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter...
std::vector< double > gearRatios
#define ENGINE_TAG_ENGINE_POWER
const EngineParameters & getEngineParameters()
#define ENGINE_TAG_SHIFTING_RPM
void raiseMissingAttributeError(std::string tag, std::string attribute)
#define ENGINE_TAG_WHEELS_CR2
#define ENGINE_TAG_VEHICLES
struct PolynomialEngineModelRpmToHp engineMapping
#define ENGINE_TAG_BRAKES_TAU
double x[MAX_POLY_DEGREE]
void loadGearData(const XERCES_CPP_NAMESPACE::Attributes &attrs)
#define ENGINE_TAG_MASS_FACTOR
#define ENGINE_TAG_WHEELS_DIAMETER
VehicleEngineHandler(const std::string &toLoad)
#define ENGINE_TAG_WHEELS_CR1
void endElement(const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname)
#define ENGINE_TAG_SHIFTING
std::string getAttributeValue(const char *attributeName, const XERCES_CPP_NAMESPACE::Attributes &attrs)
#define ENGINE_TAG_ENGINE_MAXRPM
int parseIntAttribute(std::string tag, const char *attribute, const XERCES_CPP_NAMESPACE::Attributes &attrs)
void startElement(const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname, const XERCES_CPP_NAMESPACE::Attributes &attrs)
#define ENGINE_TAG_ENGINE_TAU_BURN
void loadEngineData(const XERCES_CPP_NAMESPACE::Attributes &attrs)
virtual ~VehicleEngineHandler()
Destructor.
void loadShiftingData(const XERCES_CPP_NAMESPACE::Attributes &attrs)
int existsAttribute(std::string tag, const char *attribute, const XERCES_CPP_NAMESPACE::Attributes &attrs)
#define ENGINE_TAG_VEHICLE
#define ENGINE_TAG_WHEELS_FRICTION
#define ENGINE_TAG_GEAR_N