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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
18 // A class that generates enumerated and prefixed string-ids
19 /****************************************************************************/
20 #ifndef IDSupplier_h
21 #define IDSupplier_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include <string>
34 #include <vector>
35 
36 
37 // ===========================================================================
38 // class definitions
39 // ===========================================================================
45 class IDSupplier {
46 public:
48  IDSupplier(const std::string& prefix = "", long long int begin = 0);
49 
55  IDSupplier(const std::string& prefix, const std::vector<std::string>& knownIDs);
56 
58  ~IDSupplier();
59 
61  std::string getNext();
62 
64  void avoid(const std::string& id);
65 
66 private:
68  long long int myCurrent;
69 
71  std::string myPrefix;
72 
73 };
74 
75 
76 #endif
77 
78 /****************************************************************************/
79 
std::string myPrefix
The prefix to use.
Definition: IDSupplier.h:71
IDSupplier(const std::string &prefix="", long long int begin=0)
Constructor.
Definition: IDSupplier.cpp:41
void avoid(const std::string &id)
make sure that the given id is never supplied
Definition: IDSupplier.cpp:66
std::string getNext()
Returns the next id.
Definition: IDSupplier.cpp:58
~IDSupplier()
Destructor.
Definition: IDSupplier.cpp:54
long long int myCurrent
The current index.
Definition: IDSupplier.h:68