BsUUID.h 626 B

123456789101112131415161718192021222324252627282930313233343536
  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. enum UUIDVersion
  16. {
  17. UUIDV_TimeBased = 0x01
  18. };
  19. public:
  20. UUIDGenerator();
  21. /**
  22. * @brief Generate a new random universally unique identifier.
  23. */
  24. String generateRandom();
  25. private:
  26. std::mt19937 mRandomGenerator;
  27. MACAddress mMACAddress;
  28. SpinLock mSpinLock;
  29. bool mHaveMacAddress;
  30. };
  31. }