Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/utils/vehicle/SUMORouteLoaderControl.h
169678 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2002-2025 German Aerospace Center (DLR) and others.
4
// This program and the accompanying materials are made available under the
5
// terms of the Eclipse Public License 2.0 which is available at
6
// https://www.eclipse.org/legal/epl-2.0/
7
// This Source Code may also be made available under the following Secondary
8
// Licenses when the conditions for such availability set forth in the Eclipse
9
// Public License 2.0 are satisfied: GNU General Public License, version 2
10
// or later which is available at
11
// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13
/****************************************************************************/
14
/// @file SUMORouteLoaderControl.h
15
/// @author Daniel Krajzewicz
16
/// @author Sascha Krieg
17
/// @author Michael Behrisch
18
/// @author Jakob Erdmann
19
/// @date Wed, 06 Nov 2002
20
///
21
// Class responsible for loading of routes from some files
22
/****************************************************************************/
23
#pragma once
24
#include <config.h>
25
26
#include <vector>
27
28
29
// ===========================================================================
30
// class declarations
31
// ===========================================================================
32
class SUMORouteLoader;
33
34
// ===========================================================================
35
// class definitions
36
// ===========================================================================
37
/**
38
* @class SUMORouteLoaderControl
39
*
40
* SUMORouteLoaderControl
41
* This controls is initialised with the list of route loaders and uses them
42
* to load routes step wise.
43
* The parameter myInAdvanceStepNo holds the number of time steps to read the
44
* routes in forward. If it is 0 (default), all routes will be read at once.
45
*/
46
class SUMORouteLoaderControl {
47
public:
48
/// @brief constructor
49
SUMORouteLoaderControl(SUMOTime inAdvanceStepNo);
50
51
/// @brief destructor
52
~SUMORouteLoaderControl();
53
54
/// @brief add another loader
55
void add(SUMORouteLoader* loader);
56
57
/// @brief loads the next routes up to and including the given time step
58
void loadNext(SUMOTime step);
59
60
/// @brief returns the timestamp of the first loaded vehicle or flow
61
SUMOTime getFirstLoadTime() const {
62
return myFirstLoadTime;
63
}
64
65
/// @brief returns whether loading is completed
66
bool haveAllLoaded() const {
67
return myAllLoaded;
68
}
69
70
/// @brief return a route loader
71
SUMORouteLoader* getFirstLoader() const;
72
73
private:
74
/// @brief the first time step for which vehicles were loaded
75
SUMOTime myFirstLoadTime;
76
77
/// @brief the time step up to which vehicles were loaded
78
SUMOTime myCurrentLoadTime;
79
80
/// @brief the number of routes to read in forward
81
const SUMOTime myInAdvanceStepNo;
82
83
/// @brief the list of route loaders
84
std::vector<SUMORouteLoader*> myRouteLoaders;
85
86
/// @brief information whether all routes shall be loaded and whether they were loaded
87
bool myLoadAll, myAllLoaded;
88
89
private:
90
/// @brief Invalidated copy constructor
91
SUMORouteLoaderControl(const SUMORouteLoaderControl& src);
92
93
/// @brief Invalidated assignment operator
94
SUMORouteLoaderControl& operator=(const SUMORouteLoaderControl& src);
95
};
96
97