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-2013 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 "
RORoute.h
"
44
#include "
ROHelper.h
"
45
46
#ifdef CHECK_MEMORY_LEAKS
47
#include <
foreign/nvwa/debug_new.h
>
48
#endif // CHECK_MEMORY_LEAKS
49
50
51
// ===========================================================================
52
// method definitions
53
// ===========================================================================
54
ROVehicle::ROVehicle
(
const
SUMOVehicleParameter
& pars,
55
RORouteDef
* route,
const
SUMOVTypeParameter
* type)
56
: myParameter(pars), myType(type), myRoute(route) {}
57
58
59
ROVehicle::~ROVehicle
() {}
60
61
62
void
63
ROVehicle::saveAllAsXML
(
OutputDevice
& os,
OutputDevice
*
const
altos,
64
OutputDevice
*
const
typeos,
bool
withExitTimes)
const
{
65
// check whether the vehicle's type was saved before
66
if
(
myType
!= 0 && !
myType
->
saved
) {
67
// ... save if not
68
if
(typeos != 0) {
69
myType
->
write
(*typeos);
70
}
else
{
71
myType
->
write
(os);
72
if
(altos != 0) {
73
myType
->
write
(*altos);
74
}
75
}
76
myType
->
saved
=
true
;
77
}
78
79
// write the vehicle (new style, with included routes)
80
myParameter
.
write
(os,
OptionsCont::getOptions
());
81
if
(altos != 0) {
82
myParameter
.
write
(*altos,
OptionsCont::getOptions
());
83
}
84
85
// check whether the route shall be saved
86
if
(!
myRoute
->
isSaved
()) {
87
myRoute
->
writeXMLDefinition
(os,
this
,
false
, withExitTimes);
88
if
(altos != 0) {
89
myRoute
->
writeXMLDefinition
(*altos,
this
,
true
, withExitTimes);
90
}
91
}
92
myParameter
.
writeStops
(os);
93
if
(altos != 0) {
94
myParameter
.
writeStops
(*altos);
95
}
96
os.
closeTag
();
97
if
(altos != 0) {
98
altos->
closeTag
();
99
}
100
}
101
102
103
SUMOReal
104
ROVehicle::getMaxSpeed
()
const
{
105
return
myType
->
maxSpeed
;
106
}
107
108
109
ROVehicle
*
110
ROVehicle::copy
(
const
std::string&
id
,
unsigned
int
depTime,
111
RORouteDef
* newRoute)
const
{
112
SUMOVehicleParameter
pars(
myParameter
);
113
pars.
id
= id;
114
pars.
depart
= depTime;
115
return
new
ROVehicle
(pars, newRoute,
myType
);
116
}
117
118
119
/****************************************************************************/
120
home
gladk
tmp
05
sumo-0.17.1~dfsg
src
router
ROVehicle.cpp
Generated on Sun Jun 16 2013 07:08:29 for SUMO - Simulation of Urban MObility by
1.8.1.2