summaryrefslogtreecommitdiff
path: root/modules/codec/c++/schema.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/codec/c++/schema.hpp')
-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