Line data Source code
1 : /****************************************************************************/ 2 : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo 3 : // Copyright (C) 2004-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 ROAbstractEdgeBuilder.h 15 : /// @author Daniel Krajzewicz 16 : /// @author Yun-Pang Floetteroed 17 : /// @date Wed, 21 Jan 2004 18 : /// 19 : // Interface for building instances of router-edges 20 : /****************************************************************************/ 21 : #pragma once 22 : #include <config.h> 23 : 24 : #include <string> 25 : 26 : 27 : // =========================================================================== 28 : // class declarations 29 : // =========================================================================== 30 : class ROEdge; 31 : class RONode; 32 : 33 : 34 : // =========================================================================== 35 : // class definitions 36 : // =========================================================================== 37 : /** 38 : * @class ROAbstractEdgeBuilder 39 : * @brief Interface for building instances of router-edges 40 : * 41 : * As the different routing algorithms may need certain types of edges, 42 : * edges are build via a factory object derived from this class. 43 : * 44 : * The only method to be implemented is "buildEdge" which builds an edge 45 : * of the needed ROEdge-subtype. 46 : * 47 : * The built edges are numbered in the order they are built, the current 48 : * number (index) is stored in "myCurrentIndex" and the next to use may 49 : * be obtained via "getNextIndex". 50 : */ 51 : class ROAbstractEdgeBuilder { 52 : public: 53 : /// @brief Constructor 54 5068 : ROAbstractEdgeBuilder() : myCurrentIndex(0) { } 55 : 56 : 57 : /// @brief Destructor 58 : virtual ~ROAbstractEdgeBuilder() { } 59 : 60 : 61 : /// @name Methods to be implemented 62 : /// @{ 63 : 64 : /** @brief Builds an edge with the given name 65 : * 66 : * @param[in] name The name of the edge 67 : * @param[in] from The node the edge begins at 68 : * @param[in] to The node the edge ends at 69 : * @param[in] priority The edge priority (road class) 70 : * @return A proper instance of the named edge 71 : */ 72 : virtual ROEdge* buildEdge(const std::string& name, RONode* from, RONode* to, const int priority) = 0; 73 : /// @} 74 : 75 : 76 : protected: 77 : /** @brief Returns the index of the edge to built 78 : * @return Next valid edge index 79 : */ 80 : int getNextIndex() { 81 311257 : return myCurrentIndex++; 82 : } 83 : 84 : 85 : private: 86 : /// @brief The next edge's index 87 : int myCurrentIndex; 88 : 89 : 90 : private: 91 : /// @brief Invalidated copy constructor 92 : ROAbstractEdgeBuilder(const ROAbstractEdgeBuilder& src); 93 : 94 : /// @brief Invalidated assignment operator 95 : ROAbstractEdgeBuilder& operator=(const ROAbstractEdgeBuilder& src); 96 : 97 : };