From 9b4d0cc9a8493c608ab0075ab2c6a2b66061f3be Mon Sep 17 00:00:00 2001 From: Brett Date: Sun, 25 Feb 2024 14:39:56 -0500 Subject: [PATCH] push version 0.12.0. Breaking changes to the hashmap typename, Now blt::hashmap_t and blt::hashset_t This was done to be more consistent --- CMakeLists.txt | 2 +- include/blt/fs/nbt.h | 8 +++---- include/blt/parse/argparse.h | 6 ++--- include/blt/parse/obj_loader.h | 8 +++---- include/blt/std/hashmap.h | 40 +++++++++++++++++-------------- src/blt/profiling/profiler_v2.cpp | 4 ++-- 6 files changed, 36 insertions(+), 32 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ff555b..efe4d46 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.5) include(cmake/color.cmake) -set(BLT_VERSION 0.11.3) +set(BLT_VERSION 0.12.0) set(BLT_TEST_VERSION 0.0.1) set(BLT_TARGET BLT) diff --git a/include/blt/fs/nbt.h b/include/blt/fs/nbt.h index bc53ea8..eb9941c 100644 --- a/include/blt/fs/nbt.h +++ b/include/blt/fs/nbt.h @@ -250,8 +250,8 @@ namespace blt::nbt { BLT_WARN("Tag Type not found!"); return nullptr; } - static HASHMAP toHashmap(const std::vector& v){ - HASHMAP tags; + static hashmap_t toHashmap(const std::vector& v){ + hashmap_t tags; for (const auto& t : v) tags[t->getName()] = t; return tags; @@ -321,12 +321,12 @@ namespace blt::nbt { } }; - class tag_compound : public tag> { + class tag_compound : public tag> { public: tag_compound(): tag(nbt_tag::COMPOUND) {} tag_compound(const std::string& name, const std::vector& v): tag(nbt_tag::COMPOUND, name, _internal_::toHashmap(v)) {} tag_compound(const std::string& name, const std::initializer_list& v): tag(nbt_tag::COMPOUND, name, _internal_::toHashmap(v)) {} - tag_compound(const std::string& name, const HASHMAP& v): tag(nbt_tag::COMPOUND, name, v) {} + tag_compound(const std::string& name, const hashmap_t& v): tag(nbt_tag::COMPOUND, name, v) {} inline void put(tag_t* tag) { t[tag->getName()] = tag; diff --git a/include/blt/parse/argparse.h b/include/blt/parse/argparse.h index 476dacf..6636514 100644 --- a/include/blt/parse/argparse.h +++ b/include/blt/parse/argparse.h @@ -332,11 +332,11 @@ namespace blt friend arg_parse; private: // stores dest value not the flag/name! - HASHSET found_args; + hashset_t found_args; std::vector unrecognized_args; public: std::string program_name; - HASHMAP data; + hashmap_t data; inline arg_data_t& operator[](const std::string& key) { @@ -384,7 +384,7 @@ namespace blt std::string postfix; public: std::vector name_associations; - HASHMAP flag_associations; + hashmap_t flag_associations; } user_args; arg_results loaded_args; diff --git a/include/blt/parse/obj_loader.h b/include/blt/parse/obj_loader.h index ea1d195..417b232 100644 --- a/include/blt/parse/obj_loader.h +++ b/include/blt/parse/obj_loader.h @@ -116,9 +116,9 @@ namespace blt::parse private: std::vector vertex_data_; std::vector objects_; - HASHMAP materials_; + hashmap_t materials_; public: - obj_model_t(std::vector&& vertex_data, std::vector&& objects, HASHMAP&& mats): + obj_model_t(std::vector&& vertex_data, std::vector&& objects, hashmap_t&& mats): vertex_data_(vertex_data), objects_(objects), materials_(mats) {} @@ -148,11 +148,11 @@ namespace blt::parse std::vector normals; // maps between face (constructed vertex) -> vertex indices - HASHMAP vertex_map; + hashmap_t vertex_map; std::vector vertex_data; object_data current_object; std::vector data; - HASHMAP materials; + hashmap_t materials; size_t current_line = 0; private: diff --git a/include/blt/std/hashmap.h b/include/blt/std/hashmap.h index 6f35191..f5e59f3 100644 --- a/include/blt/std/hashmap.h +++ b/include/blt/std/hashmap.h @@ -9,7 +9,7 @@ namespace blt { - + // template, typename Eq = std::equal_to> // class hashmap // { @@ -18,7 +18,7 @@ namespace blt // public: // // }; - + } #ifndef HASHMAP @@ -27,32 +27,36 @@ namespace blt #include #include -template, - class Eq = phmap::priv::hash_default_eq, - class Alloc = phmap::priv::Allocator>> -using HASHMAP = phmap::flat_hash_map; -template, - class Eq = phmap::priv::hash_default_eq, - class Alloc = phmap::priv::Allocator> -using HASHSET = phmap::flat_hash_set; +namespace blt +{ + template, + class Eq = phmap::priv::hash_default_eq , + class Alloc = phmap::priv::Allocator >> + using hashmap_t = phmap::flat_hash_map; + template, + class Eq = phmap::priv::hash_default_eq , + class Alloc = phmap::priv::Allocator > + using hashset_t = phmap::flat_hash_set; +} #else - +namespace blt { #include #include -template, typename Eq = std::equal_to, typename Alloc = std::allocator>> -using HASHMAP = std::unordered_map; - -template; + + template, typename Eq = std::equal_to, typename Alloc = std::allocator> -using HASHSET = std::unordered_set; + using hashset_t = std::unordered_set; +} #endif #endif diff --git a/src/blt/profiling/profiler_v2.cpp b/src/blt/profiling/profiler_v2.cpp index cf191a0..f3063b0 100644 --- a/src/blt/profiling/profiler_v2.cpp +++ b/src/blt/profiling/profiler_v2.cpp @@ -210,8 +210,8 @@ namespace blt * profiler V1 partial backwards compat * ---------------------------- */ - - HASHMAP> profiles; + + hashmap_t> profiles; void _internal::startInterval(const std::string& profile_name, const std::string& interval_name) {