SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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-sim.org/
13 // Copyright (C) 2001-2014 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 
83  bool optionalID = false, bool skipDepart = false);
84 
85 
94  static SUMOVTypeParameter* beginVTypeParsing(const SUMOSAXAttributes& attrs, const std::string& file);
95 
96 
106  static void parseVTypeEmbedded(SUMOVTypeParameter& into,
107  int element, const SUMOSAXAttributes& attrs,
108  bool fromVType = false);
109 
110 
115  static void closeVTypeParsing(SUMOVTypeParameter& vtype) {
116  UNUSED_PARAMETER(vtype);
117  }
118 
119 
134  static SUMOVehicleClass parseVehicleClass(const SUMOSAXAttributes& attrs, const std::string& id);
135 
136 
151  static SUMOEmissionClass parseEmissionClass(const SUMOSAXAttributes& attrs, const std::string& id);
152 
153 
168  static SUMOVehicleShape parseGuiShape(const SUMOSAXAttributes& attrs, const std::string& id);
169 
170 private:
181  static void parseCommonAttributes(const SUMOSAXAttributes& attrs,
182  SUMOVehicleParameter* ret, std::string element);
183 
184 
185  typedef std::map<SumoXMLTag, std::set<SumoXMLAttr> > CFAttrMap;
186 
187  // returns allowed attrs for each known CF-model (init on first use)
188  static const CFAttrMap& getAllowedCFModelAttrs();
189 
190  // brief allowed attrs for each known CF-model
192 
193 
194 };
195 
196 
197 #endif
198 
199 /****************************************************************************/
200 
static SUMOVehicleParameter * parseVehicleAttributes(const SUMOSAXAttributes &attrs, bool optionalID=false, bool skipDepart=false)
Parses a vehicle's attributes.
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.
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:38
static SUMOVehicleClass parseVehicleClass(const SUMOSAXAttributes &attrs, const std::string &id)
Parses the vehicle class.
SUMOEmissionClass
Definition of vehicle emission classes.
static const CFAttrMap & getAllowedCFModelAttrs()
Encapsulated SAX-Attributes.
static SUMOVehicleParameter * parseFlowAttributes(const SUMOSAXAttributes &attrs, const SUMOTime beginDefault, const SUMOTime endDefault)
Parses a flow's attributes.
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.