Helios Engine 0.1.0
A modular ECS based data-oriented C++23 game engine
 
Loading...
Searching...
No Matches
helios::UuidGenerator Class Reference

A class for generating random UUIDs using a specified random number generator. More...

#include <uuid.hpp>

Public Member Functions

 UuidGenerator ()
 Default constructor initializes the generator with a random seed.
 
template<typename RandomEngine >
requires (!std::same_as<std::decay_t<RandomEngine>, UuidGenerator>)
 UuidGenerator (RandomEngine &&engine)
 Construct a UuidGenerator with a custom random engine.
 
 UuidGenerator (const UuidGenerator &)=delete
 
 UuidGenerator (UuidGenerator &&) noexcept=default
 
 ~UuidGenerator ()=default
 
UuidGeneratoroperator= (const UuidGenerator &)=delete
 
UuidGeneratoroperator= (UuidGenerator &&) noexcept=default
 
Uuid Generate ()
 

Detailed Description

A class for generating random UUIDs using a specified random number generator.

Definition at line 160 of file uuid.hpp.

Constructor & Destructor Documentation

◆ UuidGenerator() [1/4]

helios::UuidGenerator::UuidGenerator ( )
inline

Default constructor initializes the generator with a random seed.

Definition at line 165 of file uuid.hpp.

165: generator_(std::random_device{}()) {}

◆ UuidGenerator() [2/4]

template<typename RandomEngine >
requires (!std::same_as<std::decay_t<RandomEngine>, UuidGenerator>)
helios::UuidGenerator::UuidGenerator ( RandomEngine &&  engine)
inlineexplicit

Construct a UuidGenerator with a custom random engine.

Template Parameters
RandomEngineThe type of the random engine.
Parameters
engineAn instance of the random engine.

Definition at line 174 of file uuid.hpp.

174: generator_(std::forward<RandomEngine>(engine)) {}

◆ UuidGenerator() [3/4]

helios::UuidGenerator::UuidGenerator ( const UuidGenerator )
delete

◆ UuidGenerator() [4/4]

helios::UuidGenerator::UuidGenerator ( UuidGenerator &&  )
defaultnoexcept

◆ ~UuidGenerator()

helios::UuidGenerator::~UuidGenerator ( )
default

Member Function Documentation

◆ Generate()

Uuid helios::UuidGenerator::Generate ( )
inline

Definition at line 188 of file uuid.hpp.

188 {
189 uuids::basic_uuid_random_generator<std::mt19937_64> gen(&generator_);
190 return Uuid(gen());
191}

◆ operator=() [1/2]

UuidGenerator & helios::UuidGenerator::operator= ( const UuidGenerator )
delete

◆ operator=() [2/2]

UuidGenerator & helios::UuidGenerator::operator= ( UuidGenerator &&  )
defaultnoexcept