Line data Source code
1 : /****************************************************************************/
2 : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 : // Copyright (C) 2002-2024 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 : // ===========================================================================
36 : // class definitions
37 : // ===========================================================================
38 : /**
39 : * @class SUMORouteLoaderControl
40 : *
41 : * SUMORouteLoaderControl
42 : * This controls is initialised with the list of route loaders and uses them
43 : * to load routes step wise.
44 : * The parameter myInAdvanceStepNo holds the number of time steps to read the
45 : * routes in forward. If it is 0 (default), all routes will be read at once.
46 : */
47 : class SUMORouteLoaderControl {
48 : public:
49 : /// @brief constructor
50 : SUMORouteLoaderControl(SUMOTime inAdvanceStepNo);
51 :
52 : /// @brief destructor
53 : ~SUMORouteLoaderControl();
54 :
55 : /// @brief add another loader
56 : void add(SUMORouteLoader* loader);
57 :
58 : /// @brief loads the next routes up to and including the given time step
59 : void loadNext(SUMOTime step);
60 :
61 : /// @brief returns the timestamp of the first loaded vehicle or flow
62 : SUMOTime getFirstLoadTime() const {
63 12107 : return myFirstLoadTime;
64 : }
65 :
66 : /// @brief returns whether loading is completed
67 : bool haveAllLoaded() const {
68 5878 : return myAllLoaded;
69 : }
70 :
71 : private:
72 : /// @brief the first time step for which vehicles were loaded
73 : SUMOTime myFirstLoadTime;
74 :
75 : /// @brief the time step up to which vehicles were loaded
76 : SUMOTime myCurrentLoadTime;
77 :
78 : /// @brief the number of routes to read in forward
79 : const SUMOTime myInAdvanceStepNo;
80 :
81 : /// @brief the list of route loaders
82 : std::vector<SUMORouteLoader*> myRouteLoaders;
83 :
84 : /// @brief information whether all routes shall be loaded and whether they were loaded
85 : bool myLoadAll, myAllLoaded;
86 :
87 : private:
88 : /// @brief Invalidated copy constructor
89 : SUMORouteLoaderControl(const SUMORouteLoaderControl& src);
90 :
91 : /// @brief Invalidated assignment operator
92 : SUMORouteLoaderControl& operator=(const SUMORouteLoaderControl& src);
93 : };
|