|
SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00007 // Helper methods for parsing vehicle attributes 00008 /****************************************************************************/ 00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00010 // Copyright (C) 2001-2011 DLR (http://www.dlr.de/) and contributors 00011 /****************************************************************************/ 00012 // 00013 // This program is free software; you can redistribute it and/or modify 00014 // it under the terms of the GNU General Public License as published by 00015 // the Free Software Foundation; either version 2 of the License, or 00016 // (at your option) any later version. 00017 // 00018 /****************************************************************************/ 00019 #ifndef SUMOVehicleParserHelper_h 00020 #define SUMOVehicleParserHelper_h 00021 00022 00023 // =========================================================================== 00024 // included modules 00025 // =========================================================================== 00026 #ifdef _MSC_VER 00027 #include <windows_config.h> 00028 #else 00029 #include <config.h> 00030 #endif 00031 00032 #include <string> 00033 #include <utils/xml/SUMOSAXHandler.h> 00034 #include <utils/xml/SUMOXMLDefinitions.h> 00035 #include <utils/common/SUMOTime.h> 00036 #include <utils/common/SUMOVehicleClass.h> 00037 #include <utils/common/SUMOVehicleParameter.h> 00038 #include <utils/common/SUMOVTypeParameter.h> 00039 #include <utils/common/UtilExceptions.h> 00040 #include <utils/common/StdDefs.h> 00041 00042 // =========================================================================== 00043 // class definitions 00044 // =========================================================================== 00051 class SUMOVehicleParserHelper { 00052 public: 00063 static SUMOVehicleParameter* parseFlowAttributes(const SUMOSAXAttributes& attrs) throw(ProcessError); 00064 00065 00078 static SUMOVehicleParameter* parseVehicleAttributes(const SUMOSAXAttributes& attrs, 00079 bool skipID=false, bool skipDepart=false) throw(ProcessError); 00080 00081 00089 static SUMOVTypeParameter* beginVTypeParsing(const SUMOSAXAttributes& attrs) throw(ProcessError); 00090 00091 00101 static void parseVTypeEmbedded(SUMOVTypeParameter& into, 00102 int element, const SUMOSAXAttributes& attrs, 00103 bool fromVType=false) throw(ProcessError); 00104 00105 00110 static void closeVTypeParsing(SUMOVTypeParameter& vtype) { 00111 UNUSED_PARAMETER(vtype); 00112 } 00113 00114 00129 static SUMOVehicleClass parseVehicleClass(const SUMOSAXAttributes& attrs, const std::string& id); 00130 00131 00146 static SUMOEmissionClass parseEmissionClass(const SUMOSAXAttributes& attrs, const std::string& id); 00147 00148 00163 static SUMOVehicleShape parseGuiShape(const SUMOSAXAttributes& attrs, const std::string& id); 00164 00165 00166 private: 00177 static void parseCommonAttributes(const SUMOSAXAttributes& attrs, 00178 SUMOVehicleParameter* ret, std::string element) throw(ProcessError); 00179 00180 00181 typedef std::map<SumoXMLTag, std::set<SumoXMLAttr> > CFAttrMap; 00182 00183 // returns allowed attrs for each known CF-model (init on first use) 00184 static const CFAttrMap& getAllowedCFModelAttrs(); 00185 00186 // brief allowed attrs for each known CF-model 00187 static CFAttrMap allowedCFModelAttrs; 00188 00189 00190 static bool gHaveWarnedAboutDeprecatedNumber, gHaveWarnedAboutDeprecatedTazs, 00191 gHaveWarnedAboutDeprecatedDepartLane, gHaveWarnedAboutDeprecatedDepartPos, gHaveWarnedAboutDeprecatedDepartSpeed, 00192 gHaveWarnedAboutDeprecatedArrivalLane, gHaveWarnedAboutDeprecatedArrivalPos, gHaveWarnedAboutDeprecatedArrivalSpeed, 00193 gHaveWarnedAboutDeprecatedMaxSpeed, gHaveWarnedAboutDeprecatedVClass; 00194 }; 00195 00196 00197 #endif 00198 00199 /****************************************************************************/ 00200