In the middle of multithreading parsers.

This commit is contained in:
zy4n
2025-03-30 22:38:06 +02:00
parent d18b40a7fc
commit 144126ee7a
80 changed files with 2904 additions and 1450 deletions

View File

@@ -15,12 +15,14 @@ class shader_source_store_iterator
public:
using size_type = std::size_t;
using length_type = ztu::u32;
using id_type = ztu::id_type_for<shader_source_store, ztu::u32>;
using id_type = shader_source_id;
using metadata_type = shader_source_data::metadata;
using value_type = std::pair<id_type, shader_source_view>;
using id_iterator_type = id_type const*;
using string_iterator_type = Char*;
using length_iterator_type = const length_type*;
using metadata_iterator_type = const metadata_type*;
using offset_type = size_type;
using difference_type = std::ptrdiff_t;
@@ -35,6 +37,7 @@ private:
id_iterator_type ids,
string_iterator_type strings,
length_iterator_type lengths,
metadata_iterator_type metadata,
std::size_t index,
const offset_type& offset
);
@@ -80,6 +83,7 @@ private:
id_iterator_type m_ids{};
string_iterator_type m_strings{};
length_iterator_type m_lengths{};
metadata_iterator_type m_metadata{};
size_type m_index{};
offset_type m_offset{};
};
@@ -95,9 +99,13 @@ public:
using const_iterator = shader_source_store_iterator<const char>;
using view_type = std::ranges::subrange<iterator_type>;
using const_view_type = std::ranges::subrange<const_iterator>;
using id_type = ztu::id_type_for<shader_source_store, ztu::u32>;
using id_type = shader_source_id;
inline id_type add(const shader_source_data& shader_source);
// TODO not storing metadata
inline id_type add(
shader_source_id id,
const shader_source_data& shader_source
);
[[nodiscard]] inline std::pair<iterator_type, bool> find(id_type id);
@@ -119,15 +127,12 @@ public:
[[nodiscard]] inline const_iterator cend() const;
[[nodiscard]] inline view_type view();
[[nodiscard]] inline const_view_type view() const;
private:
std::vector<id_type> m_ids;
std::vector<char> m_strings;
std::vector<count_type> m_lengths;
id_type m_next_data_id{ 1 };
std::vector<shader_source_data::metadata> m_metadata;
};
}