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-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 <
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
174
virtual
SUMOReal
getArrivalPos
()
const
{
175
return
myArrivalPos
;
176
}
177
180
bool
hasDeparted
()
const
;
181
185
virtual
bool
hasArrived
()
const
;
186
190
inline
unsigned
int
getNumberReroutes
()
const
{
191
return
myNumberReroutes
;
192
}
193
197
inline
const
std::vector<MSDevice*>&
getDevices
()
const
{
198
return
myDevices
;
199
}
200
207
virtual
void
addPerson
(
MSPerson
* person);
208
213
bool
hasValidRoute
(std::string& msg)
const
;
214
220
void
addReminder
(
MSMoveReminder
* rem);
221
227
void
removeReminder
(
MSMoveReminder
* rem);
228
239
virtual
void
activateReminders
(
const
MSMoveReminder::Notification
reason);
240
244
SUMOReal
getChosenSpeedFactor
()
const
{
245
return
myChosenSpeedFactor
;
246
}
247
248
protected
:
251
void
calculateArrivalPos
();
252
253
protected
:
255
const
SUMOVehicleParameter
*
myParameter
;
256
258
const
MSRoute
*
myRoute
;
259
261
const
MSVehicleType
*
myType
;
262
264
MSRouteIterator
myCurrEdge
;
265
267
SUMOReal
myChosenSpeedFactor
;
268
269
272
274
typedef
std::vector< std::pair<MSMoveReminder*, SUMOReal> >
MoveReminderCont
;
275
277
MoveReminderCont
myMoveReminders
;
279
281
std::vector<MSDevice*>
myDevices
;
282
284
SUMOTime
myDeparture
;
285
287
SUMOReal
myArrivalPos
;
288
290
unsigned
int
myNumberReroutes
;
291
292
private
:
293
/* @brief magic value for undeparted vehicles
294
* @note: in previous versions this was -1
295
*/
296
static
const
SUMOTime
NOT_YET_DEPARTED
;
297
298
};
299
300
#endif
301
302
/****************************************************************************/
home
gladk
tmp
05
sumo-0.17.1~dfsg
src
microsim
MSBaseVehicle.h
Generated on Sun Jun 16 2013 07:07:27 for SUMO - Simulation of Urban MObility by
1.8.1.2