SUMO - Simulation of Urban MObility
IDSupplier.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
16 // A class that generates enumerated and prefixed string-ids
17 /****************************************************************************/
18 #ifndef IDSupplier_h
19 #define IDSupplier_h
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 #include <string>
28 #include <vector>
29 
30 
31 // ===========================================================================
32 // class definitions
33 // ===========================================================================
39 class IDSupplier {
40 public:
42  IDSupplier(const std::string& prefix = "", long long int begin = 0);
43 
49  IDSupplier(const std::string& prefix, const std::vector<std::string>& knownIDs);
50 
52  ~IDSupplier();
53 
55  std::string getNext();
56 
58  void avoid(const std::string& id);
59 
60 private:
62  long long int myCurrent;
63 
65  std::string myPrefix;
66 
67 };
68 
69 
70 #endif
71 
72 /****************************************************************************/
73 
std::string myPrefix
The prefix to use.
Definition: IDSupplier.h:65
IDSupplier(const std::string &prefix="", long long int begin=0)
Constructor.
Definition: IDSupplier.cpp:35
void avoid(const std::string &id)
make sure that the given id is never supplied
Definition: IDSupplier.cpp:60
std::string getNext()
Returns the next id.
Definition: IDSupplier.cpp:52
~IDSupplier()
Destructor.
Definition: IDSupplier.cpp:48
long long int myCurrent
The current index.
Definition: IDSupplier.h:62