SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
IDSupplier Class Reference

#include <IDSupplier.h>

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 begin=0)
 Constructor. More...
 
 IDSupplier (const std::string &prefix, const std::vector< std::string > &knownIDs)
 Constructor. More...
 
 ~IDSupplier ()
 Destructor. More...
 

Private Attributes

long 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 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().

IDSupplier::~IDSupplier ( )

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 NBTrafficLightLogicCont::insert(), and SUMORouteHandler::myStartElement().

Field Documentation

long IDSupplier::myCurrent
private

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: