OpenMS
UniqueIdGenerator Class Reference

A generator for unique ids. More...

#include <OpenMS/CONCEPT/UniqueIdGenerator.h>

Collaboration diagram for UniqueIdGenerator:
[legend]

Static Public Member Functions

static UInt64 getUniqueId ()
 Returns a new unique id. More...
 
static void setSeed (const UInt64)
 Initializes random generator using the given value. More...
 
static UInt64 getSeed ()
 Get the seed. More...
 

Protected Member Functions

 UniqueIdGenerator ()
 
 ~UniqueIdGenerator ()
 

Private Member Functions

void init_ ()
 
 UniqueIdGenerator (const UniqueIdGenerator &)
 

Static Private Member Functions

static UniqueIdGeneratorgetInstance_ ()
 

Static Private Attributes

static UInt64 seed_
 
static UniqueIdGeneratorinstance_
 
static boost::mt19937_64 * rng_
 
static boost::uniform_int< UInt64 > * dist_
 

Detailed Description

A generator for unique ids.

The unique ids are 64-bit random unsigned random integers. The class is implemented as a singleton. The random generator is implemented using boost::random.

Constructor & Destructor Documentation

◆ UniqueIdGenerator() [1/2]

UniqueIdGenerator ( )
protected

◆ ~UniqueIdGenerator()

~UniqueIdGenerator ( )
protected

◆ UniqueIdGenerator() [2/2]

UniqueIdGenerator ( const UniqueIdGenerator )
private

Member Function Documentation

◆ getInstance_()

static UniqueIdGenerator& getInstance_ ( )
staticprivate

◆ getSeed()

static UInt64 getSeed ( )
static

Get the seed.

◆ getUniqueId()

static UInt64 getUniqueId ( )
static

Returns a new unique id.

◆ init_()

void init_ ( )
private

◆ setSeed()

static void setSeed ( const  UInt64)
static

Initializes random generator using the given value.

Member Data Documentation

◆ dist_

boost::uniform_int<UInt64>* dist_
staticprivate

◆ instance_

UniqueIdGenerator* instance_
staticprivate

◆ rng_

boost::mt19937_64* rng_
staticprivate

◆ seed_

UInt64 seed_
staticprivate