Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netload/NLDiscreteEventBuilder.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 NLDiscreteEventBuilder.h
15
/// @author Daniel Krajzewicz
16
/// @author Michael Behrisch
17
/// @date Sep, 2003
18
///
19
// missing_desc
20
/****************************************************************************/
21
#pragma once
22
#include <config.h>
23
24
#include <string>
25
#include <map>
26
#include <utils/xml/GenericSAXHandler.h>
27
28
29
// ===========================================================================
30
// class declarations
31
// ===========================================================================
32
class MSNet;
33
34
35
// ===========================================================================
36
// class definitions
37
// ===========================================================================
38
/**
39
* @class NLDiscreteEventBuilder
40
* This class is responsible for building event-handling actions which
41
* the simulation shall execute.
42
*/
43
class NLDiscreteEventBuilder {
44
public:
45
/// Known action types
46
enum ActionType {
47
/// "SaveTLSStates"
48
EV_SAVETLSTATE,
49
/// "SaveTLSSwitchTimes"
50
EV_SAVETLSWITCHES,
51
/// "SaveTLSSwitchStates"
52
EV_SAVETLSWITCHSTATES,
53
/// "SaveTLSProgram"
54
EV_SAVETLSPROGRAM
55
};
56
57
/// Constructor
58
NLDiscreteEventBuilder(MSNet& net);
59
60
/// Destructor
61
~NLDiscreteEventBuilder();
62
63
/// Builds an action and saves it for further use
64
void addAction(const SUMOSAXAttributes& attrs, const std::string& basePath);
65
66
private:
67
/// Builds an action which saves the state of a certain tls into a file
68
void buildSaveTLStateCommand(const SUMOSAXAttributes& attrs, const std::string& basePath);
69
70
/// Builds an action which saves the switch times of links into a file
71
void buildSaveTLSwitchesCommand(const SUMOSAXAttributes& attrs, const std::string& basePath);
72
73
/// Builds an action which saves the switch times and states of tls into a file
74
void buildSaveTLSwitchStatesCommand(const SUMOSAXAttributes& attrs, const std::string& basePath);
75
76
/// Builds an action which saves the tls states as a loadable program into a file
77
void buildSaveTLSProgramCommand(const SUMOSAXAttributes& attrs, const std::string& basePath);
78
79
private:
80
NLDiscreteEventBuilder& operator=(const NLDiscreteEventBuilder&); // just to avoid a compiler warning
81
82
protected:
83
/// Definitions of a storage for build actions
84
typedef std::map<std::string, ActionType> KnownActions;
85
86
/// Build actions that shall be executed during the simulation
87
KnownActions myActions;
88
89
MSNet& myNet;
90
91
};
92
93