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
MSBaseVehicle.h
Go to the documentation of this file.
1
/****************************************************************************/
8
// A base class for vehicle implementations
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
#ifndef MSBaseVehicle_h
22
#define MSBaseVehicle_h
23
24
25
// ===========================================================================
26
// included modules
27
// ===========================================================================
28
#ifdef _MSC_VER
29
#include <
windows_config.h
>
30
#else
31
#include <
config.h
>
32
#endif
33
34
#include <iostream>
35
#include <vector>
36
#include <
utils/common/SUMOVehicle.h
>
37
#include <
utils/common/StdDefs.h
>
38
#include "
MSRoute.h
"
39
#include "
MSMoveReminder.h
"
40
41
42
// ===========================================================================
43
// class declarations
44
// ===========================================================================
45
class
SUMOVehicleParameter
;
46
class
MSVehicleType
;
47
48
49
// ===========================================================================
50
// class definitions
51
// ===========================================================================
56
class
MSBaseVehicle
:
public
SUMOVehicle
{
57
public
:
65
MSBaseVehicle
(
SUMOVehicleParameter
* pars,
const
MSRoute
* route,
const
MSVehicleType
* type,
SUMOReal
speedFactor);
66
67
69
virtual
~MSBaseVehicle
();
70
71
73
const
std::string&
getID
()
const
;
74
79
const
SUMOVehicleParameter
&
getParameter
()
const
;
80
81
85
const
MSRoute
&
getRoute
()
const
;
86
87
91
const
MSVehicleType
&
getVehicleType
()
const
;
92
93
97
SUMOReal
getMaxSpeed
()
const
;
98
99
107
const
MSEdge
*
succEdge
(
unsigned
int
nSuccs)
const
;
108
113
const
MSEdge
*
getEdge
()
const
;
114
115
119
virtual
bool
isOnRoad
()
const
{
120
return
true
;
121
}
122
123
133
void
reroute
(
SUMOTime
t,
SUMOAbstractRouter<MSEdge, SUMOVehicle>
& router,
bool
withTaz =
false
);
134
135
146
bool
replaceRouteEdges
(
const
MSEdgeVector
& edges,
bool
onInit =
false
);
147
148
154
virtual
SUMOReal
getAcceleration
()
const
;
155
161
void
onDepart
();
162
166
inline
SUMOTime
getDeparture
()
const
{
167
return
myDeparture
;
168
}
169
172
bool
hasDeparted
()
const
;
173
177
virtual
bool
hasArrived
()
const
;
178
182
inline
unsigned
int
getNumberReroutes
()
const
{
183
return
myNumberReroutes
;
184
}
185
189
inline
const
std::vector<MSDevice*>&
getDevices
()
const
{
190
return
myDevices
;
191
}
192
199
virtual
void
addPerson
(
MSPerson
* person);
200
205
bool
hasValidRoute
(std::string& msg)
const
;
206
212
void
addReminder
(
MSMoveReminder
* rem);
213
219
void
removeReminder
(
MSMoveReminder
* rem);
220
231
virtual
void
activateReminders
(
const
MSMoveReminder::Notification
reason);
232
236
SUMOReal
getChosenSpeedFactor
()
const
{
237
return
myChosenSpeedFactor
;
238
}
239
240
protected
:
243
void
calculateArrivalPos
();
244
245
protected
:
247
const
SUMOVehicleParameter
*
myParameter
;
248
250
const
MSRoute
*
myRoute
;
251
253
const
MSVehicleType
*
myType
;
254
256
MSRouteIterator
myCurrEdge
;
257
259
SUMOReal
myChosenSpeedFactor
;
260
261
264
266
typedef
std::vector< std::pair<MSMoveReminder*, SUMOReal> >
MoveReminderCont
;
267
269
MoveReminderCont
myMoveReminders
;
271
273
std::vector<MSDevice*>
myDevices
;
274
276
SUMOTime
myDeparture
;
277
279
SUMOReal
myArrivalPos
;
280
282
unsigned
int
myNumberReroutes
;
283
284
private
:
285
/* @brief magic value for undeparted vehicles
286
* @note: in previous versions this was -1
287
*/
288
static
const
SUMOTime
NOT_YET_DEPARTED
;
289
290
};
291
292
#endif
293
294
/****************************************************************************/
build
buildd
sumo-0.16.0~dfsg
src
microsim
MSBaseVehicle.h
Generated on Tue Apr 16 2013 01:32:17 for SUMO - Simulation of Urban MObility by
1.8.3.1