summaryrefslogtreecommitdiff
path: root/modules/codec
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2025-12-16 15:01:32 +0100
committerClaudius "keldu" Holeksa <mail@keldu.de>2025-12-16 15:01:32 +0100
commitb8af319d57fb52e369d724af3bb7c87c4bd51276 (patch)
treed9d6635a5550070dd7f32d1875b727953f69be73 /modules/codec
parentf0d420728aeeef2b4fcabb89eaaf2dec7b57b69d (diff)
downloadforstio-forstio-b8af319d57fb52e369d724af3bb7c87c4bd51276.tar.gz
Adding helper for broad size of schemasdev
Diffstat (limited to 'modules/codec')
-rw-r--r--modules/codec/c++/schema.hpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/modules/codec/c++/schema.hpp b/modules/codec/c++/schema.hpp
index 65d7158..3eb7f79 100644
--- a/modules/codec/c++/schema.hpp
+++ b/modules/codec/c++/schema.hpp
@@ -359,4 +359,26 @@ template<typename... Funcs>
struct schema_iface_type_group<schema::Interface<Funcs...>> {
using Type = typename tmpl_reduce<typename impl::schema_func_list_helper<Funcs...>::Type>::type;
};
+
+template<typename Schema>
+struct schema_width {
+ static_assert(always_false<Schema>, "Expecting a Structural Schema.");
+
+ constexpr static uint64_t value = 0u;
+};
+
+template<typename... T>
+struct schema_width<schema::Tuple<T...>> {
+ constexpr static uint64_t value = sizeof...(T);
+};
+
+template<typename... T>
+struct schema_width<schema::Struct<T...>> {
+ constexpr static uint64_t value = sizeof...(T);
+};
+
+template<typename... T>
+struct schema_width<schema::Union<T...>> {
+ constexpr static uint64_t value = sizeof...(T);
+};
} // namespace saw