Skip to content

Commit bddb60c

Browse files
committed
#ICE-206 Work Type Refactor
(#ICE-203, #ICE-204, #ICE-205, #ICE-206) Required changes after initial refactor of the 'Span' type.
1 parent ab2adde commit bddb60c

File tree

36 files changed

+181
-181
lines changed

36 files changed

+181
-181
lines changed

source/code/core/tasks/private/internal_tasks/task_utils.hxx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,13 @@ namespace ice
111111
constexpr auto await_ready() const noexcept
112112
{
113113
// Only suspend if we actually have tasks
114-
return ice::span::empty(tasks);
114+
return tasks.is_empty();
115115
}
116116

117117
inline auto await_suspend(std::coroutine_handle<> coro) noexcept
118118
{
119119
// Set the 'running' variable so we can track how many tasks arleady finished.
120-
running.store(ice::count(tasks) + 1, std::memory_order_relaxed);
120+
running.store(tasks.size().u32() + 1, std::memory_order_relaxed);
121121

122122
for (ice::Task<void>& task : tasks)
123123
{
@@ -132,7 +132,7 @@ namespace ice
132132
constexpr bool await_resume() const noexcept
133133
{
134134
ICE_ASSERT_CORE(running.load(std::memory_order_relaxed) == 0);
135-
return ice::span::any(tasks);
135+
return tasks.not_empty();
136136
}
137137
};
138138
return Awaitable{ tasks };
@@ -149,13 +149,13 @@ namespace ice
149149
constexpr auto await_ready() const noexcept
150150
{
151151
// Only suspend if we actually have tasks
152-
return ice::span::empty(tasks);
152+
return tasks.is_empty();
153153
}
154154

155155
inline auto await_suspend(std::coroutine_handle<> coro) noexcept
156156
{
157157
// Set the 'running' variable so we can track how many tasks arleady finished.
158-
running.store(ice::count(tasks) + 1, std::memory_order_relaxed);
158+
running.store(tasks.size().u32() + 1, std::memory_order_relaxed);
159159

160160
for (ice::Task<>& task : tasks)
161161
{
@@ -170,7 +170,7 @@ namespace ice
170170
constexpr bool await_resume() const noexcept
171171
{
172172
ICE_ASSERT_CORE(running.load(std::memory_order_relaxed) == 0);
173-
return ice::span::any(tasks);
173+
return tasks.not_empty();
174174
}
175175
};
176176
return Awaitable{ tasks, scheduler };

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ namespace ice
8181
{
8282
ice::execute_detached_task(ice::move(task));
8383
}
84-
return ice::span::any(tasks);
84+
return tasks.not_empty();
8585
}
8686

8787
bool schedule_task(ice::Task<> task, ice::TaskScheduler& scheduler) noexcept
@@ -100,7 +100,7 @@ namespace ice
100100
{
101101
ice::schedule_detached_task(ice::move(task), scheduler);
102102
}
103-
return ice::span::any(tasks);
103+
return tasks.not_empty();
104104
}
105105

106106
bool schedule_queue(ice::TaskQueue& queue, ice::TaskScheduler& scheduler) noexcept

source/code/core/utils/private/config/config_builder_value.cxx

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

8787
auto ice::ConfigBuilderValue::operator[](ice::String key) noexcept -> ConfigBuilderValue
8888
{
89-
ICE_ASSERT_CORE(key.find_first_of('.') == ice::none_index);
89+
ICE_ASSERT_CORE(key.find_first_of('.') == ice::nindex_none);
9090

9191
ConfigBuilderEntry* const entry = _idx == ice::u32_max
9292
? _internal : (static_cast<ConfigBuilderContainer*>(_internal)->_entries._data + _idx);

source/code/core/utils/private/config/config_detail.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ namespace ice::config::detail
132132

133133
// If this key has multiple parts recursively enter config search
134134
ice::nindex key_split_location = key.find_first_of({".|"});
135-
while (key_split_location != ice::none_index && result)
135+
while (key_split_location != ice::nindex_none && result)
136136
{
137137
bool const is_table = finalcfg._keys->type != CONFIG_KEYTYPE_STRING;
138138
ice::String const keyval = key.substr(0, key_split_location);

source/code/core/utils/private/native_file.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ namespace ice::native_file
444444
{
445445
// Remove the top-most the directory explicitly.
446446
ice::nindex const dirslash = dirpath.find_last_of(L"\\/");
447-
if (dirslash == ice::none_index)
447+
if (dirslash == ice::nindex_none)
448448
{
449449
return false;
450450
}
@@ -794,7 +794,7 @@ namespace ice::native_file
794794
{
795795
// Remove the top-most the directory explicitly.
796796
ice::nindex const dirslash = ice::string::find_last_of(dirpath, ice::String{ "/" });
797-
if (dirslash == ice::none_index)
797+
if (dirslash == ice::nindex_none)
798798
{
799799
return false;
800800
}

source/code/core/utils/private/path_utils.cxx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace ice::path
3030
{
3131
if (path.size() >= 3)
3232
{
33-
return path[1] == Separators_Drive<CharType>[0] && Separators_Directory<CharType>.find_first_of(path[2]) != ice::none_index;
33+
return path[1] == Separators_Drive<CharType>[0] && Separators_Directory<CharType>.find_first_of(path[2]) != ice::nindex_none;
3434
}
3535
return false;
3636
}
@@ -48,7 +48,7 @@ namespace ice::path
4848
// Only support single-letter drives
4949
return path.size() == 3
5050
&& path[1] == Separators_Drive<CharType>[0]
51-
&& path.find_first_of(Separators_Directory<CharType>, path[2]) != ice::none_index;
51+
&& path.find_first_of(Separators_Directory<CharType>, path[2]) != ice::nindex_none;
5252
}
5353
else
5454
{
@@ -82,7 +82,7 @@ namespace ice::path
8282
constexpr auto directory(ice::BasicString<CharType> str) noexcept -> ice::BasicString<CharType>
8383
{
8484
ice::nindex const separator_pos = str.find_last_of(Separators_Directory<CharType>);
85-
if (separator_pos == ice::none_index)
85+
if (separator_pos == ice::nindex_none)
8686
{
8787
return str.substr(str.size(), separator_pos);
8888
}
@@ -178,7 +178,7 @@ namespace ice::path
178178
it = beg;
179179

180180
ice::nindex const begin = path.find_first_of(Separators_Drive<CharType>);
181-
if (begin != ice::none_index)
181+
if (begin != ice::nindex_none)
182182
{
183183
it = it + begin + 1;
184184
}
@@ -222,7 +222,7 @@ namespace ice::path
222222
auto replace_filename(ice::HeapString<CharType>& str, ice::BasicString<CharType> name) noexcept -> ice::BasicString<CharType>
223223
{
224224
auto const separator_pos = str.find_last_of(Separators_Directory<CharType>);
225-
if (separator_pos != ice::none_index)
225+
if (separator_pos != ice::nindex_none)
226226
{
227227
str.resize(separator_pos + 1);
228228
}
@@ -239,7 +239,7 @@ namespace ice::path
239239
auto replace_extension(ice::HeapString<CharType>& str, ice::BasicString<CharType> extension) noexcept -> ice::BasicString<CharType>
240240
{
241241
auto const separator_pos = str.find_last_of(Separators_Dot<CharType>[0]);
242-
if (separator_pos != ice::none_index)
242+
if (separator_pos != ice::nindex_none)
243243
{
244244
str.resize(separator_pos);
245245
}

source/code/framework/framework_base/private/asset/tilemap/asset_tilemap_oven_tmx.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ namespace ice
144144

145145
ice::nindex beg = 0;
146146
ice::nindex end = csv_data.find_first_of(',');
147-
while (end != ice::none_index)
147+
while (end != ice::nindex_none)
148148
{
149149
char const* val_beg = csv_data.begin() + beg;
150150
char const* val_end = csv_data.begin() + end;
@@ -191,7 +191,7 @@ namespace ice
191191

192192
ice::nindex beg = 0;
193193
ice::nindex end = points.find_first_of(' ');
194-
while (end != ice::none_index)
194+
while (end != ice::nindex_none)
195195
{
196196
char const* val_beg = data + beg;
197197
char const* val_delim = data + points.find_first_of(',', beg);

source/code/iceshard/engine/private/ecs/ecs_archetype_index.cxx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ namespace ice::ecs
3636
{
3737
using QueryTypeInfo = ice::ecs::detail::QueryTypeInfo;
3838

39-
ice::u32 const tag_count = ice::count(in_required_tags);
40-
ice::u32 const condition_count = ice::count(in_conditions);
41-
ice::u32 const identifier_count = ice::count(checked_identifiers);
39+
ice::u32 const tag_count = in_required_tags.size().u32();
40+
ice::u32 const condition_count = in_conditions.size().u32();
41+
ice::u32 const identifier_count = checked_identifiers.size().u32();
4242
ice::u32 const identifier_last_index = identifier_count - 1;
4343

4444
ice::u32 tag_idx = 0;
@@ -121,7 +121,7 @@ namespace ice::ecs
121121
ice::usize& offset_values_out
122122
) noexcept -> ice::meminfo
123123
{
124-
ice::u32 const component_count = ice::span::count(info.component_identifiers);
124+
ice::u32 const component_count = info.component_identifiers.size().u32();
125125

126126
ice::meminfo result = ice::meminfo_of<ArchetypeDataHeader>;
127127
offset_name_out = result += ice::meminfo_of<ice::utf8> * (name.size() + 1);
@@ -191,7 +191,7 @@ namespace ice::ecs
191191
data_block_pool = _default_block_pool.get();
192192
}
193193

194-
ice::u32 const component_count = ice::count(archetype_info.component_identifiers);
194+
ice::u32 const component_count = archetype_info.component_identifiers.size().u32();
195195

196196
ICE_ASSERT(
197197
component_count >= 2,
@@ -335,12 +335,12 @@ namespace ice::ecs
335335

336336
// We need to skip the first query entry if it's for `ice::ecs::Entity`
337337
// This is due to the fact that it's always there and is not taken into account when sorting components by identifiers.
338-
if (ice::span::front(query_info).identifier == ice::ecs::Constant_ComponentIdentifier<ice::ecs::Entity>)
338+
if (query_info.first().identifier == ice::ecs::Constant_ComponentIdentifier<ice::ecs::Entity>)
339339
{
340-
query_info = ice::span::subspan(query_info, 1);
340+
query_info = query_info.subspan(1);
341341
}
342342

343-
ice::u32 const required_tag_count = ice::count(query_tags);
343+
ice::u32 const required_tag_count = query_tags.size().u32();
344344
ice::u32 const required_component_count = [](auto const& query_conditions) noexcept -> ice::u32
345345
{
346346
ice::u32 result = 0;
@@ -362,7 +362,7 @@ namespace ice::ecs
362362
{
363363
ice::ecs::detail::ArchetypeInstanceInfo const& archetype_info = entry->archetype_info;
364364

365-
ice::u32 const archetype_component_count = ice::count(archetype_info.component_identifiers);
365+
ice::u32 const archetype_component_count = archetype_info.component_identifiers.size().u32();
366366
if (archetype_component_count < total_required_type_count)
367367
{
368368
continue;
@@ -389,7 +389,7 @@ namespace ice::ecs
389389
) const noexcept
390390
{
391391
ICE_ASSERT(
392-
ice::count(archetypes) == ice::count(out_instance_infos),
392+
archetypes.size() == out_instance_infos.size(),
393393
"Archetype instance fetch called with different input and output array sizes."
394394
);
395395

@@ -417,7 +417,7 @@ namespace ice::ecs
417417
) const noexcept
418418
{
419419
ICE_ASSERT(
420-
ice::count(archetype_instances) == ice::count(out_instance_infos),
420+
archetype_instances.size() == out_instance_infos.size(),
421421
"Archetype instance fetch called with different input and output array sizes."
422422
);
423423

source/code/iceshard/engine/private/ecs/ecs_entity_index.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ namespace ice::ecs
9696
{
9797
ice::u32 const indices_taken = ice::queue::take_front(
9898
_free_indices,
99-
ice::span::subspan(ice::Span{indices}, 0, ice::min<ice::u32>(free_count, ice::count(indices)))
99+
ice::Span{ indices }.headspan(free_count)
100100
);
101101

102102
for (ice::u32 idx = 0; idx < indices_taken; ++idx)
@@ -110,7 +110,7 @@ namespace ice::ecs
110110
}
111111

112112
ice::u32 gen_index = ice::array::count(_generation);
113-
ice::u32 const missing_entities = ice::count(out_entities) - total_indices_taken;
113+
ice::u32 const missing_entities = out_entities.size().u32() - total_indices_taken;
114114
ice::u32 const final_index = gen_index + missing_entities;
115115

116116
if (final_index > 0)

source/code/iceshard/engine/private/ecs/ecs_entity_operations.cxx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -297,16 +297,16 @@ namespace ice::ecs
297297

298298
void EntityOperations::destroy(ice::Span<ice::ecs::Entity const> entities) noexcept
299299
{
300-
if (ice::span::empty(entities))
300+
if (entities.is_empty())
301301
{
302302
return;
303303
}
304304

305305
void* handle_loc;
306-
EntityOperation* operation = new_storage_operation(ice::meminfo_of<ice::ecs::Entity> * ice::count(entities), handle_loc);
306+
EntityOperation* operation = new_storage_operation(ice::meminfo_of<ice::ecs::Entity> * entities.size().u32(), handle_loc);
307307
operation->archetype = ice::ecs::Archetype::Invalid;
308308
operation->entities = reinterpret_cast<ice::ecs::Entity*>(handle_loc);
309-
operation->entity_count = ice::count(entities);
309+
operation->entity_count = entities.size().u32();
310310
operation->component_data = nullptr;
311311
operation->component_data_size = 0;
312312

@@ -318,13 +318,13 @@ namespace ice::ecs
318318
ice::Span<ice::Data const> component_data
319319
) noexcept -> Result
320320
{
321-
if (ice::span::empty(entities) || (mode == 2 && index_create_count == 0) || mode == 0)
321+
if (entities.is_empty() || (mode == 2 && index_create_count == 0) || mode == 0)
322322
{
323323
return Result{ *this };
324324
}
325325

326-
ice::u32 const entity_count = mode == 2 ? index_create_count : ice::count(entities);
327-
ice::u32 const component_count = ice::count(component_info.names);
326+
ice::u32 const entity_count = mode == 2 ? index_create_count : entities.size().u32();
327+
ice::u32 const component_count = component_info.names.size().u32();
328328

329329
ice::meminfo additional_data_size = ice::meminfo{ filter_data_size, ice::ualign::b_8 };
330330
additional_data_size += ice::meminfo_of<ice::ecs::Entity> * entity_count;
@@ -424,7 +424,7 @@ namespace ice::ecs
424424
{
425425
if (mode != 0)
426426
{
427-
ice::u32 const entity_count = mode == 2 ? index_create_count : ice::count(entities);
427+
ice::u32 const entity_count = mode == 2 ? index_create_count : entities.size().u32();
428428

429429
ice::meminfo required_memory = ice::meminfo{ filter_data_size, ice::ualign::b_8 };
430430
required_memory += ice::meminfo_of<ice::ecs::Entity> * entity_count;

0 commit comments

Comments
 (0)