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 "
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
.
writeAs
(
"vehicle"
, os,
OptionsCont::getOptions
());
81
if
(altos != 0) {
82
myParameter
.
writeAs
(
"vehicle"
, *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
os.
closeTag
();
93
if
(altos != 0) {
94
altos->
closeTag
();
95
}
96
}
97
98
99
SUMOReal
100
ROVehicle::getMaxSpeed
()
const
{
101
return
myType
->
maxSpeed
;
102
}
103
104
105
ROVehicle
*
106
ROVehicle::copy
(
const
std::string&
id
,
unsigned
int
depTime,
107
RORouteDef
* newRoute)
const
{
108
SUMOVehicleParameter
pars(
myParameter
);
109
pars.
id
= id;
110
pars.
depart
= depTime;
111
return
new
ROVehicle
(pars, newRoute,
myType
);
112
}
113
114
115
/****************************************************************************/
116
build
buildd
sumo-0.16.0~dfsg
src
router
ROVehicle.cpp
Generated on Tue Apr 16 2013 01:32:20 for SUMO - Simulation of Urban MObility by
1.8.3.1