SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ROTypedXMLRoutesLoader.cpp
Go to the documentation of this file.
1 /****************************************************************************/
8 // Base class for loading routes from XML-files
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
11 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #ifdef _MSC_VER
25 #include <windows_config.h>
26 #else
27 #include <config.h>
28 #endif
29 
30 #include <string>
31 #include <xercesc/parsers/SAXParser.hpp>
32 #include <xercesc/util/PlatformUtils.hpp>
33 #include <xercesc/util/TransService.hpp>
34 #include <xercesc/sax2/SAX2XMLReader.hpp>
37 #include <utils/xml/XMLSubSys.h>
38 #include <utils/common/StdDefs.h>
39 #include "ROTypedXMLRoutesLoader.h"
40 #include "RONet.h"
41 
42 #ifdef CHECK_MEMORY_LEAKS
43 #include <foreign/nvwa/debug_new.h>
44 #endif // CHECK_MEMORY_LEAKS
45 
46 
47 // ===========================================================================
48 // method definitions
49 // ===========================================================================
51  SUMOTime begin, SUMOTime end,
52  const std::string& file)
53  : SUMOSAXHandler(file), myNet(net), myBegin(begin), myEnd(end),
54  myParser(0), myCurrentDepart(-1), myNextRouteRead(false),
55  myEnded(false) {
56  try {
59  } catch (...) {
60  throw ProcessError();
61  }
62 }
63 
64 
66  delete myParser;
67 }
68 
69 
70 bool
72  while (getLastReadTimeStep() < time && !ended()) {
73  myNextRouteRead = false;
74  while (!myNextRouteRead && !ended()) {
76  }
77  }
78  return true;
79 }
80 
81 
82 void
84  myEnded = true;
85 }
86 
87 
88 /****************************************************************************/