Eclipse SUMO - Simulation of Urban MObility
ODDistrict.h
Go to the documentation of this file.
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 /****************************************************************************/
19 // A district (origin/destination)
20 /****************************************************************************/
21 #pragma once
22 #include <config.h>
23 
24 #include <vector>
25 #include <string>
26 #include <utility>
27 #include <utils/common/Named.h>
30 
31 
32 // ===========================================================================
33 // class definitions
34 // ===========================================================================
42 class ODDistrict : public Named {
43 public:
48  ODDistrict(const std::string& id);
49 
50 
52  ~ODDistrict();
53 
54 
68  void addSource(const std::string& id, double weight);
69 
70 
84  void addSink(const std::string& id, double weight);
85 
86 
95  std::string getRandomSource() const;
96 
97 
106  std::string getRandomSink() const;
107 
108 
113  int sinkNumber() const;
114 
115 
120  int sourceNumber() const;
121 
122 
123 private:
126 
129 
130 
131 private:
134 
137 
138 
139 };
Base class for objects which have an id.
Definition: Named.h:54
A district (origin/destination)
Definition: ODDistrict.h:42
ODDistrict(const ODDistrict &s)
invalidated copy constructor
int sourceNumber() const
Returns the number of sources.
Definition: ODDistrict.cpp:75
~ODDistrict()
Destructor.
Definition: ODDistrict.cpp:41
RandomDistributor< std::string > mySources
Container of weighted sources.
Definition: ODDistrict.h:125
void addSource(const std::string &id, double weight)
Adds a source connection.
Definition: ODDistrict.cpp:45
RandomDistributor< std::string > mySinks
Container of weighted sinks.
Definition: ODDistrict.h:128
void addSink(const std::string &id, double weight)
Adds a sink connection.
Definition: ODDistrict.cpp:51
ODDistrict(const std::string &id)
Constructor.
Definition: ODDistrict.cpp:37
int sinkNumber() const
Returns the number of sinks.
Definition: ODDistrict.cpp:69
std::string getRandomSink() const
Returns the id of a sink to use.
Definition: ODDistrict.cpp:63
ODDistrict & operator=(const ODDistrict &s)
invalidated assignment operator
std::string getRandomSource() const
Returns the id of a source to use.
Definition: ODDistrict.cpp:57