SUMO - Simulation of Urban MObility
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-2017 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 
37 #include <od/ODMatrix.h>
38 #include "ROMARouteHandler.h"
39 
40 
41 // ===========================================================================
42 // method definitions
43 // ===========================================================================
45  SUMOSAXHandler(""),
46  myMatrix(matrix) {
47  if (OptionsCont::getOptions().isSet("taz-param")) {
49  }
50 }
51 
52 
54 }
55 
56 
57 void
59  const SUMOSAXAttributes& attrs) {
60  if (element == SUMO_TAG_TRIP || element == SUMO_TAG_VEHICLE) {
62  } else if (element == SUMO_TAG_PARAM && !myTazParamKeys.empty()) {
63  if (attrs.getString(SUMO_ATTR_KEY) == myTazParamKeys[0]) {
65  }
66  if (myTazParamKeys.size() > 1 && attrs.getString(SUMO_ATTR_KEY) == myTazParamKeys[1]) {
68  }
69  }
70 }
71 
72 
73 void
75  if (element == SUMO_TAG_TRIP || element == SUMO_TAG_VEHICLE) {
76  std::pair<const std::string, const std::string> od = std::make_pair(myVehicleParameter->fromTaz, myVehicleParameter->toTaz);
78  delete myVehicleParameter;
79  }
80 }
81 
82 
83 /****************************************************************************/
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&#39;s type id.
static SUMOVehicleParameter * parseVehicleAttributes(const SUMOSAXAttributes &attrs, const bool optionalID=false, const bool skipDepart=false, const bool isPerson=false)
Parses a vehicle&#39;s attributes.
virtual ~ROMARouteHandler()
standard destructor
SAX-handler base for SUMO-files.
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:65
std::string toTaz
The vehicle&#39;s destination zone (district)
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.
parameter associated to a certain key
An O/D (origin/destination) matrix.
Definition: ODMatrix.h:76
SUMOTime depart
The vehicle&#39;s departure time.
std::string fromTaz
The vehicle&#39;s origin zone (district)
void myEndElement(int element)
Callback method for a closing tag to implement by derived classes.
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
bool add(double 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:71
description of a vehicle
SUMOVehicleParameter * myVehicleParameter
The current vehicle parameters.
a single trip definition (used by router)
std::string id
The vehicle&#39;s id.