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
ODAmitranHandler.cpp
Go to the documentation of this file.
1
/****************************************************************************/
7
// An XML-Handler for Amitran OD matrices
8
/****************************************************************************/
9
// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
10
// Copyright (C) 2001-2014 DLR (http://www.dlr.de/) and contributors
11
/****************************************************************************/
12
//
13
// This file is part of SUMO.
14
// SUMO is free software: you can redistribute it and/or modify
15
// it under the terms of the GNU General Public License as published by
16
// the Free Software Foundation, either version 3 of the License, or
17
// (at your option) any later version.
18
//
19
/****************************************************************************/
20
21
22
// ===========================================================================
23
// included modules
24
// ===========================================================================
25
#ifdef _MSC_VER
26
#include <
windows_config.h
>
27
#else
28
#include <
config.h
>
29
#endif
30
31
#include <
utils/common/MsgHandler.h
>
32
#include "
ODMatrix.h
"
33
#include "
ODAmitranHandler.h
"
34
35
#ifdef CHECK_MEMORY_LEAKS
36
#include <
foreign/nvwa/debug_new.h
>
37
#endif // CHECK_MEMORY_LEAKS
38
39
40
// ===========================================================================
41
// method definitions
42
// ===========================================================================
43
ODAmitranHandler::ODAmitranHandler
(
ODMatrix
& matrix,
const
std::string& file)
44
:
SUMOSAXHandler
(file), myMatrix(matrix) {}
45
46
47
ODAmitranHandler::~ODAmitranHandler
() {}
48
49
50
void
51
ODAmitranHandler::myStartElement
(
int
element,
const
SUMOSAXAttributes
& attrs) {
52
bool
ok =
true
;
53
switch
(element) {
54
case
SUMO_TAG_ACTORCONFIG
:
55
myVehicleType
= attrs.
get
<std::string>(
SUMO_ATTR_ID
, 0, ok);
56
break
;
57
case
SUMO_TAG_TIMESLICE
:
58
myBegin
= attrs.
get
<
int
>(
SUMO_ATTR_STARTTIME
,
myVehicleType
.c_str(), ok);
59
myEnd
=
myBegin
+ attrs.
get
<
int
>(
SUMO_ATTR_DURATION
,
myVehicleType
.c_str(), ok);
60
if
(
myBegin
>= myEnd) {
61
WRITE_ERROR
(
"Invalid duration for timeSlice starting "
+
toString
(
myBegin
) +
"."
);
62
}
63
break
;
64
case
SUMO_TAG_OD_PAIR
:
65
myMatrix
.
add
(attrs.
get
<
SUMOReal
>(
SUMO_ATTR_AMOUNT
,
myVehicleType
.c_str(), ok),
66
myBegin
, myEnd, attrs.
get
<std::string>(
SUMO_ATTR_ORIGIN
,
myVehicleType
.c_str(), ok),
67
attrs.
get
<std::string>(
SUMO_ATTR_DESTINATION
,
myVehicleType
.c_str(), ok),
myVehicleType
);
68
break
;
69
default
:
70
break
;
71
}
72
}
73
74
75
/****************************************************************************/
tmp
buildd
sumo-0.21.0+dfsg
src
od2trips
ODAmitranHandler.cpp
Generated on Thu Nov 20 2014 19:49:58 for SUMO - Simulation of Urban MObility by
1.8.1.2