Changing casing of dualkey map to PascalCase

This commit is contained in:
2026-02-01 00:54:25 +02:00
parent 2f84b47fec
commit f2d429109b
3 changed files with 13 additions and 13 deletions

View File

@@ -43,7 +43,7 @@ public:
} }
} }
Entry insert(AKey firstKey, BKey secondKey, Value value) { Entry Insert(AKey firstKey, BKey secondKey, Value value) {
DualkeyHash *hash = new DualkeyHash(std::move(firstKey), DualkeyHash *hash = new DualkeyHash(std::move(firstKey),
std::move(secondKey), std::move(value)); std::move(secondKey), std::move(value));
@@ -57,7 +57,7 @@ public:
return {hash->firstKey, hash->secondKey, hash->value}; return {hash->firstKey, hash->secondKey, hash->value};
} }
std::size_t remove(std::optional<AKey> firstKey, std::size_t Remove(std::optional<AKey> firstKey,
std::optional<BKey> secondKey) { std::optional<BKey> secondKey) {
bool isFirstKeyGiven = firstKey.has_value(); bool isFirstKeyGiven = firstKey.has_value();
bool isSecondKeyGiven = secondKey.has_value(); bool isSecondKeyGiven = secondKey.has_value();
@@ -120,7 +120,7 @@ public:
} }
[[nodiscard("Discarding an expensive query!")]] [[nodiscard("Discarding an expensive query!")]]
std::vector<QueryResult> query(std::optional<AKey> firstKey, std::vector<QueryResult> Query(std::optional<AKey> firstKey,
std::optional<BKey> secondKey) { std::optional<BKey> secondKey) {
bool isFirstKeyGiven = firstKey.has_value(); bool isFirstKeyGiven = firstKey.has_value();
bool isSecondKeyGiven = secondKey.has_value(); bool isSecondKeyGiven = secondKey.has_value();
@@ -175,7 +175,7 @@ public:
return finishedQuery; return finishedQuery;
} }
void scan(std::function<bool(const std::size_t firstKeyHash, void Scan(std::function<bool(const std::size_t firstKeyHash,
const std::size_t secondKeyHash, Value &value)> const std::size_t secondKeyHash, Value &value)>
scanFunction) { scanFunction) {
for (DualkeyHash *hash : hashList) { for (DualkeyHash *hash : hashList) {
@@ -188,7 +188,7 @@ public:
} }
} }
void scan(std::function<bool(const AKey &firstKey, const BKey &secondKey, void Scan(std::function<bool(const AKey &firstKey, const BKey &secondKey,
Value &value)> Value &value)>
scanFunction) { scanFunction) {
for (DualkeyHash *hash : hashList) { for (DualkeyHash *hash : hashList) {
@@ -202,7 +202,7 @@ public:
} }
[[nodiscard]] [[nodiscard]]
std::size_t count() { std::size_t Count() {
return hashList.size() - graveyard.size(); return hashList.size() - graveyard.size();
} }

View File

@@ -39,7 +39,7 @@ public:
template <isAComponent component, typename... Args> template <isAComponent component, typename... Args>
component &AddComponent(const Entity &entity, component &AddComponent(const Entity &entity,
Args &&...constructionArguments) { Args &&...constructionArguments) {
auto newComponent = entityComponentMap.insert( auto newComponent = entityComponentMap.Insert(
entity, typeid(component), component(constructionArguments...)); entity, typeid(component), component(constructionArguments...));
return std::any_cast<component &>(std::get<2>(newComponent)); return std::any_cast<component &>(std::get<2>(newComponent));
@@ -48,7 +48,7 @@ public:
template <isAComponent component> template <isAComponent component>
[[nodiscard("Discarding an expensive operation's result!")]] [[nodiscard("Discarding an expensive operation's result!")]]
component &GetComponent(const Entity &entity) { component &GetComponent(const Entity &entity) {
auto result = entityComponentMap.query(entity, typeid(component)); auto result = entityComponentMap.Query(entity, typeid(component));
if (result.empty()) { if (result.empty()) {
Logging::Log(std::format("Entity {} does not have component {}!", Logging::Log(std::format("Entity {} does not have component {}!",
entity.asString(), typeid(component).name()), entity.asString(), typeid(component).name()),
@@ -60,14 +60,14 @@ public:
template <isAComponent component> template <isAComponent component>
[[nodiscard("Discarding an expensive operation's result!")]] [[nodiscard("Discarding an expensive operation's result!")]]
bool HasComponent(const Entity &entity) { bool HasComponent(const Entity &entity) {
return entityComponentMap.query(entity, typeid(component)).size(); return entityComponentMap.Query(entity, typeid(component)).size();
} }
template <isAComponent component> template <isAComponent component>
[[nodiscard("It is not guaranteed that a component can always be removed, " [[nodiscard("It is not guaranteed that a component can always be removed, "
"please make sure by checking the returned bool")]] "please make sure by checking the returned bool")]]
bool RemoveComponent(const Entity &entity) { bool RemoveComponent(const Entity &entity) {
return entityComponentMap.remove(entity, typeid(component)); return entityComponentMap.Remove(entity, typeid(component));
} }
// Copying is not allowed since the ECS world is meant to be // Copying is not allowed since the ECS world is meant to be

View File

@@ -34,7 +34,7 @@ Entity World::CreateEntity() {
auto newEntity = Random::GenerateUUID(); auto newEntity = Random::GenerateUUID();
// Default components // Default components
entityComponentMap.insert(newEntity, typeid(Components::Base), entityComponentMap.Insert(newEntity, typeid(Components::Base),
Components::Base()); Components::Base());
return newEntity; return newEntity;
@@ -42,7 +42,7 @@ Entity World::CreateEntity() {
bool World::EntityExists(const Entity &entity) noexcept { bool World::EntityExists(const Entity &entity) noexcept {
bool exists = false; bool exists = false;
entityComponentMap.scan( entityComponentMap.Scan(
[&exists, entity](const Tourmaline::Type::UUID &currentEntity, [&exists, entity](const Tourmaline::Type::UUID &currentEntity,
const std::type_index &, std::any &) -> bool { const std::type_index &, std::any &) -> bool {
if (currentEntity == entity) { if (currentEntity == entity) {
@@ -55,5 +55,5 @@ bool World::EntityExists(const Entity &entity) noexcept {
} }
bool World::DestroyEntity(Entity entity) { bool World::DestroyEntity(Entity entity) {
return entityComponentMap.remove(entity, std::nullopt); return entityComponentMap.Remove(entity, std::nullopt);
} }