OpenMS
UniqueIdGenerator.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Timo Sachsenberg $
6 // $Authors: $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 #include <OpenMS/CONCEPT/Types.h>
13 
14 #include <boost/random/mersenne_twister.hpp>
15 #include <boost/random/variate_generator.hpp>
16 #include <boost/random/uniform_int.hpp>
17 
18 
19 namespace OpenMS
20 {
21 
22  class DateTime;
23 
33  class OPENMS_DLLAPI UniqueIdGenerator
34  {
35 
36 public:
37 
39  static UInt64 getUniqueId();
40 
42  static void setSeed(const UInt64);
43 
45  static UInt64 getSeed();
46 
47 protected:
50 
51 private:
52  static UInt64 seed_;
54  static boost::mt19937_64* rng_;
55  static boost::uniform_int<UInt64>* dist_;
56 
58  void init_();
59  UniqueIdGenerator(const UniqueIdGenerator& );//protect from c++ auto-generation
60  };
61 
62 } // namespace OpenMS
63 
A generator for unique ids.
Definition: UniqueIdGenerator.h:34
static UniqueIdGenerator & getInstance_()
static UInt64 getSeed()
Get the seed.
static boost::mt19937_64 * rng_
Definition: UniqueIdGenerator.h:54
static UInt64 getUniqueId()
Returns a new unique id.
static boost::uniform_int< UInt64 > * dist_
Definition: UniqueIdGenerator.h:55
static void setSeed(const UInt64)
Initializes random generator using the given value.
static UInt64 seed_
Definition: UniqueIdGenerator.h:52
static UniqueIdGenerator * instance_
Definition: UniqueIdGenerator.h:53
UniqueIdGenerator(const UniqueIdGenerator &)
uint64_t UInt64
Unsigned integer type (64bit)
Definition: Types.h:47
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19