SUMO - Simulation of Urban MObility
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
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>
35
#include <
utils/common/UtilExceptions.h
>
36
#include <
utils/common/MsgHandler.h
>
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
// ===========================================================================
50
ROTypedXMLRoutesLoader::ROTypedXMLRoutesLoader
(
RONet
& net,
51
SUMOTime
begin,
52
SUMOTime
end,
53
const
std::string& file)
54
: myNet(net), myBegin(begin), myEnd(end),
SUMOSAXHandler
(file),
55
myParser(0), myToken(), myEnded(false), myCurrentDepart(-1), myNextRouteRead(false) {
56
try
{
57
myParser
=
XMLSubSys::getSAXReader
(*
this
);
58
myParser
->parseFirst(
getFileName
().c_str(),
myToken
);
59
}
catch
(...) {
60
throw
ProcessError
();
61
}
62
}
63
64
65
ROTypedXMLRoutesLoader::~ROTypedXMLRoutesLoader
() {
66
delete
myParser
;
67
}
68
69
70
bool
71
ROTypedXMLRoutesLoader::readRoutesAtLeastUntil
(
SUMOTime
time) {
72
while
(
getLastReadTimeStep
() < time && !
ended
()) {
73
myNextRouteRead
=
false
;
74
while
(!
myNextRouteRead
&& !
ended
()) {
75
myParser
->parseNext(
myToken
);
76
}
77
}
78
return
true
;
79
}
80
81
82
void
83
ROTypedXMLRoutesLoader::endDocument
() {
84
myEnded
=
true
;
85
}
86
87
88
89
90
/****************************************************************************/
91
build
buildd
sumo-0.15.0~dfsg
src
router
ROTypedXMLRoutesLoader.cpp
Generated on Wed Jul 18 2012 22:58:36 for SUMO - Simulation of Urban MObility by
1.8.1.1