SUMO - Simulation of Urban MObility
IDSupplier Class Reference

#include <IDSupplier.h>

Collaboration diagram for IDSupplier:
Collaboration graph

Public Member Functions

void avoid (const std::string &id)
 make sure that the given id is never supplied More...
 
std::string getNext ()
 Returns the next id. More...
 
 IDSupplier (const std::string &prefix="", long long int begin=0)
 Constructor. More...
 
 IDSupplier (const std::string &prefix, const std::vector< std::string > &knownIDs)
 Constructor. More...
 
 ~IDSupplier ()
 Destructor. More...
 

Private Attributes

long long int myCurrent
 The current index. More...
 
std::string myPrefix
 The prefix to use. More...
 

Detailed Description

This class builds string ids by adding an increasing numerical value to a previously given string

Definition at line 45 of file IDSupplier.h.

Constructor & Destructor Documentation

◆ IDSupplier() [1/2]

IDSupplier::IDSupplier ( const std::string &  prefix = "",
long long int  begin = 0 
)

Constructor.

Definition at line 41 of file IDSupplier.cpp.

◆ IDSupplier() [2/2]

IDSupplier::IDSupplier ( const std::string &  prefix,
const std::vector< std::string > &  knownIDs 
)

Constructor.

Parameters
[in]prefixThe string to use as ID prefix
[in]knownIDsList of IDs that should never be returned by this IDSupplier

Definition at line 46 of file IDSupplier.cpp.

References avoid().

◆ ~IDSupplier()

IDSupplier::~IDSupplier ( )

Destructor.

Definition at line 54 of file IDSupplier.cpp.

Member Function Documentation

◆ avoid()

void IDSupplier::avoid ( const std::string &  id)

make sure that the given id is never supplied

Definition at line 66 of file IDSupplier.cpp.

References MAX2(), myCurrent, and myPrefix.

Referenced by IDSupplier(), NBTrafficLightLogicCont::insert(), GNENet::reserveEdgeID(), and GNENet::reserveJunctionID().

◆ getNext()

Field Documentation

◆ myCurrent

long long int IDSupplier::myCurrent
private

The current index.

Definition at line 68 of file IDSupplier.h.

Referenced by avoid(), and getNext().

◆ myPrefix

std::string IDSupplier::myPrefix
private

The prefix to use.

Definition at line 71 of file IDSupplier.h.

Referenced by avoid(), and getNext().


The documentation for this class was generated from the following files: