diff --git a/CopiumEngine/CopiumEngine.vcxproj b/CopiumEngine/CopiumEngine.vcxproj
index 6cfa75b..00a63eb 100644
--- a/CopiumEngine/CopiumEngine.vcxproj
+++ b/CopiumEngine/CopiumEngine.vcxproj
@@ -233,7 +233,7 @@
-
+
@@ -313,7 +313,7 @@
-
+
diff --git a/CopiumEngine/CopiumEngine.vcxproj.filters b/CopiumEngine/CopiumEngine.vcxproj.filters
index 36e42e6..69674bb 100644
--- a/CopiumEngine/CopiumEngine.vcxproj.filters
+++ b/CopiumEngine/CopiumEngine.vcxproj.filters
@@ -129,7 +129,7 @@
Source Files
-
+
Source Files
@@ -329,7 +329,7 @@
Header Files
-
+
Header Files
diff --git a/CopiumEngine/src/copium/asset/Asset.cpp b/CopiumEngine/src/copium/asset/Asset.cpp
index 4f04c17..d8b0560 100644
--- a/CopiumEngine/src/copium/asset/Asset.cpp
+++ b/CopiumEngine/src/copium/asset/Asset.cpp
@@ -15,7 +15,7 @@ namespace Copium
return metaData.name;
}
- UUID Asset::GetUUID() const
+ Uuid Asset::GetUuid() const
{
return metaData.uuid;
}
diff --git a/CopiumEngine/src/copium/asset/Asset.h b/CopiumEngine/src/copium/asset/Asset.h
index a66e6be..fef046a 100644
--- a/CopiumEngine/src/copium/asset/Asset.h
+++ b/CopiumEngine/src/copium/asset/Asset.h
@@ -2,7 +2,7 @@
#include "copium/asset/AssetMeta.h"
#include "copium/util/MetaFile.h"
-#include "copium/util/UUID.h"
+#include "copium/util/Uuid.h"
#include
@@ -18,7 +18,7 @@ namespace Copium
AssetHandle GetHandle() const;
const std::string& GetName() const;
- UUID GetUUID() const;
+ Uuid GetUuid() const;
bool isRuntime() const;
operator AssetHandle() const;
diff --git a/CopiumEngine/src/copium/asset/AssetFile.cpp b/CopiumEngine/src/copium/asset/AssetFile.cpp
index a302af5..6b126b3 100644
--- a/CopiumEngine/src/copium/asset/AssetFile.cpp
+++ b/CopiumEngine/src/copium/asset/AssetFile.cpp
@@ -36,7 +36,7 @@ namespace Copium
return path;
}
- UUID AssetFile::GetUUID() const
+ Uuid AssetFile::GetUuid() const
{
return uuid;
}
@@ -44,7 +44,7 @@ namespace Copium
void AssetFile::Load(const MetaFile& metaFile, const std::string& className)
{
const MetaFileClass& metaClass = metaFile.GetMetaClass(className);
- uuid = UUID{metaClass.GetValue("uuid")};
+ uuid = Uuid{metaClass.GetValue("uuid")};
dateModified = FileSystem::DateModified(path);
}
diff --git a/CopiumEngine/src/copium/asset/AssetFile.h b/CopiumEngine/src/copium/asset/AssetFile.h
index 629d375..5506b54 100644
--- a/CopiumEngine/src/copium/asset/AssetFile.h
+++ b/CopiumEngine/src/copium/asset/AssetFile.h
@@ -2,7 +2,7 @@
#include "copium/asset/AssetMeta.h"
#include "copium/util/MetaFile.h"
-#include "copium/util/UUID.h"
+#include "copium/util/Uuid.h"
namespace Copium
{
@@ -12,7 +12,7 @@ namespace Copium
private:
static std::vector assetTypes;
std::string path;
- UUID uuid;
+ Uuid uuid;
int64_t dateModified;
public:
@@ -22,7 +22,7 @@ namespace Copium
void Load();
const std::string& GetPath() const;
- UUID GetUUID() const;
+ Uuid GetUuid() const;
private:
void Load(const MetaFile& metaFile, const std::string& className);
static void RegisterAssetType(const std::string& assetType);
diff --git a/CopiumEngine/src/copium/asset/AssetManager.cpp b/CopiumEngine/src/copium/asset/AssetManager.cpp
index a5fefd5..a25cb2c 100644
--- a/CopiumEngine/src/copium/asset/AssetManager.cpp
+++ b/CopiumEngine/src/copium/asset/AssetManager.cpp
@@ -83,7 +83,7 @@ namespace Copium
}
- Asset& AssetManager::LoadAsset(const UUID& uuid)
+ Asset& AssetManager::LoadAsset(const Uuid& uuid)
{
CP_DEBUG("Loading uuid Asset: %s", uuid.ToString().c_str());
for (auto&& assetFile : cachedAssetFiles)
@@ -91,7 +91,7 @@ namespace Copium
if (assetFile.NeedReload())
assetFile.Load();
- if (assetFile.GetUUID() != uuid)
+ if (assetFile.GetUuid() != uuid)
continue;
return LoadAssetFromPath(assetFile.GetPath());
@@ -145,7 +145,7 @@ namespace Copium
Asset* asset2 = assets.emplace(handle, std::move(asset)).first->second.get();
asset2->metaData.handle = handle;
asset2->metaData.name = name;
- asset2->metaData.uuid = UUID();
+ asset2->metaData.uuid = Uuid();
asset2->metaData.isRuntime = true;
nameToAssetCache.emplace(name, handle);
return *asset2;
diff --git a/CopiumEngine/src/copium/asset/AssetManager.h b/CopiumEngine/src/copium/asset/AssetManager.h
index feeb3e5..9396dc5 100644
--- a/CopiumEngine/src/copium/asset/AssetManager.h
+++ b/CopiumEngine/src/copium/asset/AssetManager.h
@@ -30,7 +30,7 @@ namespace Copium
static void UnregisterAssetDir(std::string assetDir);
static Asset& GetAsset(AssetHandle handle);
static Asset& LoadAsset(const std::string& assetPath);
- static Asset& LoadAsset(const UUID& uuid);
+ static Asset& LoadAsset(const Uuid& uuid);
static void UnloadAsset(AssetHandle handle);
static Asset& RegisterRuntimeAsset(const std::string& name, std::unique_ptr&& asset);
static void Cleanup();
@@ -51,7 +51,7 @@ namespace Copium
}
template
- static AssetT& LoadAsset(const UUID& uuid)
+ static AssetT& LoadAsset(const Uuid& uuid)
{
AssetT* asset = dynamic_cast(&LoadAsset(uuid));
CP_ASSERT(asset, "Invalid Asset cast");
@@ -86,7 +86,7 @@ namespace Copium
Asset& asset = *assets.emplace(handle, std::make_unique(metaFile)).first->second.get();
asset.metaData.handle = handle;
asset.metaData.name = metaFile.GetFilePath();
- asset.metaData.uuid = UUID{metaFile.GetMetaClass(metaFileClass).GetValue("uuid")};
+ asset.metaData.uuid = Uuid{metaFile.GetMetaClass(metaFileClass).GetValue("uuid")};
asset.metaData.isRuntime = false;
return asset;
}
diff --git a/CopiumEngine/src/copium/asset/AssetMeta.h b/CopiumEngine/src/copium/asset/AssetMeta.h
index 226a978..c6186b7 100644
--- a/CopiumEngine/src/copium/asset/AssetMeta.h
+++ b/CopiumEngine/src/copium/asset/AssetMeta.h
@@ -1,6 +1,6 @@
#pragma once
-#include "copium/util/UUID.h"
+#include "copium/util/Uuid.h"
#include
#include
@@ -14,7 +14,7 @@ namespace Copium
{
AssetHandle handle;
std::string name;
- UUID uuid;
+ Uuid uuid;
bool isRuntime = false;
int loadCount = 1;
};
diff --git a/CopiumEngine/src/copium/buffer/Framebuffer.cpp b/CopiumEngine/src/copium/buffer/Framebuffer.cpp
index 95bd86f..5d90320 100644
--- a/CopiumEngine/src/copium/buffer/Framebuffer.cpp
+++ b/CopiumEngine/src/copium/buffer/Framebuffer.cpp
@@ -10,7 +10,7 @@ namespace Copium
Framebuffer::Framebuffer(const MetaFile& metaFile)
{
const MetaFileClass& metaClass = metaFile.GetMetaClass("Framebuffer");
- ColorAttachment& attachment = AssetManager::LoadAsset(UUID{metaClass.GetValue("rendertexture-uuid")});
+ ColorAttachment& attachment = AssetManager::LoadAsset(Uuid{metaClass.GetValue("rendertexture-uuid")});
colorAttachment = attachment;
width = attachment.GetWidth();
height = attachment.GetHeight();
diff --git a/CopiumEngine/src/copium/core/Device.cpp b/CopiumEngine/src/copium/core/Device.cpp
index 9caf411..fefb69f 100644
--- a/CopiumEngine/src/copium/core/Device.cpp
+++ b/CopiumEngine/src/copium/core/Device.cpp
@@ -77,7 +77,7 @@ namespace Copium
std::sort(devicePriorities.begin(), devicePriorities.end(), [](const std::pair& lhs, const std::pair& rhs) { return lhs.second > rhs.second; });
auto&& it = devicePriorities.begin();
- CP_ASSERT(it->second != 0, "Failed to find suitable GPU");
+ CP_ASSERT(it->second != 0, "Failed to find suitable gpu");
VkPhysicalDeviceProperties deviceProperties;
vkGetPhysicalDeviceProperties(it->first, &deviceProperties);
diff --git a/CopiumEngine/src/copium/ecs/ComponentPool.h b/CopiumEngine/src/copium/ecs/ComponentPool.h
index 2f0efdc..e250141 100644
--- a/CopiumEngine/src/copium/ecs/ComponentPool.h
+++ b/CopiumEngine/src/copium/ecs/ComponentPool.h
@@ -16,12 +16,12 @@ namespace Copium
std::vector components;
public:
- ComponentPool(EntityID entity, const Component& component)
+ ComponentPool(EntityId entity, const Component& component)
{
Emplace(entity, component);
}
- Component& Emplace(EntityID entity, const Component& component)
+ Component& Emplace(EntityId entity, const Component& component)
{
components.push_back(component);
entities.Emplace(entity);
@@ -34,7 +34,7 @@ namespace Copium
entities.Pop();
}
- bool Erase(EntityID entity)
+ bool Erase(EntityId entity)
{
size_t index = entities.Find(entity);
if (!entities.Erase(entity))
@@ -48,12 +48,12 @@ namespace Copium
return operator[](index);
}
- size_t Find(EntityID entity)
+ size_t Find(EntityId entity)
{
return entities.Find(entity);
}
- Component* FindComponent(EntityID entity)
+ Component* FindComponent(EntityId entity)
{
size_t index = Find(entity);
if (index < Size())
diff --git a/CopiumEngine/src/copium/ecs/ComponentPoolBase.cpp b/CopiumEngine/src/copium/ecs/ComponentPoolBase.cpp
index 067e1bb..1eb6ee1 100644
--- a/CopiumEngine/src/copium/ecs/ComponentPoolBase.cpp
+++ b/CopiumEngine/src/copium/ecs/ComponentPoolBase.cpp
@@ -2,12 +2,12 @@
namespace Copium
{
- std::vector& ComponentPoolBase::GetEntities()
+ std::vector& ComponentPoolBase::GetEntities()
{
return entities.GetList();
}
- const std::vector& ComponentPoolBase::GetEntities() const
+ const std::vector& ComponentPoolBase::GetEntities() const
{
return entities.GetList();
}
diff --git a/CopiumEngine/src/copium/ecs/ComponentPoolBase.h b/CopiumEngine/src/copium/ecs/ComponentPoolBase.h
index 7ef4312..c73806d 100644
--- a/CopiumEngine/src/copium/ecs/ComponentPoolBase.h
+++ b/CopiumEngine/src/copium/ecs/ComponentPoolBase.h
@@ -16,8 +16,8 @@ namespace Copium
virtual size_t Size() = 0;
virtual void Pop() = 0;
- virtual bool Erase(EntityID entity) = 0;
- std::vector& GetEntities();
- const std::vector& GetEntities() const;
+ virtual bool Erase(EntityId entity) = 0;
+ std::vector& GetEntities();
+ const std::vector& GetEntities() const;
};
}
diff --git a/CopiumEngine/src/copium/ecs/Config.h b/CopiumEngine/src/copium/ecs/Config.h
index 21ccf20..fe8b1a4 100644
--- a/CopiumEngine/src/copium/ecs/Config.h
+++ b/CopiumEngine/src/copium/ecs/Config.h
@@ -5,7 +5,7 @@
namespace Copium
{
- using EntityID = uint32_t;
+ using EntityId = uint32_t;
const static uint32_t MAX_NUM_ENTITIES = std::numeric_limits::max();
const static uint32_t INVALID_ENTITY = 0;
}
diff --git a/CopiumEngine/src/copium/ecs/ECSManager.cpp b/CopiumEngine/src/copium/ecs/ECSManager.cpp
index 90d6ca9..e9adee7 100644
--- a/CopiumEngine/src/copium/ecs/ECSManager.cpp
+++ b/CopiumEngine/src/copium/ecs/ECSManager.cpp
@@ -27,7 +27,7 @@ namespace Copium
return entities.size();
}
- EntityID ECSManager::CreateEntity()
+ EntityId ECSManager::CreateEntity()
{
CP_ASSERT(currentEntityId != MAX_NUM_ENTITIES, "No more entities available");
entities.emplace(currentEntityId);
@@ -35,7 +35,7 @@ namespace Copium
return currentEntityId - 1;
}
- void ECSManager::DestroyEntity(EntityID entity)
+ void ECSManager::DestroyEntity(EntityId entity)
{
auto it = entities.find(entity);
CP_ASSERT(it != entities.end(), "Entity does not exist in ECSManager (entity=%u)", entity);
@@ -46,12 +46,12 @@ namespace Copium
}
}
- bool ECSManager::ValidEntity(EntityID entity)
+ bool ECSManager::ValidEntity(EntityId entity)
{
return entities.find(entity) != entities.end();
}
- void ECSManager::Each(std::function function)
+ void ECSManager::Each(std::function function)
{
for (auto e : entities)
function(e);
diff --git a/CopiumEngine/src/copium/ecs/ECSManager.h b/CopiumEngine/src/copium/ecs/ECSManager.h
index 5bf691f..5c28705 100644
--- a/CopiumEngine/src/copium/ecs/ECSManager.h
+++ b/CopiumEngine/src/copium/ecs/ECSManager.h
@@ -17,7 +17,7 @@ namespace Copium
class ECSManager final
{
private:
- std::unordered_set entities;
+ std::unordered_set entities;
std::map componentPool;
std::unique_ptr systemPool;
@@ -34,26 +34,26 @@ namespace Copium
void UpdateSystems();
- EntityID CreateEntity();
- void DestroyEntity(EntityID entity);
+ EntityId CreateEntity();
+ void DestroyEntity(EntityId entity);
size_t GetEntityCount() const;
- bool ValidEntity(EntityID entity);
- void Each(std::function function);
+ bool ValidEntity(EntityId entity);
+ void Each(std::function function);
template
- std::tuple AddComponents(EntityID entity, Components&&... components)
+ std::tuple AddComponents(EntityId entity, Components&&... components)
{
return std::forward_as_tuple(AddComponent(entity, Components(components))...);
}
template
- Component& AddComponent(EntityID entity, Args&&... args)
+ Component& AddComponent(EntityId entity, Args&&... args)
{
return AddComponent(entity, Component{args...});
}
template
- Component& AddComponent(EntityID entity, const Component& component)
+ Component& AddComponent(EntityId entity, const Component& component)
{
auto pool = GetComponentPool();
@@ -71,20 +71,20 @@ namespace Copium
}
template
- void RemoveComponent(EntityID entity)
+ void RemoveComponent(EntityId entity)
{
auto pool = GetComponentPoolAssure();
CP_ASSERT(pool->Erase(entity), "Entity did not contain component (entity=%u, Component=%s)", entity, typeid(Component).name());
}
template
- void RemoveComponents(EntityID entity)
+ void RemoveComponents(EntityId entity)
{
(RemoveComponent(entity), ...);
}
template
- Component& GetComponent(EntityID entity)
+ Component& GetComponent(EntityId entity)
{
auto pool = GetComponentPoolAssure();
Component* component = pool->FindComponent(entity);
@@ -93,7 +93,7 @@ namespace Copium
}
template
- bool HasComponent(EntityID entity)
+ bool HasComponent(EntityId entity)
{
auto pool = GetComponentPool();
if (pool)
@@ -102,13 +102,13 @@ namespace Copium
}
template
- bool HasComponents(EntityID entity)
+ bool HasComponents(EntityId entity)
{
return (HasComponent(entity) && ...);
}
template
- bool HasAnyComponent(EntityID entity)
+ bool HasAnyComponent(EntityId entity)
{
return (HasComponent(entity) || ...);
}
@@ -132,7 +132,7 @@ namespace Copium
}
template
- void Each(std::function function)
+ void Each(std::function function)
{
auto pool = GetComponentPool();
if (pool)
@@ -147,7 +147,7 @@ namespace Copium
}
template
- EntityID Find(Func function)
+ EntityId Find(Func function)
{
auto pool = GetComponentPool();
if (pool)
@@ -167,7 +167,7 @@ namespace Copium
}
template
- EntityID Find(std::function function)
+ EntityId Find(std::function function)
{
auto pool = GetComponentPool();
if (pool)
diff --git a/CopiumEngine/src/copium/ecs/Entity.cpp b/CopiumEngine/src/copium/ecs/Entity.cpp
index 38f2b00..0fc569f 100644
--- a/CopiumEngine/src/copium/ecs/Entity.cpp
+++ b/CopiumEngine/src/copium/ecs/Entity.cpp
@@ -10,16 +10,16 @@ namespace Copium
: manager{manager}, id{INVALID_ENTITY}
{}
- Entity::Entity(ECSManager* manager, EntityID id)
+ Entity::Entity(ECSManager* manager, EntityId id)
: manager{manager}, id{id}
{}
- Entity::operator EntityID() const
+ Entity::operator EntityId() const
{
return id;
}
- void Entity::operator=(EntityID entityId)
+ void Entity::operator=(EntityId entityId)
{
id = entityId;
}
@@ -54,12 +54,12 @@ namespace Copium
manager->DestroyEntity(id);
}
- void Entity::SetID(EntityID aId)
+ void Entity::SetId(EntityId entityId)
{
- id = aId;
+ id = entityId;
}
- EntityID Entity::GetID() const
+ EntityId Entity::GetId() const
{
return id;
}
diff --git a/CopiumEngine/src/copium/ecs/Entity.h b/CopiumEngine/src/copium/ecs/Entity.h
index c8921ad..8e4c68a 100644
--- a/CopiumEngine/src/copium/ecs/Entity.h
+++ b/CopiumEngine/src/copium/ecs/Entity.h
@@ -11,23 +11,23 @@ namespace Copium
private:
ECSManager* manager;
- EntityID id;
+ EntityId id;
public:
Entity();
Entity(ECSManager* manager);
- Entity(ECSManager* manager, EntityID id);
+ Entity(ECSManager* manager, EntityId id);
- operator EntityID() const;
- void operator=(EntityID entityId);
+ operator EntityId() const;
+ void operator=(EntityId entityId);
bool operator==(const Entity& entity);
bool operator!=(const Entity& entity);
operator bool() const;
void Invalidate();
void Destroy();
- void SetID(EntityID aId);
- EntityID GetID() const;
+ void SetId(EntityId entityId);
+ EntityId GetId() const;
ECSManager* GetManager() const;
static Entity Create(ECSManager* manager);
diff --git a/CopiumEngine/src/copium/ecs/EntitySet.cpp b/CopiumEngine/src/copium/ecs/EntitySet.cpp
index 86db3bd..06aee9c 100644
--- a/CopiumEngine/src/copium/ecs/EntitySet.cpp
+++ b/CopiumEngine/src/copium/ecs/EntitySet.cpp
@@ -2,7 +2,7 @@
namespace Copium
{
- bool EntitySet::Emplace(EntityID entity)
+ bool EntitySet::Emplace(EntityId entity)
{
auto res = entitiesMap.emplace(entity, entitiesList.size());
@@ -14,7 +14,7 @@ namespace Copium
return true;
}
- bool EntitySet::Erase(EntityID entity)
+ bool EntitySet::Erase(EntityId entity)
{
auto it = entitiesMap.find(entity);
if (it == entitiesMap.end())
@@ -42,7 +42,7 @@ namespace Copium
return true;
}
- size_t EntitySet::Find(EntityID entity)
+ size_t EntitySet::Find(EntityId entity)
{
auto it = entitiesMap.find(entity);
if (it == entitiesMap.end())
@@ -55,9 +55,9 @@ namespace Copium
return entitiesList.size();
}
- std::vector& EntitySet::GetList() { return entitiesList; }
- const std::vector& EntitySet::GetList() const { return entitiesList; }
+ std::vector& EntitySet::GetList() { return entitiesList; }
+ const std::vector& EntitySet::GetList() const { return entitiesList; }
- std::vector::iterator EntitySet::begin() { return entitiesList.begin(); }
- std::vector::iterator EntitySet::end() { return entitiesList.end(); }
+ std::vector::iterator EntitySet::begin() { return entitiesList.begin(); }
+ std::vector::iterator EntitySet::end() { return entitiesList.end(); }
}
diff --git a/CopiumEngine/src/copium/ecs/EntitySet.h b/CopiumEngine/src/copium/ecs/EntitySet.h
index 9031fd4..70ef8da 100644
--- a/CopiumEngine/src/copium/ecs/EntitySet.h
+++ b/CopiumEngine/src/copium/ecs/EntitySet.h
@@ -10,18 +10,18 @@ namespace Copium
class EntitySet
{
private:
- std::vector entitiesList;
- std::unordered_map entitiesMap; // Maps the entity id to a component index
+ std::vector entitiesList;
+ std::unordered_map entitiesMap; // Maps the entity id to a component index
public:
- bool Emplace(EntityID entity);
- bool Erase(EntityID entity);
+ bool Emplace(EntityId entity);
+ bool Erase(EntityId entity);
bool Pop();
- size_t Find(EntityID entity);
+ size_t Find(EntityId entity);
size_t Size() const;
- std::vector& GetList();
- const std::vector& GetList() const;
+ std::vector& GetList();
+ const std::vector& GetList() const;
- std::vector::iterator begin();
- std::vector::iterator end();
+ std::vector::iterator begin();
+ std::vector::iterator end();
};
}
diff --git a/CopiumEngine/src/copium/ecs/System.h b/CopiumEngine/src/copium/ecs/System.h
index 0c38f43..acee026 100644
--- a/CopiumEngine/src/copium/ecs/System.h
+++ b/CopiumEngine/src/copium/ecs/System.h
@@ -12,7 +12,7 @@ namespace Copium
public:
void Run() override
{
- manager->Each([&](EntityID entityId, Components&... components) { RunEntity(Entity{manager, entityId}, components...); });
+ manager->Each([&](EntityId entityId, Components&... components) { RunEntity(Entity{manager, entityId}, components...); });
}
virtual void RunEntity(Entity entity, Components&... components) = 0;
diff --git a/CopiumEngine/src/copium/pipeline/Pipeline.cpp b/CopiumEngine/src/copium/pipeline/Pipeline.cpp
index 33349cd..40c1e97 100644
--- a/CopiumEngine/src/copium/pipeline/Pipeline.cpp
+++ b/CopiumEngine/src/copium/pipeline/Pipeline.cpp
@@ -18,7 +18,7 @@ namespace Copium
VkRenderPass renderPass;
if (metaFileClass.HasValue("framebuffer-uuid"))
{
- Framebuffer& fb = AssetManager::LoadAsset(UUID{metaFileClass.GetValue("framebuffer-uuid")});
+ Framebuffer& fb = AssetManager::LoadAsset(Uuid{metaFileClass.GetValue("framebuffer-uuid")});
renderPass = fb.GetRenderPass();
framebuffer = fb;
}
diff --git a/CopiumEngine/src/copium/util/UUID.cpp b/CopiumEngine/src/copium/util/Uuid.cpp
similarity index 70%
rename from CopiumEngine/src/copium/util/UUID.cpp
rename to CopiumEngine/src/copium/util/Uuid.cpp
index 84d4ced..8b16930 100644
--- a/CopiumEngine/src/copium/util/UUID.cpp
+++ b/CopiumEngine/src/copium/util/Uuid.cpp
@@ -1,26 +1,26 @@
-#include "copium/util/UUID.h"
+#include "copium/util/Uuid.h"
#include "copium/util/Common.h"
namespace Copium
{
- std::random_device UUID::randomDevice{};
- std::mt19937 UUID::randomGenerator{randomDevice()};
- std::uniform_int_distribution UUID::randomDistribution{std::numeric_limits::min(), std::numeric_limits::max()};
+ std::random_device Uuid::randomDevice{};
+ std::mt19937 Uuid::randomGenerator{randomDevice()};
+ std::uniform_int_distribution Uuid::randomDistribution{std::numeric_limits::min(), std::numeric_limits::max()};
- UUID::UUID()
+ Uuid::Uuid()
: msb{randomDistribution(randomGenerator)}, lsb{randomDistribution(randomGenerator)}
{}
- UUID::UUID(uint64_t msb, uint64_t lsb)
+ Uuid::Uuid(uint64_t msb, uint64_t lsb)
: msb{msb}, lsb{lsb}
{}
- UUID::UUID(const std::string& uuidString)
+ Uuid::Uuid(const std::string& uuidString)
: msb{0}, lsb{0}
{
- CP_ASSERT(uuidString.size() == 36, "Invalid UUID string size: %s", uuidString.c_str());
+ CP_ASSERT(uuidString.size() == 36, "Invalid Uuid string size: %s", uuidString.c_str());
for (int i = 0; i < 18; i++)
{
if (i == 8 || i == 13) // skip "-"
@@ -37,7 +37,7 @@ namespace Copium
}
}
- std::string UUID::ToString() const
+ std::string Uuid::ToString() const
{
std::string string;
string.reserve(36);
@@ -55,36 +55,36 @@ namespace Copium
return string;
}
- bool UUID::operator==(const UUID& rhs)
+ bool Uuid::operator==(const Uuid& rhs)
{
return msb == rhs.msb && lsb == rhs.lsb;
}
- bool UUID::operator!=(const UUID& rhs)
+ bool Uuid::operator!=(const Uuid& rhs)
{
return !(*this == rhs);
}
- bool UUID::operator<(const UUID& rhs)
+ bool Uuid::operator<(const Uuid& rhs)
{
if (msb != rhs.msb)
return msb < rhs.msb;
return lsb < rhs.lsb;
}
- std::ostream& operator<<(std::ostream& os, const UUID& uuid)
+ std::ostream& operator<<(std::ostream& os, const Uuid& uuid)
{
return os << uuid.ToString();
}
- uint8_t UUID::HexToDec(char c) const
+ uint8_t Uuid::HexToDec(char c) const
{
if (c >= '0' && c <= '9') return c - '0';
if (c >= 'a' && c <= 'f') return c - 'a' + 10;
CP_ABORT("Invalid char value: %c (%d)", c, (int)c);
}
- char UUID::DecToHex(uint8_t nibble) const
+ char Uuid::DecToHex(uint8_t nibble) const
{
if (nibble >= 0 && nibble <= 9) return '0' + nibble;
if (nibble >= 10 && nibble <= 15) return 'a' + nibble - 10;
diff --git a/CopiumEngine/src/copium/util/UUID.h b/CopiumEngine/src/copium/util/Uuid.h
similarity index 64%
rename from CopiumEngine/src/copium/util/UUID.h
rename to CopiumEngine/src/copium/util/Uuid.h
index 56850d9..2740511 100644
--- a/CopiumEngine/src/copium/util/UUID.h
+++ b/CopiumEngine/src/copium/util/Uuid.h
@@ -6,7 +6,7 @@
namespace Copium
{
- class UUID
+ class Uuid
{
private:
uint64_t msb;
@@ -15,18 +15,18 @@ namespace Copium
static std::mt19937 randomGenerator;
static std::uniform_int_distribution randomDistribution;
public:
- UUID();
- UUID(uint64_t msb, uint64_t lsb);
+ Uuid();
+ Uuid(uint64_t msb, uint64_t lsb);
// Format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
- UUID(const std::string& uuidString);
+ Uuid(const std::string& uuidString);
std::string ToString() const;
- bool operator==(const UUID& rhs);
- bool operator!=(const UUID& rhs);
- bool operator<(const UUID& rhs);
+ bool operator==(const Uuid& rhs);
+ bool operator!=(const Uuid& rhs);
+ bool operator<(const Uuid& rhs);
- friend std::ostream& operator<<(std::ostream& os, const UUID& uuid);
+ friend std::ostream& operator<<(std::ostream& os, const Uuid& uuid);
private:
uint8_t HexToDec(char c) const;