SUMO - Simulation of Urban MObility
SUMOVehicleParserHelper.h
Go to the documentation of this file.
1 /****************************************************************************/
10 // Helper methods for parsing vehicle attributes
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
13 // Copyright (C) 2008-2015 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 #ifndef SUMOVehicleParserHelper_h
24 #define SUMOVehicleParserHelper_h
25 
26 
27 // ===========================================================================
28 // included modules
29 // ===========================================================================
30 #ifdef _MSC_VER
31 #include <windows_config.h>
32 #else
33 #include <config.h>
34 #endif
35 
36 #include <string>
39 #include <utils/common/SUMOTime.h>
44 #include <utils/common/StdDefs.h>
45 
46 // ===========================================================================
47 // class definitions
48 // ===========================================================================
56 public:
67  static SUMOVehicleParameter* parseFlowAttributes(const SUMOSAXAttributes& attrs, const SUMOTime beginDefault, const SUMOTime endDefault);
68 
69 
84  const bool optionalID = false, const bool skipDepart = false, const bool isPerson = false);
85 
86 
95  static SUMOVTypeParameter* beginVTypeParsing(const SUMOSAXAttributes& attrs, const std::string& file);
96 
97 
107  static void parseVTypeEmbedded(SUMOVTypeParameter& into,
108  int element, const SUMOSAXAttributes& attrs,
109  bool fromVType = false);
110 
111 
116  static void closeVTypeParsing(SUMOVTypeParameter& vtype) {
117  UNUSED_PARAMETER(vtype);
118  }
119 
120 
135  static SUMOVehicleClass parseVehicleClass(const SUMOSAXAttributes& attrs, const std::string& id);
136 
137 
152  static SUMOEmissionClass parseEmissionClass(const SUMOSAXAttributes& attrs, const std::string& id);
153 
154 
169  static SUMOVehicleShape parseGuiShape(const SUMOSAXAttributes& attrs, const std::string& id);
170 
171 private:
182  static void parseCommonAttributes(const SUMOSAXAttributes& attrs,
183  SUMOVehicleParameter* ret, std::string element);
184 
185 
186  typedef std::map<SumoXMLTag, std::set<SumoXMLAttr> > CFAttrMap;
187 
188  // returns allowed attrs for each known CF-model (init on first use)
189  static const CFAttrMap& getAllowedCFModelAttrs();
190 
191  // brief allowed attrs for each known CF-model
192  static CFAttrMap allowedCFModelAttrs;
193 
194 
195 };
196 
197 
198 #endif
199 
200 /****************************************************************************/
201 
long long int SUMOTime
Definition: SUMOTime.h:43
static SUMOVehicleShape parseGuiShape(const SUMOSAXAttributes &attrs, const std::string &id)
Parses the vehicle class.
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
static void parseVTypeEmbedded(SUMOVTypeParameter &into, int element, const SUMOSAXAttributes &attrs, bool fromVType=false)
Parses an element embedded in vtype definition.
Structure representing possible vehicle parameter.
static SUMOVehicleParameter * parseVehicleAttributes(const SUMOSAXAttributes &attrs, const bool optionalID=false, const bool skipDepart=false, const bool isPerson=false)
Parses a vehicle&#39;s attributes.
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:39
static SUMOVehicleClass parseVehicleClass(const SUMOSAXAttributes &attrs, const std::string &id)
Parses the vehicle class.
static const CFAttrMap & getAllowedCFModelAttrs()
Encapsulated SAX-Attributes.
static SUMOVehicleParameter * parseFlowAttributes(const SUMOSAXAttributes &attrs, const SUMOTime beginDefault, const SUMOTime endDefault)
Parses a flow&#39;s attributes.
int SUMOEmissionClass
static void parseCommonAttributes(const SUMOSAXAttributes &attrs, SUMOVehicleParameter *ret, std::string element)
Parses attributes common to vehicles and flows.
std::map< SumoXMLTag, std::set< SumoXMLAttr > > CFAttrMap
Helper methods for parsing vehicle attributes.
static void closeVTypeParsing(SUMOVTypeParameter &vtype)
Closes parsing of the vehicle type.
Structure representing possible vehicle parameter.
SUMOVehicleShape
Definition of vehicle classes to differ between different appearences.
static SUMOEmissionClass parseEmissionClass(const SUMOSAXAttributes &attrs, const std::string &id)
Parses the vehicle emission class.
static SUMOVTypeParameter * beginVTypeParsing(const SUMOSAXAttributes &attrs, const std::string &file)
Starts to parse a vehicle type.