SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00010 // Helper methods for parsing vehicle attributes 00011 /****************************************************************************/ 00012 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00013 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00014 /****************************************************************************/ 00015 // 00016 // This file is part of SUMO. 00017 // SUMO is free software: you can redistribute it and/or modify 00018 // it under the terms of the GNU General Public License as published by 00019 // the Free Software Foundation, either version 3 of the License, or 00020 // (at your option) any later version. 00021 // 00022 /****************************************************************************/ 00023 #ifndef SUMOVehicleParserHelper_h 00024 #define SUMOVehicleParserHelper_h 00025 00026 00027 // =========================================================================== 00028 // included modules 00029 // =========================================================================== 00030 #ifdef _MSC_VER 00031 #include <windows_config.h> 00032 #else 00033 #include <config.h> 00034 #endif 00035 00036 #include <string> 00037 #include <utils/xml/SUMOSAXHandler.h> 00038 #include <utils/xml/SUMOXMLDefinitions.h> 00039 #include <utils/common/SUMOTime.h> 00040 #include <utils/common/SUMOVehicleClass.h> 00041 #include <utils/common/SUMOVehicleParameter.h> 00042 #include <utils/common/SUMOVTypeParameter.h> 00043 #include <utils/common/UtilExceptions.h> 00044 #include <utils/common/StdDefs.h> 00045 00046 // =========================================================================== 00047 // class definitions 00048 // =========================================================================== 00055 class SUMOVehicleParserHelper { 00056 public: 00067 static SUMOVehicleParameter* parseFlowAttributes(const SUMOSAXAttributes& attrs) ; 00068 00069 00082 static SUMOVehicleParameter* parseVehicleAttributes(const SUMOSAXAttributes& attrs, 00083 bool skipID = false, bool skipDepart = false) ; 00084 00085 00093 static SUMOVTypeParameter* beginVTypeParsing(const SUMOSAXAttributes& attrs) ; 00094 00095 00105 static void parseVTypeEmbedded(SUMOVTypeParameter& into, 00106 int element, const SUMOSAXAttributes& attrs, 00107 bool fromVType = false) ; 00108 00109 00114 static void closeVTypeParsing(SUMOVTypeParameter& vtype) { 00115 UNUSED_PARAMETER(vtype); 00116 } 00117 00118 00133 static SUMOVehicleClass parseVehicleClass(const SUMOSAXAttributes& attrs, const std::string& id); 00134 00135 00150 static SUMOEmissionClass parseEmissionClass(const SUMOSAXAttributes& attrs, const std::string& id); 00151 00152 00167 static SUMOVehicleShape parseGuiShape(const SUMOSAXAttributes& attrs, const std::string& id); 00168 00169 00170 private: 00181 static void parseCommonAttributes(const SUMOSAXAttributes& attrs, 00182 SUMOVehicleParameter* ret, std::string element) ; 00183 00184 00185 typedef std::map<SumoXMLTag, std::set<SumoXMLAttr> > CFAttrMap; 00186 00187 // returns allowed attrs for each known CF-model (init on first use) 00188 static const CFAttrMap& getAllowedCFModelAttrs(); 00189 00190 // brief allowed attrs for each known CF-model 00191 static CFAttrMap allowedCFModelAttrs; 00192 00193 00194 static bool gHaveWarnedAboutDeprecatedNumber, gHaveWarnedAboutDeprecatedTazs, 00195 gHaveWarnedAboutDeprecatedDepartLane, gHaveWarnedAboutDeprecatedDepartPos, gHaveWarnedAboutDeprecatedDepartSpeed, 00196 gHaveWarnedAboutDeprecatedArrivalLane, gHaveWarnedAboutDeprecatedArrivalPos, gHaveWarnedAboutDeprecatedArrivalSpeed, 00197 gHaveWarnedAboutDeprecatedMaxSpeed, gHaveWarnedAboutDeprecatedVClass; 00198 }; 00199 00200 00201 #endif 00202 00203 /****************************************************************************/ 00204