SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ROMARouteHandler.cpp
Go to the documentation of this file.
1 /****************************************************************************/
10 // Parser and container for routes during their loading
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
13 // Copyright (C) 2001-2016 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 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
36 #include <od/ODMatrix.h>
37 #include "ROMARouteHandler.h"
38 
39 #ifdef CHECK_MEMORY_LEAKS
40 #include <foreign/nvwa/debug_new.h>
41 #endif // CHECK_MEMORY_LEAKS
42 
43 
44 // ===========================================================================
45 // method definitions
46 // ===========================================================================
48  SUMOSAXHandler(""),
49  myMatrix(matrix) {
50  if (OptionsCont::getOptions().isSet("taz-param")) {
52  }
53 }
54 
55 
57 }
58 
59 
60 void
62  const SUMOSAXAttributes& attrs) {
63  if (element == SUMO_TAG_TRIP || element == SUMO_TAG_VEHICLE) {
65  } else if (element == SUMO_TAG_PARAM && !myTazParamKeys.empty()) {
66  if (attrs.getString(SUMO_ATTR_KEY) == myTazParamKeys[0]) {
68  }
69  if (myTazParamKeys.size() > 1 && attrs.getString(SUMO_ATTR_KEY) == myTazParamKeys[1]) {
71  }
72  }
73 }
74 
75 
76 void
78  if (element == SUMO_TAG_TRIP || element == SUMO_TAG_VEHICLE) {
79  std::pair<const std::string, const std::string> od = std::make_pair(myVehicleParameter->fromTaz, myVehicleParameter->toTaz);
81  delete myVehicleParameter;
82  }
83 }
84 
85 
86 /****************************************************************************/
ODMatrix & myMatrix
The matrix to fill.
std::vector< std::string > getStringVector(const std::string &name) const
Returns the list of string-vector-value of the named option (only for Option_String) ...
ROMARouteHandler(ODMatrix &matrix)
standard constructor
std::string vtypeid
The vehicle's type id.
static SUMOVehicleParameter * parseVehicleAttributes(const SUMOSAXAttributes &attrs, const bool optionalID=false, const bool skipDepart=false, const bool isPerson=false)
Parses a vehicle's attributes.
virtual ~ROMARouteHandler()
standard destructor
SAX-handler base for SUMO-files.
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:69
std::string toTaz
The vehicle's destination zone (district)
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
std::vector< std::string > myTazParamKeys
The keys for reading taz.
Encapsulated SAX-Attributes.
An O/D (origin/destination) matrix.
Definition: ODMatrix.h:76
SUMOTime depart
The vehicle's departure time.
std::string fromTaz
The vehicle's origin zone (district)
void myEndElement(int element)
Callback method for a closing tag to implement by derived classes.
SUMOVehicleParameter * myVehicleParameter
The current vehicle parameters.
std::string id
The vehicle's id.
bool add(SUMOReal vehicleNumber, SUMOTime begin, SUMOTime end, const std::string &origin, const std::string &destination, const std::string &vehicleType)
Builds a single cell from the given values, verifying them.
Definition: ODMatrix.cpp:75