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
ROVehicle.cpp
Go to the documentation of this file.
1
/****************************************************************************/
9
// A vehicle as used by router
10
/****************************************************************************/
11
// SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
12
// Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
13
/****************************************************************************/
14
//
15
// This file is part of SUMO.
16
// SUMO is free software: you can redistribute it and/or modify
17
// it under the terms of the GNU General Public License as published by
18
// the Free Software Foundation, either version 3 of the License, or
19
// (at your option) any later version.
20
//
21
/****************************************************************************/
22
23
24
// ===========================================================================
25
// included modules
26
// ===========================================================================
27
#ifdef _MSC_VER
28
#include <
windows_config.h
>
29
#else
30
#include <
config.h
>
31
#endif
32
33
#include <
utils/common/TplConvert.h
>
34
#include <
utils/common/ToString.h
>
35
#include <
utils/common/MsgHandler.h
>
36
#include <
utils/common/SUMOVTypeParameter.h
>
37
#include <
utils/options/OptionsCont.h
>
38
#include <
utils/iodevices/OutputDevice.h
>
39
#include <string>
40
#include <iostream>
41
#include "
RORouteDef.h
"
42
#include "
ROVehicle.h
"
43
#include "
RORouteDef_Alternatives.h
"
44
#include "
RORoute.h
"
45
#include "
ROHelper.h
"
46
47
#ifdef CHECK_MEMORY_LEAKS
48
#include <
foreign/nvwa/debug_new.h
>
49
#endif // CHECK_MEMORY_LEAKS
50
51
52
// ===========================================================================
53
// method definitions
54
// ===========================================================================
55
ROVehicle::ROVehicle
(
const
SUMOVehicleParameter
& pars,
56
RORouteDef
* route,
SUMOVTypeParameter
* type)
57
: myParameter(pars), myType(type), myRoute(route) {}
58
59
60
ROVehicle::~ROVehicle
() {}
61
62
63
void
64
ROVehicle::saveAllAsXML
(
SUMOAbstractRouter<ROEdge, ROVehicle>
&router,
OutputDevice
& os,
65
OutputDevice
*
const
altos,
OutputDevice
*
const
typeos,
bool
withExitTimes)
const
{
66
// check whether the vehicle's type was saved before
67
if
(
myType
!= 0 && !
myType
->
saved
) {
68
// ... save if not
69
if
(typeos != 0) {
70
myType
->
write
(*typeos);
71
}
else
{
72
myType
->
write
(os);
73
if
(altos != 0) {
74
myType
->
write
(*altos);
75
}
76
}
77
myType
->
saved
=
true
;
78
}
79
80
// write the vehicle (new style, with included routes)
81
myParameter
.
writeAs
(
"vehicle"
, os,
OptionsCont::getOptions
());
82
if
(altos != 0) {
83
myParameter
.
writeAs
(
"vehicle"
, *altos,
OptionsCont::getOptions
());
84
}
85
86
// check whether the route shall be saved
87
if
(!
myRoute
->
isSaved
()) {
88
myRoute
->
writeXMLDefinition
(router, os,
this
,
false
, withExitTimes);
89
if
(altos != 0) {
90
myRoute
->
writeXMLDefinition
(router, *altos,
this
,
true
, withExitTimes);
91
}
92
}
93
os.
closeTag
();
94
if
(altos != 0) {
95
altos->
closeTag
();
96
}
97
}
98
99
100
SUMOReal
101
ROVehicle::getMaxSpeed
()
const
{
102
return
myType
->
maxSpeed
;
103
}
104
105
106
ROVehicle
*
107
ROVehicle::copy
(
const
std::string&
id
,
unsigned
int
depTime,
108
RORouteDef
* newRoute) {
109
SUMOVehicleParameter
pars(
myParameter
);
110
pars.
id
= id;
111
pars.
depart
= depTime;
112
return
new
ROVehicle
(pars, newRoute,
myType
);
113
}
114
115
116
/****************************************************************************/
117
tmp
buildd
sumo-0.15.0~dfsg
src
router
ROVehicle.cpp
Generated on Sun May 27 2012 14:52:11 for SUMO - Simulation of Urban MObility by
1.8.1