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-sim.org/
11
// Copyright (C) 2001-2013 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 <set>
37
#include <
utils/common/SUMOVehicle.h
>
38
#include <
utils/common/StdDefs.h
>
39
#include "
MSRoute.h
"
40
#include "
MSMoveReminder.h
"
41
42
43
// ===========================================================================
44
// class declarations
45
// ===========================================================================
46
class
SUMOVehicleParameter
;
47
class
MSVehicleType
;
48
49
50
// ===========================================================================
51
// class definitions
52
// ===========================================================================
57
class
MSBaseVehicle
:
public
SUMOVehicle
{
58
public
:
66
MSBaseVehicle
(
SUMOVehicleParameter
* pars,
const
MSRoute
* route,
const
MSVehicleType
* type,
const
SUMOReal
speedFactor);
67
68
70
virtual
~MSBaseVehicle
();
71
72
74
const
std::string&
getID
()
const
;
75
80
const
SUMOVehicleParameter
&
getParameter
()
const
;
81
82
86
inline
const
MSRoute
&
getRoute
()
const
{
87
return
*
myRoute
;
88
}
89
90
94
inline
const
MSVehicleType
&
getVehicleType
()
const
{
95
return
*
myType
;
96
}
97
98
102
SUMOReal
getMaxSpeed
()
const
;
103
104
112
const
MSEdge
*
succEdge
(
unsigned
int
nSuccs)
const
;
113
118
const
MSEdge
*
getEdge
()
const
;
119
120
124
virtual
bool
isOnRoad
()
const
{
125
return
true
;
126
}
127
128
138
void
reroute
(
SUMOTime
t,
SUMOAbstractRouter<MSEdge, SUMOVehicle>
& router,
bool
withTaz =
false
);
139
140
151
bool
replaceRouteEdges
(
const
MSEdgeVector
& edges,
bool
onInit =
false
);
152
153
159
virtual
SUMOReal
getAcceleration
()
const
;
160
166
void
onDepart
();
167
171
inline
SUMOTime
getDeparture
()
const
{
172
return
myDeparture
;
173
}
174
179
virtual
SUMOReal
getArrivalPos
()
const
{
180
return
myArrivalPos
;
181
}
182
185
bool
hasDeparted
()
const
;
186
190
virtual
bool
hasArrived
()
const
;
191
195
inline
unsigned
int
getNumberReroutes
()
const
{
196
return
myNumberReroutes
;
197
}
198
202
inline
const
std::vector<MSDevice*>&
getDevices
()
const
{
203
return
myDevices
;
204
}
205
212
virtual
void
addPerson
(
MSPerson
* person);
213
218
bool
hasValidRoute
(std::string& msg)
const
;
219
225
void
addReminder
(
MSMoveReminder
* rem);
226
232
void
removeReminder
(
MSMoveReminder
* rem);
233
244
virtual
void
activateReminders
(
const
MSMoveReminder::Notification
reason);
245
249
inline
SUMOReal
getChosenSpeedFactor
()
const
{
250
return
myChosenSpeedFactor
;
251
}
252
256
inline
void
setChosenSpeedFactor
(
SUMOReal
factor) {
257
myChosenSpeedFactor
= factor;
258
}
259
261
MSDevice
*
getDevice
(
const
std::type_info& type)
const
;
262
263
265
266
268
virtual
void
saveState
(
OutputDevice
& out);
269
271
272
protected
:
275
void
calculateArrivalPos
();
276
277
protected
:
279
const
SUMOVehicleParameter
*
myParameter
;
280
282
const
MSRoute
*
myRoute
;
283
285
const
MSVehicleType
*
myType
;
286
288
MSRouteIterator
myCurrEdge
;
289
291
SUMOReal
myChosenSpeedFactor
;
292
293
296
298
typedef
std::vector< std::pair<MSMoveReminder*, SUMOReal> >
MoveReminderCont
;
299
301
MoveReminderCont
myMoveReminders
;
303
305
std::vector<MSDevice*>
myDevices
;
306
308
SUMOTime
myDeparture
;
309
311
SUMOReal
myArrivalPos
;
312
314
unsigned
int
myNumberReroutes
;
315
316
private
:
317
/* @brief magic value for undeparted vehicles
318
* @note: in previous versions this was -1
319
*/
320
static
const
SUMOTime
NOT_YET_DEPARTED
;
321
323
MSBaseVehicle
&
operator=
(
const
MSBaseVehicle
& s);
324
325
326
#ifdef _DEBUG
327
public
:
328
static
void
initMoveReminderOutput(
const
OptionsCont
& oc);
329
330
protected
:
332
void
traceMoveReminder(
const
std::string& type,
MSMoveReminder
* rem,
SUMOReal
pos,
bool
keep)
const
;
333
335
const
bool
myTraceMoveReminders;
336
private
:
338
static
std::set<std::string> myShallTraceMoveReminders;
339
#endif
340
341
342
};
343
344
#endif
345
346
/****************************************************************************/
home
delphi
sumo
src
microsim
MSBaseVehicle.h
Generated by
1.8.2