Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/dfrouter/RODFDetFlowLoader.h
169666 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-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 RODFDetFlowLoader.h
15
/// @author Daniel Krajzewicz
16
/// @author Eric Nicolay
17
/// @author Michael Behrisch
18
/// @date Thu, 16.03.2006
19
///
20
// A loader for detector flows
21
/****************************************************************************/
22
#pragma once
23
#include <config.h>
24
25
#include <string>
26
#include <vector>
27
#include <utils/importio/NamedColumnsParser.h>
28
#include <utils/common/UtilExceptions.h>
29
#include "RODFDetector.h"
30
#include "RODFDetectorFlow.h"
31
32
33
// ===========================================================================
34
// class definitions
35
// ===========================================================================
36
/**
37
* @class RODFDetFlowLoader
38
* @brief A loader for detector flows
39
*/
40
class RODFDetFlowLoader {
41
public:
42
/** @brief Constructor
43
*
44
* @param[in] dets Definitions of known detectors
45
* @param[in, filled] into Container to store read values into
46
* @param[in] startTime The first time step for which values shall be read
47
* @param[in] endTime The last time step for which values shall be read
48
* @param[in] timeOffset The offset which shall be applied to the read times
49
*/
50
RODFDetFlowLoader(const RODFDetectorCon& dets, RODFDetectorFlows& into,
51
SUMOTime startTime, SUMOTime endTime,
52
SUMOTime timeOffset, SUMOTime timeScale);
53
54
55
/// @brief Destructor
56
~RODFDetFlowLoader();
57
58
59
/** @brief Reads the given file assuming it contains detector values
60
*
61
* Reads the first line, first, and parses it assuming it contains
62
* the names of the columns that follow within the next lines.
63
*
64
* Then, the rest of the file is read and the read values for vehicle/heavy vehicle
65
* amounts and speeds are stored into "myStorage". Values that lie
66
* before "myStartTime" and behind "myEndTime" as well as values
67
* which refer to an unknown detector are omitted.
68
*
69
* @param[in] file The name of the file to read
70
* @exception IOError Not yet implemented!
71
* @exception ProcessError Thrown if a value could not be parsed properly or a needed value is missing
72
*/
73
void read(const std::string& file);
74
75
76
private:
77
/// @brief The container for read detector values
78
RODFDetectorFlows& myStorage;
79
80
/// @brief The time offset to apply to read time values
81
const SUMOTime myTimeOffset;
82
83
/// @brief The time scale to apply to read time values
84
const SUMOTime myTimeScale;
85
86
/// @brief The first and the last time step to read
87
const SUMOTime myStartTime, myEndTime;
88
89
/// @brief The value extractor
90
NamedColumnsParser myLineHandler;
91
92
/// @brief Container holding known detectors
93
const RODFDetectorCon& myDetectorContainer;
94
95
/// @brief Whether a warning about overriding boundaries was already written
96
bool myHaveWarnedAboutOverridingBoundaries;
97
98
/// @brief Whether a warning about partial definitions was already written
99
bool myHaveWarnedAboutPartialDefs;
100
101
102
private:
103
/// @brief Invalidated copy constructor
104
RODFDetFlowLoader(const RODFDetFlowLoader& src);
105
106
/// @brief Invalidated assignment operator
107
RODFDetFlowLoader& operator=(const RODFDetFlowLoader& src);
108
109
};
110
111