SUMO - Simulation of Urban MObility
IDSupplier Class Reference

#include <IDSupplier.h>

Public Member Functions

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

Private Attributes

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

Detailed Description

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

Definition at line 46 of file IDSupplier.h.


Constructor & Destructor Documentation

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

Constructor.

Definition at line 46 of file IDSupplier.cpp.

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 51 of file IDSupplier.cpp.

References avoid().

Destructor.

Definition at line 59 of file IDSupplier.cpp.


Member Function Documentation

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

make sure that the given id is never supplied

Definition at line 71 of file IDSupplier.cpp.

References MAX2(), myCurrent, and myPrefix.

Referenced by IDSupplier(), and NBTrafficLightLogicCont::insert().

std::string IDSupplier::getNext ( )

Returns the next id.

Definition at line 63 of file IDSupplier.cpp.

References myCurrent, and myPrefix.

Referenced by RORDLoader_TripDefs::getVehicleID(), and NBTrafficLightLogicCont::insert().


Field Documentation

The current index.

Definition at line 69 of file IDSupplier.h.

Referenced by avoid(), and getNext().

std::string IDSupplier::myPrefix [private]

The prefix to use.

Definition at line 72 of file IDSupplier.h.

Referenced by avoid(), and getNext().


The documentation for this class was generated from the following files:
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines