Skip to content

Commit 3acf0b6

Browse files
committed
Initial refactor of refactored HashMap API.
* Replaced 'empty', 'any' and 'count' with new equivalents. #ICE-210
1 parent 829c422 commit 3acf0b6

File tree

16 files changed

+38
-38
lines changed

16 files changed

+38
-38
lines changed

source/code/core/tasks/private/task_thread_pool_impl.cxx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ namespace ice
4949
{
5050
_thread_pool.reserve(info.thread_count);
5151
_managed_threads.reserve(info.thread_count);
52-
ice::hashmap::reserve(_created_threads, info.thread_count);
53-
ice::hashmap::reserve(_user_threads, info.thread_count);
52+
ice::hashmap::reserve(_created_threads, info.thread_count.u32());
53+
ice::hashmap::reserve(_user_threads, info.thread_count.u32());
5454

5555
ice::TaskThreadInfo thread_info{
5656
.exclusive_queue = false,
@@ -103,17 +103,17 @@ namespace ice
103103
_thread_pool.clear();
104104
}
105105

106-
auto TaskThreadPoolImplementation::thread_count() const noexcept -> ice::u32
106+
auto TaskThreadPoolImplementation::thread_count() const noexcept -> ice::ncount
107107
{
108-
return _thread_pool.size().u32();
108+
return _thread_pool.size();
109109
}
110110

111-
auto TaskThreadPoolImplementation::managed_thread_count() const noexcept -> ice::u32
111+
auto TaskThreadPoolImplementation::managed_thread_count() const noexcept -> ice::ncount
112112
{
113-
return _managed_threads.size().u32() + ice::hashmap::count(_created_threads);
113+
return _managed_threads.size() + _created_threads.size();
114114
}
115115

116-
auto TaskThreadPoolImplementation::estimated_task_count() const noexcept -> ice::u32
116+
auto TaskThreadPoolImplementation::estimated_task_count() const noexcept -> ice::ncount
117117
{
118118
return 0; // TODO:
119119
}

source/code/core/tasks/private/task_thread_pool_impl.hxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ namespace ice
2121
) noexcept;
2222
~TaskThreadPoolImplementation() noexcept override;
2323

24-
auto thread_count() const noexcept -> ice::u32 override;
25-
auto managed_thread_count() const noexcept -> ice::u32 override;
26-
auto estimated_task_count() const noexcept -> ice::u32 override;
24+
auto thread_count() const noexcept -> ice::ncount override;
25+
auto managed_thread_count() const noexcept -> ice::ncount override;
26+
auto estimated_task_count() const noexcept -> ice::ncount override;
2727

2828
auto create_thread(ice::StringID name) noexcept -> ice::TaskThread& override;
2929
auto find_thread(ice::StringID name) noexcept -> ice::TaskThread* override;

source/code/core/tasks/public/ice/task_thread_pool.hxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace ice
1414
struct TaskThreadPoolCreateInfo
1515
{
1616
//! \brief The thread count of this thread pool.
17-
ice::u32 thread_count = 0;
17+
ice::ncount thread_count = 0;
1818

1919
//! \brief The AIO port to be used for internal AIO threads.
2020
ice::native_aio::AIOPort aioport = nullptr;
@@ -27,9 +27,9 @@ namespace ice
2727
{
2828
public:
2929
virtual ~TaskThreadPool() noexcept = default;
30-
virtual auto thread_count() const noexcept -> ice::u32 = 0;
31-
virtual auto managed_thread_count() const noexcept -> ice::u32 = 0;
32-
virtual auto estimated_task_count() const noexcept -> ice::u32 = 0;
30+
virtual auto thread_count() const noexcept -> ice::ncount = 0;
31+
virtual auto managed_thread_count() const noexcept -> ice::ncount = 0;
32+
virtual auto estimated_task_count() const noexcept -> ice::ncount = 0;
3333

3434
//! \brief Creates an additonal thread with the given name (ID).
3535
//!

source/code/iceshard/iceshard/private/gfx/traits/iceshard_gfx_shader_storage_trait.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace ice::gfx
4040

4141
void Trait_GfxShaderStorage::build_content() noexcept
4242
{
43-
ImGui::TextT("Loaded shaders: {}", ice::hashmap::count(_loaded_shaders));
43+
ImGui::TextT("Loaded shaders: {}", _loaded_shaders.size());
4444
if (ImGui::BeginCombo("##shader-list", "Shader to preview", ImGuiComboFlags_WidthFitPreview))
4545
{
4646
for (GfxShaderEntry& entry : ice::hashmap::values(_loaded_shaders))

source/code/iceshard/iceshard/private/iceshard_world_devui.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ namespace ice
8383

8484
auto make_handler_list = [this](ice::String handler_type, auto const& hashmap) noexcept
8585
{
86-
ImGui::TextT("{} handlers (count: {})", handler_type, ice::hashmap::count(hashmap));
87-
if (ice::hashmap::any(hashmap))
86+
ImGui::TextT("{} handlers (count: {})", handler_type, hashmap.size());
87+
if (hashmap.not_empty())
8888
{
8989
detail::devui_handlers_table(ice::hashmap::values(hashmap), _world._traits);
9090
}

source/code/iceshard/iceshard/private/iceshard_world_manager_devui.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ namespace ice
4343

4444
// Always ensure same size
4545

46-
_entries.resize(ice::hashmap::count(_manager._worlds));
46+
_entries.resize(_manager._worlds.size());
4747

4848
[[maybe_unused]]
4949
ImVec2 const avail = ImGui::GetContentRegionAvail();

source/code/platforms/platform/public/ice/platform_threads.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace ice::platform
3030

3131
//! \brief Number of threads available in the threadpool.
3232
//! \note By default at least one (1), but can have more depending on platform capabilities.
33-
virtual auto threadpool_size() const noexcept -> ice::u32 = 0;
33+
virtual auto threadpool_size() const noexcept -> ice::ncount = 0;
3434

3535
//! \returns Pointer to the threadpool object managed by the platform.
3636
virtual auto threadpool_object() noexcept -> ice::TaskThreadPool* = 0;

source/code/platforms/platform_win32/private/win32_threads.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace ice::platform::win32
2525
auto graphics() noexcept -> ice::TaskScheduler& override { return _scheduler_gfx; }
2626

2727
auto threadpool() noexcept -> ice::TaskScheduler& override { return _scheduler_tasks; }
28-
auto threadpool_size() const noexcept -> ice::u32 override { return _threads->managed_thread_count(); }
28+
auto threadpool_size() const noexcept -> ice::ncount override { return _threads->managed_thread_count(); }
2929
auto threadpool_object() noexcept -> ice::TaskThreadPool* override { return _threads.get(); }
3030
auto aio_port() const noexcept -> ice::native_aio::AIOPort override { return _aioport; }
3131

source/code/systems/input_action_system/private/input_action_layer_builder.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ namespace ice
269269
// Prepare data of all sources
270270
for (Internal<InputActionBuilder::Source> const& source : _sources)
271271
{
272-
if (ice::hashmap::empty(source.events))
272+
if (source.events.is_empty())
273273
{
274274
final_sources.push_back(
275275
InputActionSourceInputInfo{

source/code/systems/resource_system/private/resource_provider_custom.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,20 @@ namespace ice
7777
{
7878
IPT_ZONE_SCOPED;
7979

80-
out_changes.reserve(out_changes.size() + ice::hashmap::count(_resources));
80+
out_changes.reserve(out_changes.size() + _resources.size());
8181
for (auto* resource : _resources)
8282
{
8383
out_changes.push_back(resource);
8484
}
85-
return ice::hashmap::count(_resources);
85+
return _resources.size().u32();
8686
}
8787

8888
auto CustomResourceProvider::refresh(
8989
ice::Array<ice::Resource*>& out_changes
9090
) noexcept -> ice::ResourceProviderResult
9191
{
9292
IPT_ZONE_SCOPED;
93-
if (ice::hashmap::empty(_resources))
93+
if (_resources.is_empty())
9494
{
9595
collect(out_changes);
9696
}

0 commit comments

Comments
 (0)