diff --git a/src/headless/main.cpp b/src/headless/main.cpp index cd4cbace..b9ff5268 100644 --- a/src/headless/main.cpp +++ b/src/headless/main.cpp @@ -260,7 +260,7 @@ static bool run_headless(fs::path const& root, memory::vector& m SPDLOG_INFO("===== Ranking system test... ====="); if (game_manager.get_instance_manager()) { const auto print_ranking_list = [ // - ](std::string_view title, OpenVic::utility::forwardable_span countries) -> void { + ](std::string_view title, OpenVic::forwardable_span countries) -> void { memory::string countries_str; for (CountryInstance* country : countries) { countries_str += fmt::format( @@ -278,7 +278,7 @@ static bool run_headless(fs::path const& root, memory::vector& m CountryInstanceManager const& country_instance_manager = game_manager.get_instance_manager()->get_country_instance_manager(); - OpenVic::utility::forwardable_span great_powers = country_instance_manager.get_great_powers(); + OpenVic::forwardable_span great_powers = country_instance_manager.get_great_powers(); print_ranking_list("Great Powers", great_powers); print_ranking_list("Secondary Powers", country_instance_manager.get_secondary_powers()); print_ranking_list("All countries", country_instance_manager.get_total_ranking()); diff --git a/src/openvic-simulation/utility/Deque.hpp b/src/openvic-simulation/core/portable/Deque.hpp similarity index 100% rename from src/openvic-simulation/utility/Deque.hpp rename to src/openvic-simulation/core/portable/Deque.hpp diff --git a/src/openvic-simulation/utility/ForwardableSpan.hpp b/src/openvic-simulation/core/portable/ForwardableSpan.hpp similarity index 93% rename from src/openvic-simulation/utility/ForwardableSpan.hpp rename to src/openvic-simulation/core/portable/ForwardableSpan.hpp index 1d32d8ef..fe117bc0 100644 --- a/src/openvic-simulation/utility/ForwardableSpan.hpp +++ b/src/openvic-simulation/core/portable/ForwardableSpan.hpp @@ -9,10 +9,10 @@ #include #include -#include "openvic-simulation/types/BasicIterator.hpp" #include "openvic-simulation/core/Typedefs.hpp" +#include "openvic-simulation/types/BasicIterator.hpp" -namespace OpenVic::utility::_detail::forwardable_span { +namespace OpenVic::_detail::forwardable_span { static constexpr std::size_t dynamic_extent = std::numeric_limits::max(); template @@ -347,7 +347,7 @@ namespace OpenVic::utility::_detail::forwardable_span { span(Range&&) -> span>>; } -namespace OpenVic::utility { +namespace OpenVic { static constexpr std::size_t dynamic_extent = _detail::forwardable_span::dynamic_extent; template @@ -357,37 +357,37 @@ namespace OpenVic::utility { namespace std { namespace ranges { template - inline constexpr bool enable_borrowed_range> = true; + inline constexpr bool enable_borrowed_range> = true; template - inline constexpr bool enable_view> = true; + inline constexpr bool enable_view> = true; } template - [[nodiscard]] inline OpenVic::utility::forwardable_span< + [[nodiscard]] inline OpenVic::forwardable_span< const std::byte, Extent == dynamic_extent ? dynamic_extent : Extent * sizeof(T)> - as_bytes(OpenVic::utility::forwardable_span sp) { + as_bytes(OpenVic::forwardable_span sp) { auto data = reinterpret_cast(sp.data()); auto size = sp.size_bytes(); constexpr std::size_t extent = Extent == dynamic_extent ? dynamic_extent : Extent * sizeof(T); - return OpenVic::utility::forwardable_span { data, size }; + return OpenVic::forwardable_span { data, size }; } template requires(!std::is_const_v) - inline OpenVic::utility::forwardable_span - as_writable_bytes [[nodiscard]] (OpenVic::utility::forwardable_span sp) { + inline OpenVic::forwardable_span + as_writable_bytes [[nodiscard]] (OpenVic::forwardable_span sp) { auto data = reinterpret_cast(sp.data()); auto size = sp.size_bytes(); constexpr std::size_t extent = Extent == dynamic_extent ? dynamic_extent : Extent * sizeof(T); - return OpenVic::utility::forwardable_span { data, size }; + return OpenVic::forwardable_span { data, size }; } } #else #include -namespace OpenVic::utility { +namespace OpenVic { template using forwardable_span = std::span; } diff --git a/src/openvic-simulation/country/CountryInstance.cpp b/src/openvic-simulation/country/CountryInstance.cpp index 1d82b97e..bc9efe00 100644 --- a/src/openvic-simulation/country/CountryInstance.cpp +++ b/src/openvic-simulation/country/CountryInstance.cpp @@ -1924,7 +1924,7 @@ void CountryInstance::after_sell(void* actor, SellResult const& sell_result, mem void CountryInstance::country_tick_before_map( IndexedFlatMap& reusable_goods_mask, - utility::forwardable_span< + forwardable_span< memory::vector, VECTORS_FOR_COUNTRY_TICK > reusable_vectors, @@ -2048,7 +2048,7 @@ void CountryInstance::calculate_government_good_needs() { void CountryInstance::manage_national_stockpile( IndexedFlatMap& reusable_goods_mask, - utility::forwardable_span< + forwardable_span< memory::vector, VECTORS_FOR_COUNTRY_TICK > reusable_vectors, diff --git a/src/openvic-simulation/country/CountryInstance.hpp b/src/openvic-simulation/country/CountryInstance.hpp index 5db2d2a2..76c95d05 100644 --- a/src/openvic-simulation/country/CountryInstance.hpp +++ b/src/openvic-simulation/country/CountryInstance.hpp @@ -623,7 +623,7 @@ namespace OpenVic { void manage_national_stockpile( IndexedFlatMap& reusable_goods_mask, - utility::forwardable_span< + forwardable_span< memory::vector, VECTORS_FOR_COUNTRY_TICK > reusable_vectors, @@ -661,7 +661,7 @@ namespace OpenVic { void update_gamestate(const Date today, MapInstance& map_instance); void country_tick_before_map( IndexedFlatMap& reusable_goods_mask, - utility::forwardable_span< + forwardable_span< memory::vector, VECTORS_FOR_COUNTRY_TICK > reusable_vectors, diff --git a/src/openvic-simulation/country/CountryInstanceDeps.hpp b/src/openvic-simulation/country/CountryInstanceDeps.hpp index 1166873f..2d95041b 100644 --- a/src/openvic-simulation/country/CountryInstanceDeps.hpp +++ b/src/openvic-simulation/country/CountryInstanceDeps.hpp @@ -2,7 +2,7 @@ #include "openvic-simulation/types/Date.hpp" #include "openvic-simulation/types/UnitBranchType.hpp" -#include "openvic-simulation/utility/ForwardableSpan.hpp" +#include "openvic-simulation/core/portable/ForwardableSpan.hpp" namespace OpenVic { struct BuildingType; @@ -27,28 +27,28 @@ namespace OpenVic { struct UnitTypeManager; struct CountryInstanceDeps { - utility::forwardable_span building_types; + forwardable_span building_types; CountryDefines const& country_defines; CountryRelationManager& country_relations_manager; - utility::forwardable_span crimes; + forwardable_span crimes; Date fallback_date_for_never_completing_research; DiplomacyDefines const& diplomacy_defines; EconomyDefines const& economy_defines; - utility::forwardable_span inventions; - utility::forwardable_span ideologies; + forwardable_span inventions; + forwardable_span ideologies; GameRulesManager const& game_rules_manager; - utility::forwardable_span good_instances; + forwardable_span good_instances; GoodInstanceManager& good_instance_manager; - utility::forwardable_span government_types; + forwardable_span government_types; MarketInstance& market_instance; MilitaryDefines const& military_defines; ModifierEffectCache const& modifier_effect_cache; - utility::forwardable_span pop_types; - utility::forwardable_span reforms; - utility::forwardable_span regiment_types; - utility::forwardable_span ship_types; - utility::forwardable_span stratas; - utility::forwardable_span technologies; + forwardable_span pop_types; + forwardable_span reforms; + forwardable_span regiment_types; + forwardable_span ship_types; + forwardable_span stratas; + forwardable_span technologies; UnitTypeManager const& unit_type_manager; }; } \ No newline at end of file diff --git a/src/openvic-simulation/country/CountryInstanceManager.cpp b/src/openvic-simulation/country/CountryInstanceManager.cpp index 64ceccba..978bd4c8 100644 --- a/src/openvic-simulation/country/CountryInstanceManager.cpp +++ b/src/openvic-simulation/country/CountryInstanceManager.cpp @@ -18,7 +18,7 @@ CountryInstanceManager::CountryInstanceManager( CountryInstanceDeps const& country_instance_deps, GoodInstanceManager const& new_good_instance_manager, PopsDefines const& new_pop_defines, - utility::forwardable_span pop_type_keys, + forwardable_span pop_type_keys, ThreadPool& new_thread_pool ) : thread_pool { new_thread_pool }, country_definition_manager { new_country_definition_manager }, diff --git a/src/openvic-simulation/country/CountryInstanceManager.hpp b/src/openvic-simulation/country/CountryInstanceManager.hpp index c635f480..665c260b 100644 --- a/src/openvic-simulation/country/CountryInstanceManager.hpp +++ b/src/openvic-simulation/country/CountryInstanceManager.hpp @@ -49,7 +49,7 @@ namespace OpenVic { CountryInstanceDeps const& country_instance_deps, GoodInstanceManager const& new_good_instance_manager, PopsDefines const& new_pop_defines, - utility::forwardable_span pop_type_keys, + forwardable_span pop_type_keys, ThreadPool& new_thread_pool ); diff --git a/src/openvic-simulation/economy/GoodInstance.hpp b/src/openvic-simulation/economy/GoodInstance.hpp index bcac92bd..b5119432 100644 --- a/src/openvic-simulation/economy/GoodInstance.hpp +++ b/src/openvic-simulation/economy/GoodInstance.hpp @@ -41,11 +41,11 @@ namespace OpenVic { GameRulesManager const& game_rules_manager ); - constexpr OpenVic::utility::forwardable_span get_good_instances() { + constexpr forwardable_span get_good_instances() { return good_instance_by_definition.get_values(); } - constexpr OpenVic::utility::forwardable_span get_good_instances() const { + constexpr forwardable_span get_good_instances() const { return good_instance_by_definition.get_values(); } GoodInstance* get_good_instance_by_identifier(std::string_view identifier); diff --git a/src/openvic-simulation/economy/production/ArtisanalProducerDeps.hpp b/src/openvic-simulation/economy/production/ArtisanalProducerDeps.hpp index 69a9ce5d..e949c751 100644 --- a/src/openvic-simulation/economy/production/ArtisanalProducerDeps.hpp +++ b/src/openvic-simulation/economy/production/ArtisanalProducerDeps.hpp @@ -1,6 +1,6 @@ #pragma once -#include "openvic-simulation/utility/ForwardableSpan.hpp" +#include "openvic-simulation/core/portable/ForwardableSpan.hpp" namespace OpenVic { struct EconomyDefines; @@ -9,7 +9,7 @@ namespace OpenVic { struct ArtisanalProducerDeps { EconomyDefines const& economy_defines; - utility::forwardable_span good_keys; + forwardable_span good_keys; ModifierEffectCache const& modifier_effect_cache; }; } \ No newline at end of file diff --git a/src/openvic-simulation/economy/production/ResourceGatheringOperationDeps.hpp b/src/openvic-simulation/economy/production/ResourceGatheringOperationDeps.hpp index 9a422e74..eb03bb45 100644 --- a/src/openvic-simulation/economy/production/ResourceGatheringOperationDeps.hpp +++ b/src/openvic-simulation/economy/production/ResourceGatheringOperationDeps.hpp @@ -1,6 +1,6 @@ #pragma once -#include "openvic-simulation/utility/ForwardableSpan.hpp" +#include "openvic-simulation/core/portable/ForwardableSpan.hpp" namespace OpenVic { struct MarketInstance; @@ -10,6 +10,6 @@ namespace OpenVic { struct ResourceGatheringOperationDeps { MarketInstance& market_instance; ModifierEffectCache const& modifier_effect_cache; - utility::forwardable_span pop_type_keys; + forwardable_span pop_type_keys; }; } \ No newline at end of file diff --git a/src/openvic-simulation/map/MapInstance.hpp b/src/openvic-simulation/map/MapInstance.hpp index 472a0229..af29a0c2 100644 --- a/src/openvic-simulation/map/MapInstance.hpp +++ b/src/openvic-simulation/map/MapInstance.hpp @@ -50,11 +50,11 @@ namespace OpenVic { return map_definition; } - constexpr OpenVic::utility::forwardable_span get_province_instances() { + constexpr forwardable_span get_province_instances() { return province_instance_by_definition.get_values(); } - constexpr OpenVic::utility::forwardable_span get_province_instances() const { + constexpr forwardable_span get_province_instances() const { return province_instance_by_definition.get_values(); } ProvinceInstance* get_province_instance_by_identifier(std::string_view identifier); diff --git a/src/openvic-simulation/map/ProvinceInstance.cpp b/src/openvic-simulation/map/ProvinceInstance.cpp index 17c1b4eb..e45e3fb8 100644 --- a/src/openvic-simulation/map/ProvinceInstance.cpp +++ b/src/openvic-simulation/map/ProvinceInstance.cpp @@ -391,7 +391,7 @@ void ProvinceInstance::province_tick( PopValuesFromProvince& reusable_pop_values, RandomU32& random_number_generator, IndexedFlatMap& reusable_goods_mask, - utility::forwardable_span< + forwardable_span< memory::vector, VECTORS_FOR_PROVINCE_TICK > reusable_vectors @@ -521,7 +521,7 @@ void ProvinceInstance::initialise_for_new_game( PopValuesFromProvince& reusable_pop_values, RandomU32& random_number_generator, IndexedFlatMap& reusable_goods_mask, - utility::forwardable_span< + forwardable_span< memory::vector, VECTORS_FOR_PROVINCE_TICK > reusable_vectors diff --git a/src/openvic-simulation/map/ProvinceInstance.hpp b/src/openvic-simulation/map/ProvinceInstance.hpp index bf11de90..45f93dd9 100644 --- a/src/openvic-simulation/map/ProvinceInstance.hpp +++ b/src/openvic-simulation/map/ProvinceInstance.hpp @@ -17,7 +17,7 @@ #include "openvic-simulation/types/TypedIndices.hpp" #include "openvic-simulation/types/UnitBranchType.hpp" #include "openvic-simulation/utility/Containers.hpp" -#include "openvic-simulation/utility/ForwardableSpan.hpp" +#include "openvic-simulation/core/portable/ForwardableSpan.hpp" namespace OpenVic { struct BaseIssue; @@ -192,7 +192,7 @@ namespace OpenVic { PopValuesFromProvince& reusable_pop_values, RandomU32& random_number_generator, IndexedFlatMap& reusable_goods_mask, - utility::forwardable_span< + forwardable_span< memory::vector, VECTORS_FOR_PROVINCE_TICK > reusable_vectors @@ -202,7 +202,7 @@ namespace OpenVic { PopValuesFromProvince& reusable_pop_values, RandomU32& random_number_generator, IndexedFlatMap& reusable_goods_mask, - utility::forwardable_span< + forwardable_span< memory::vector, VECTORS_FOR_PROVINCE_TICK > reusable_vectors diff --git a/src/openvic-simulation/map/ProvinceInstanceDeps.hpp b/src/openvic-simulation/map/ProvinceInstanceDeps.hpp index 795e9a22..6c8ff633 100644 --- a/src/openvic-simulation/map/ProvinceInstanceDeps.hpp +++ b/src/openvic-simulation/map/ProvinceInstanceDeps.hpp @@ -1,6 +1,6 @@ #pragma once -#include "openvic-simulation/utility/ForwardableSpan.hpp" +#include "openvic-simulation/core/portable/ForwardableSpan.hpp" namespace OpenVic { struct BuildingTypeManager; @@ -13,9 +13,9 @@ namespace OpenVic { struct ProvinceInstanceDeps { BuildingTypeManager const& building_type_manager; GameRulesManager const& game_rules_manager; - utility::forwardable_span ideologies; - utility::forwardable_span pop_types; + forwardable_span ideologies; + forwardable_span pop_types; ResourceGatheringOperationDeps const& rgo_deps; - utility::forwardable_span stratas; + forwardable_span stratas; }; } \ No newline at end of file diff --git a/src/openvic-simulation/map/State.cpp b/src/openvic-simulation/map/State.cpp index 403609e7..206ed024 100644 --- a/src/openvic-simulation/map/State.cpp +++ b/src/openvic-simulation/map/State.cpp @@ -19,9 +19,9 @@ State::State( ProvinceInstance* new_capital, memory::vector&& new_provinces, colony_status_t new_colony_status, - utility::forwardable_span strata_keys, - utility::forwardable_span pop_type_keys, - utility::forwardable_span ideology_keys + forwardable_span strata_keys, + forwardable_span pop_type_keys, + forwardable_span ideology_keys ) : PopsAggregate { strata_keys, pop_type_keys, ideology_keys }, state_set { new_state_set }, capital { new_capital }, @@ -134,9 +134,9 @@ void StateSet::update_gamestate() { bool StateManager::add_state_set( MapInstance& map_instance, Region const& region, - utility::forwardable_span strata_keys, - utility::forwardable_span pop_type_keys, - utility::forwardable_span ideology_keys + forwardable_span strata_keys, + forwardable_span pop_type_keys, + forwardable_span ideology_keys ) { OV_ERR_FAIL_COND_V_MSG(region.is_meta, false, memory::fmt::format("Cannot use meta region \"{}\" as state template!", region)); OV_ERR_FAIL_COND_V_MSG(region.empty(), false, memory::fmt::format("Cannot use empty region \"{}\" as state template!", region)); @@ -192,9 +192,9 @@ bool StateManager::add_state_set( bool StateManager::generate_states( MapDefinition const& map_definition, MapInstance& map_instance, - utility::forwardable_span strata_keys, - utility::forwardable_span pop_type_keys, - utility::forwardable_span ideology_keys + forwardable_span strata_keys, + forwardable_span pop_type_keys, + forwardable_span ideology_keys ) { state_sets.clear(); state_sets.reserve(map_definition.get_region_count()); diff --git a/src/openvic-simulation/map/State.hpp b/src/openvic-simulation/map/State.hpp index 0bb39822..5eb3178c 100644 --- a/src/openvic-simulation/map/State.hpp +++ b/src/openvic-simulation/map/State.hpp @@ -8,7 +8,7 @@ #include "openvic-simulation/types/ColonyStatus.hpp" #include "openvic-simulation/types/fixed_point/FixedPoint.hpp" #include "openvic-simulation/utility/Containers.hpp" -#include "openvic-simulation/utility/ForwardableSpan.hpp" +#include "openvic-simulation/core/portable/ForwardableSpan.hpp" #include "openvic-simulation/utility/Getters.hpp" namespace OpenVic { @@ -50,9 +50,9 @@ namespace OpenVic { ProvinceInstance* new_capital, memory::vector&& new_provinces, colony_status_t new_colony_status, - utility::forwardable_span strata_keys, - utility::forwardable_span pop_type_keys, - utility::forwardable_span ideology_keys + forwardable_span strata_keys, + forwardable_span pop_type_keys, + forwardable_span ideology_keys ); State(State&&) = delete; State(State const&) = delete; @@ -98,9 +98,9 @@ namespace OpenVic { bool add_state_set( MapInstance& map_instance, Region const& region, - utility::forwardable_span strata_keys, - utility::forwardable_span pop_type_keys, - utility::forwardable_span ideology_keys + forwardable_span strata_keys, + forwardable_span pop_type_keys, + forwardable_span ideology_keys ); public: @@ -110,9 +110,9 @@ namespace OpenVic { bool generate_states( MapDefinition const& map_definition, MapInstance& map_instance, - utility::forwardable_span strata_keys, - utility::forwardable_span pop_type_keys, - utility::forwardable_span ideology_keys + forwardable_span strata_keys, + forwardable_span pop_type_keys, + forwardable_span ideology_keys ); void reset(); diff --git a/src/openvic-simulation/politics/PoliticsInstanceManager.cpp b/src/openvic-simulation/politics/PoliticsInstanceManager.cpp index 496b0bd1..14bb3f43 100644 --- a/src/openvic-simulation/politics/PoliticsInstanceManager.cpp +++ b/src/openvic-simulation/politics/PoliticsInstanceManager.cpp @@ -7,7 +7,7 @@ using namespace OpenVic; PoliticsInstanceManager::PoliticsInstanceManager( InstanceManager const& new_instance_manager, - utility::forwardable_span ideologies + forwardable_span ideologies ) : instance_manager { new_instance_manager }, ideology_spawn_date { ideologies } {} diff --git a/src/openvic-simulation/politics/PoliticsInstanceManager.hpp b/src/openvic-simulation/politics/PoliticsInstanceManager.hpp index 5ec1c94b..a333c94f 100644 --- a/src/openvic-simulation/politics/PoliticsInstanceManager.hpp +++ b/src/openvic-simulation/politics/PoliticsInstanceManager.hpp @@ -5,7 +5,7 @@ #include "openvic-simulation/types/Date.hpp" #include "openvic-simulation/types/IndexedFlatMap.hpp" #include "openvic-simulation/utility/Getters.hpp" -#include "openvic-simulation/utility/ForwardableSpan.hpp" +#include "openvic-simulation/core/portable/ForwardableSpan.hpp" namespace OpenVic { struct InstanceManager; @@ -24,7 +24,7 @@ namespace OpenVic { public: PoliticsInstanceManager( InstanceManager const& new_instance_manager, - utility::forwardable_span ideologies + forwardable_span ideologies ); PoliticsInstanceManager(PoliticsInstanceManager&&) = default; diff --git a/src/openvic-simulation/population/Pop.cpp b/src/openvic-simulation/population/Pop.cpp index 9e173589..92245e66 100644 --- a/src/openvic-simulation/population/Pop.cpp +++ b/src/openvic-simulation/population/Pop.cpp @@ -400,7 +400,7 @@ OV_DO_FOR_ALL_NEED_CATEGORIES(DEFINE_NEEDS_FULFILLED) void Pop::allocate_for_needs( fixed_point_map_t const& scaled_needs, - utility::forwardable_span money_to_spend_per_good, + forwardable_span money_to_spend_per_good, memory::vector& reusable_vector, fixed_point_t& weights_sum, fixed_point_t& cash_left_to_spend @@ -469,7 +469,7 @@ void Pop::pop_tick( PopValuesFromProvince const& shared_values, RandomU32& random_number_generator, IndexedFlatMap& reusable_goods_mask, - utility::forwardable_span< + forwardable_span< memory::vector, VECTORS_FOR_POP_TICK > reusable_vectors @@ -489,12 +489,12 @@ void Pop::pop_tick_without_cleanup( PopValuesFromProvince const& shared_values, RandomU32& random_number_generator, IndexedFlatMap& reusable_goods_mask, - utility::forwardable_span< + forwardable_span< memory::vector, VECTORS_FOR_POP_TICK > reusable_vectors ) { - utility::forwardable_span good_keys = reusable_goods_mask.get_keys(); + forwardable_span good_keys = reusable_goods_mask.get_keys(); memory::vector& reusable_vector_0 = reusable_vectors[0]; memory::vector& reusable_vector_1 = reusable_vectors[1]; memory::vector& max_quantity_to_buy_per_good = reusable_vectors[2]; diff --git a/src/openvic-simulation/population/Pop.hpp b/src/openvic-simulation/population/Pop.hpp index 3e83bdd1..be0565a3 100644 --- a/src/openvic-simulation/population/Pop.hpp +++ b/src/openvic-simulation/population/Pop.hpp @@ -9,7 +9,7 @@ #include "openvic-simulation/types/PopSize.hpp" #include "openvic-simulation/types/UnitBranchType.hpp" #include "openvic-simulation/utility/Containers.hpp" -#include "openvic-simulation/utility/ForwardableSpan.hpp" +#include "openvic-simulation/core/portable/ForwardableSpan.hpp" namespace OpenVic { struct BaseIssue; @@ -166,7 +166,7 @@ namespace OpenVic { void fill_needs_fulfilled_goods_with_false(); void allocate_for_needs( fixed_point_map_t const& scaled_needs, - utility::forwardable_span money_to_spend_per_good, + forwardable_span money_to_spend_per_good, memory::vector& reusable_vector, fixed_point_t& price_inverse_sum, fixed_point_t& cash_left_to_spend @@ -175,7 +175,7 @@ namespace OpenVic { PopValuesFromProvince const& shared_values, RandomU32& random_number_generator, IndexedFlatMap& reusable_goods_mask, - utility::forwardable_span< + forwardable_span< memory::vector, VECTORS_FOR_POP_TICK > reusable_vectors @@ -218,7 +218,7 @@ namespace OpenVic { PopValuesFromProvince const& shared_values, RandomU32& random_number_generator, IndexedFlatMap& reusable_goods_mask, - utility::forwardable_span< + forwardable_span< memory::vector, VECTORS_FOR_POP_TICK > reusable_vectors diff --git a/src/openvic-simulation/types/IndexedFlatMap.hpp b/src/openvic-simulation/types/IndexedFlatMap.hpp index e9380714..1ea92be6 100644 --- a/src/openvic-simulation/types/IndexedFlatMap.hpp +++ b/src/openvic-simulation/types/IndexedFlatMap.hpp @@ -13,7 +13,7 @@ #include "openvic-simulation/types/FixedVector.hpp" #include "openvic-simulation/core/template/Concepts.hpp" #include "openvic-simulation/utility/Getters.hpp" -#include "openvic-simulation/utility/ForwardableSpan.hpp" +#include "openvic-simulation/core/portable/ForwardableSpan.hpp" #include "openvic-simulation/utility/Logger.hpp" #define OV_IFLATMAP_PROPERTY(KEYTYPE, VALUETYPE, NAME) OV_IFLATMAP_PROPERTY_ACCESS(KEYTYPE, VALUETYPE, NAME, private) @@ -49,7 +49,7 @@ namespace OpenVic { */ template struct IndexedFlatMap { - using keys_span_type = OpenVic::utility::forwardable_span; + using keys_span_type = forwardable_span; using values_vector_type = std::conditional_t< std::is_move_constructible_v || std::is_copy_constructible_v, memory::vector, @@ -551,11 +551,11 @@ namespace OpenVic { return keys; } - constexpr OpenVic::utility::forwardable_span get_values() { + constexpr forwardable_span get_values() { return values; } - constexpr OpenVic::utility::forwardable_span get_values() const { + constexpr forwardable_span get_values() const { return values; } diff --git a/src/openvic-simulation/types/OrderedContainers.hpp b/src/openvic-simulation/types/OrderedContainers.hpp index 2aef44e0..3c940f7f 100644 --- a/src/openvic-simulation/types/OrderedContainers.hpp +++ b/src/openvic-simulation/types/OrderedContainers.hpp @@ -8,7 +8,7 @@ #include "openvic-simulation/core/template/Concepts.hpp" #include "openvic-simulation/utility/Containers.hpp" -#include "openvic-simulation/utility/Deque.hpp" +#include "openvic-simulation/core/portable/Deque.hpp" #include "openvic-simulation/utility/StringUtils.hpp" #include diff --git a/src/openvic-simulation/types/TypedSpan.hpp b/src/openvic-simulation/types/TypedSpan.hpp index 68953ff5..f82fc734 100644 --- a/src/openvic-simulation/types/TypedSpan.hpp +++ b/src/openvic-simulation/types/TypedSpan.hpp @@ -5,7 +5,7 @@ #include #include "openvic-simulation/core/template/Concepts.hpp" -#include "openvic-simulation/utility/ForwardableSpan.hpp" +#include "openvic-simulation/core/portable/ForwardableSpan.hpp" namespace OpenVic { template< @@ -13,16 +13,16 @@ namespace OpenVic { typename ValueType, size_t _Extent = std::dynamic_extent > - struct TypedSpan : public utility::forwardable_span { + struct TypedSpan : public forwardable_span { public: - using utility::forwardable_span::forwardable_span; + using forwardable_span::forwardable_span; constexpr IndexType size() const { - return IndexType(utility::forwardable_span::size()); + return IndexType(forwardable_span::size()); } - constexpr utility::forwardable_span::reference operator[](const IndexType _Off) const { - return utility::forwardable_span::operator[](static_cast(type_safe::get(_Off))); + constexpr forwardable_span::reference operator[](const IndexType _Off) const { + return forwardable_span::operator[](static_cast(type_safe::get(_Off))); } constexpr operator TypedSpan() { diff --git a/src/openvic-simulation/utility/DequeMemory.hpp b/src/openvic-simulation/utility/DequeMemory.hpp index b5346e16..91466539 100644 --- a/src/openvic-simulation/utility/DequeMemory.hpp +++ b/src/openvic-simulation/utility/DequeMemory.hpp @@ -2,7 +2,7 @@ #include -#include "openvic-simulation/utility/Deque.hpp" +#include "openvic-simulation/core/portable/Deque.hpp" #include #include diff --git a/src/openvic-simulation/utility/Getters.hpp b/src/openvic-simulation/utility/Getters.hpp index d032e4ec..08b4c663 100644 --- a/src/openvic-simulation/utility/Getters.hpp +++ b/src/openvic-simulation/utility/Getters.hpp @@ -219,7 +219,7 @@ public: \ NAME; \ \ public: \ - [[nodiscard]] constexpr OpenVic::utility::forwardable_span> get_##NAME() const { \ + [[nodiscard]] constexpr OpenVic::forwardable_span> get_##NAME() const { \ return NAME; \ } \ ACCESS: diff --git a/src/openvic-simulation/utility/ThreadPool.cpp b/src/openvic-simulation/utility/ThreadPool.cpp index 193ed99d..e7ce9357 100644 --- a/src/openvic-simulation/utility/ThreadPool.cpp +++ b/src/openvic-simulation/utility/ThreadPool.cpp @@ -19,10 +19,10 @@ void ThreadPool::loop_until_cancelled( ModifierEffectCache const& modifier_effect_cache, PopsDefines const& pop_defines, ProductionTypeManager const& production_type_manager, - utility::forwardable_span country_keys, - utility::forwardable_span good_keys, - utility::forwardable_span strata_keys, - utility::forwardable_span work_bundles + forwardable_span country_keys, + forwardable_span good_keys, + forwardable_span strata_keys, + forwardable_span work_bundles ) { IndexedFlatMap reusable_goods_mask { good_keys }; @@ -187,11 +187,11 @@ void ThreadPool::initialise_threadpool( ModifierEffectCache const& modifier_effect_cache, PopsDefines const& pop_defines, ProductionTypeManager const& production_type_manager, - utility::forwardable_span good_keys, - utility::forwardable_span strata_keys, - utility::forwardable_span goods, - utility::forwardable_span countries, - utility::forwardable_span provinces + forwardable_span good_keys, + forwardable_span strata_keys, + forwardable_span goods, + forwardable_span countries, + forwardable_span provinces ) { if (threads.size() > 0) { spdlog::error_s("Attempted to initialise ThreadPool again."); diff --git a/src/openvic-simulation/utility/ThreadPool.hpp b/src/openvic-simulation/utility/ThreadPool.hpp index 4b8ae33a..d6b76c1c 100644 --- a/src/openvic-simulation/utility/ThreadPool.hpp +++ b/src/openvic-simulation/utility/ThreadPool.hpp @@ -8,7 +8,7 @@ #include "openvic-simulation/population/PopValuesFromProvince.hpp" #include "openvic-simulation/types/Date.hpp" #include "openvic-simulation/utility/Containers.hpp" -#include "openvic-simulation/utility/ForwardableSpan.hpp" +#include "openvic-simulation/core/portable/ForwardableSpan.hpp" #include "openvic-simulation/utility/RandomGenerator.hpp" namespace OpenVic { @@ -26,17 +26,17 @@ namespace OpenVic { struct WorkBundle { public: RandomU32 random_number_generator; - utility::forwardable_span countries_chunk; - utility::forwardable_span goods_chunk; - utility::forwardable_span provinces_chunk; + forwardable_span countries_chunk; + forwardable_span goods_chunk; + forwardable_span provinces_chunk; constexpr WorkBundle() {} WorkBundle( RandomU32::state_type rng_state, - utility::forwardable_span new_countries_chunk, - utility::forwardable_span new_goods_chunk, - utility::forwardable_span new_provinces_chunk + forwardable_span new_countries_chunk, + forwardable_span new_goods_chunk, + forwardable_span new_provinces_chunk ) : random_number_generator { rng_state }, countries_chunk { new_countries_chunk }, goods_chunk { new_goods_chunk }, @@ -74,10 +74,10 @@ namespace OpenVic { ModifierEffectCache const& modifier_effect_cache, PopsDefines const& pop_defines, ProductionTypeManager const& production_type_manager, - utility::forwardable_span country_keys, - utility::forwardable_span good_keys, - utility::forwardable_span strata_keys, - utility::forwardable_span work_bundles + forwardable_span country_keys, + forwardable_span good_keys, + forwardable_span strata_keys, + forwardable_span work_bundles ); void await_completion(); void process_work(const work_t work_type); @@ -92,11 +92,11 @@ namespace OpenVic { ModifierEffectCache const& modifier_effect_cache, PopsDefines const& pop_defines, ProductionTypeManager const& production_type_manager, - utility::forwardable_span good_keys, - utility::forwardable_span strata_keys, - utility::forwardable_span goods, - utility::forwardable_span countries, - utility::forwardable_span provinces + forwardable_span good_keys, + forwardable_span strata_keys, + forwardable_span goods, + forwardable_span countries, + forwardable_span provinces ); void process_good_execute_orders();