Eclipse 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-2019 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 /****************************************************************************/
15 // A class that generates enumerated and prefixed string-ids
16 /****************************************************************************/
17 #ifndef IDSupplier_h
18 #define IDSupplier_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 
25 #include <string>
26 #include <vector>
27 
28 
29 // ===========================================================================
30 // class definitions
31 // ===========================================================================
37 class IDSupplier {
38 public:
40  IDSupplier(const std::string& prefix = "", long long int begin = 0);
41 
47  IDSupplier(const std::string& prefix, const std::vector<std::string>& knownIDs);
48 
50  ~IDSupplier();
51 
53  std::string getNext();
54 
56  void avoid(const std::string& id);
57 
58 private:
60  long long int myCurrent;
61 
63  std::string myPrefix;
64 
65 };
66 
67 
68 #endif
69 
70 /****************************************************************************/
71 
IDSupplier
Definition: IDSupplier.h:37
IDSupplier::avoid
void avoid(const std::string &id)
make sure that the given id is never supplied
Definition: IDSupplier.cpp:59
IDSupplier::~IDSupplier
~IDSupplier()
Destructor.
Definition: IDSupplier.cpp:47
IDSupplier::IDSupplier
IDSupplier(const std::string &prefix="", long long int begin=0)
Constructor.
Definition: IDSupplier.cpp:34
IDSupplier::getNext
std::string getNext()
Returns the next id.
Definition: IDSupplier.cpp:51
IDSupplier::myPrefix
std::string myPrefix
The prefix to use.
Definition: IDSupplier.h:63
IDSupplier::myCurrent
long long int myCurrent
The current index.
Definition: IDSupplier.h:60