BsUUID.h 682 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #pragma once
  2. #include "BsCorePrerequisites.h"
  3. #include "BsModule.h"
  4. #include "BsSpinLock.h"
  5. #include <random>
  6. namespace BansheeEngine
  7. {
  8. /**
  9. * @brief Utility class for generating universally unique identifiers.
  10. *
  11. * @note Thread safe.
  12. */
  13. class BS_CORE_EXPORT UUIDGenerator : public Module<UUIDGenerator>
  14. {
  15. /**
  16. * @brief Type of UUID generation to use.
  17. */
  18. enum UUIDVersion
  19. {
  20. UUIDV_TimeBased = 0x01
  21. };
  22. public:
  23. UUIDGenerator();
  24. /**
  25. * @brief Generate a new random universally unique identifier.
  26. */
  27. String generateRandom();
  28. private:
  29. std::mt19937 mRandomGenerator;
  30. MACAddress mMACAddress;
  31. SpinLock mSpinLock;
  32. bool mHaveMacAddress;
  33. };
  34. }