BsUUID.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //__________________________ Banshee Project - A modern game development toolkit _________________________________//
  2. //_____________________________________ www.banshee-project.com __________________________________________________//
  3. //________________________ Copyright (c) 2014 Marko Pintera. All rights reserved. ________________________________//
  4. #pragma once
  5. #include "BsCorePrerequisites.h"
  6. #include "BsModule.h"
  7. #include "BsSpinLock.h"
  8. #include <random>
  9. namespace BansheeEngine
  10. {
  11. /**
  12. * @brief Utility class for generating universally unique identifiers.
  13. *
  14. * @note Thread safe.
  15. */
  16. class BS_CORE_EXPORT UUIDGenerator : public Module<UUIDGenerator>
  17. {
  18. /**
  19. * @brief Type of UUID generation to use.
  20. */
  21. enum UUIDVersion
  22. {
  23. UUIDV_TimeBased = 0x01
  24. };
  25. public:
  26. UUIDGenerator();
  27. /**
  28. * @brief Generate a new random universally unique identifier.
  29. */
  30. String generateRandom();
  31. private:
  32. std::mt19937 mRandomGenerator;
  33. MACAddress mMACAddress;
  34. SpinLock mSpinLock;
  35. bool mHaveMacAddress;
  36. };
  37. }