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 /****************************************************************************/
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 
26 #include <string>
27 #include <vector>
28 
29 
30 // ===========================================================================
31 // class definitions
32 // ===========================================================================
38 class IDSupplier {
39 public:
41  IDSupplier(const std::string& prefix = "", long long int begin = 0);
42 
48  IDSupplier(const std::string& prefix, const std::vector<std::string>& knownIDs);
49 
51  ~IDSupplier();
52 
54  std::string getNext();
55 
57  void avoid(const std::string& id);
58 
59 private:
61  long long int myCurrent;
62 
64  std::string myPrefix;
65 
66 };
67 
68 
69 #endif
70 
71 /****************************************************************************/
72 
IDSupplier
Definition: IDSupplier.h:38
IDSupplier::avoid
void avoid(const std::string &id)
make sure that the given id is never supplied
Definition: IDSupplier.cpp:60
IDSupplier::~IDSupplier
~IDSupplier()
Destructor.
Definition: IDSupplier.cpp:48
IDSupplier::IDSupplier
IDSupplier(const std::string &prefix="", long long int begin=0)
Constructor.
Definition: IDSupplier.cpp:35
IDSupplier::getNext
std::string getNext()
Returns the next id.
Definition: IDSupplier.cpp:52
IDSupplier::myPrefix
std::string myPrefix
The prefix to use.
Definition: IDSupplier.h:64
IDSupplier::myCurrent
long long int myCurrent
The current index.
Definition: IDSupplier.h:61