Line data Source code
1 : /****************************************************************************/
2 : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 : // Copyright (C) 2001-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 MSRightOfWayJunction.h
15 : /// @author Christian Roessel
16 : /// @author Daniel Krajzewicz
17 : /// @author Michael Behrisch
18 : /// @date Wed, 12 Dez 2001
19 : ///
20 : // A junction with right-of-way - rules
21 : /****************************************************************************/
22 : #pragma once
23 : #include <config.h>
24 :
25 : #include "MSLogicJunction.h"
26 : #include <bitset>
27 : #include <vector>
28 : #include <string>
29 :
30 :
31 : // ===========================================================================
32 : // class declarations
33 : // ===========================================================================
34 : class MSLane;
35 : class MSJunctionLogic;
36 :
37 :
38 : // ===========================================================================
39 : // class definitions
40 : // ===========================================================================
41 : /**
42 : * @class MSRightOfWayJunction
43 : * @brief A junction with right-of-way - rules
44 : *
45 : * A class which realises junctions that do regard any kind of a right-of-way.
46 : * The rules for the right-of-way themselves are stored within the associated
47 : * "MSJunctionLogic" - structure.
48 : */
49 : class MSRightOfWayJunction : public MSLogicJunction {
50 : public:
51 : /** @brief Constructor
52 : * @param[in] id The id of the junction
53 : * @param[in] position The position of the junction
54 : * @param[in] shape The shape of the junction
55 : * @param[in] incoming The incoming lanes
56 : * @param[in] internal The internal lanes
57 : * @param[in] logic The logic of this junction
58 : */
59 : MSRightOfWayJunction(const std::string& id, SumoXMLNodeType type, const Position& position,
60 : const PositionVector& shape,
61 : const std::string& name,
62 : std::vector<MSLane*> incoming,
63 : std::vector<MSLane*> internal,
64 : MSJunctionLogic* logic);
65 :
66 : /// Destructor.
67 : virtual ~MSRightOfWayJunction();
68 :
69 : void postloadInit();
70 :
71 0 : const std::vector<MSLink*>& getFoeLinks(const MSLink* const srcLink) const {
72 0 : return myLinkFoeLinks.find(srcLink)->second;
73 : }
74 :
75 274097 : const std::vector<MSLane*>& getFoeInternalLanes(const MSLink* const srcLink) const {
76 274097 : return myLinkFoeInternalLanes.find(srcLink)->second;
77 : }
78 :
79 : // @brief return the underlying right-of-way and conflict matrix
80 1059804 : const MSJunctionLogic* getLogic() const {
81 1059804 : return myLogic;
82 : }
83 :
84 : protected:
85 : /** the type of the junction (its logic) */
86 : MSJunctionLogic* myLogic;
87 :
88 : // TODO: Documentation
89 : std::map<const MSLink*, std::vector<MSLink*> > myLinkFoeLinks;
90 : std::map<const MSLink*, std::vector<MSLane*> > myLinkFoeInternalLanes;
91 :
92 :
93 : private:
94 : /// @brief Invalidated copy constructor.
95 : MSRightOfWayJunction(const MSRightOfWayJunction&);
96 :
97 : /// Invalidated assignment operator.
98 : MSRightOfWayJunction& operator=(const MSRightOfWayJunction&);
99 :
100 : };
|