summaryrefslogtreecommitdiff
path: root/utils/codegen/ipc
diff options
context:
space:
mode:
authorBarnabás Pőcze <barnabas.pocze@ideasonboard.com>2025-05-13 14:11:01 +0200
committerBarnabás Pőcze <barnabas.pocze@ideasonboard.com>2025-05-27 11:10:23 +0200
commitd58ccabab7fd097737bee91b9fcb4f2ee48c2a36 (patch)
tree132d74477a12d1318118600016e9bcb43503682e /utils/codegen/ipc
parent0a1539a4f12115837938138aa84895d539e98cec (diff)
utils: codegen: ipc: Add `deserializer()` function
Add `deserializer()` in `serializer.tmpl` to have a single function that generates all the necessary functions into the template specialization like `serializer()`. This also avoids the duplication of some conditional logic. Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Diffstat (limited to 'utils/codegen/ipc')
-rw-r--r--utils/codegen/ipc/generators/libcamera_templates/core_ipa_serializer.h.tmpl7
-rw-r--r--utils/codegen/ipc/generators/libcamera_templates/module_ipa_serializer.h.tmpl7
-rw-r--r--utils/codegen/ipc/generators/libcamera_templates/serializer.tmpl14
3 files changed, 16 insertions, 12 deletions
diff --git a/utils/codegen/ipc/generators/libcamera_templates/core_ipa_serializer.h.tmpl b/utils/codegen/ipc/generators/libcamera_templates/core_ipa_serializer.h.tmpl
index cbb35ef5..ac84963d 100644
--- a/utils/codegen/ipc/generators/libcamera_templates/core_ipa_serializer.h.tmpl
+++ b/utils/codegen/ipc/generators/libcamera_templates/core_ipa_serializer.h.tmpl
@@ -32,12 +32,7 @@ class IPADataSerializer<{{struct|name}}>
{
public:
{{- serializer.serializer(struct)}}
-{%- if struct|has_fd %}
-{{serializer.deserializer_fd(struct)}}
-{%- else %}
-{{serializer.deserializer_no_fd(struct)}}
-{{serializer.deserializer_fd_simple(struct)}}
-{%- endif %}
+{{- serializer.deserializer(struct)}}
};
{% endfor %}
diff --git a/utils/codegen/ipc/generators/libcamera_templates/module_ipa_serializer.h.tmpl b/utils/codegen/ipc/generators/libcamera_templates/module_ipa_serializer.h.tmpl
index f3b8e3b1..65a7dd11 100644
--- a/utils/codegen/ipc/generators/libcamera_templates/module_ipa_serializer.h.tmpl
+++ b/utils/codegen/ipc/generators/libcamera_templates/module_ipa_serializer.h.tmpl
@@ -33,12 +33,7 @@ class IPADataSerializer<{{struct|name_full}}>
{
public:
{{- serializer.serializer(struct)}}
-{%- if struct|has_fd %}
-{{serializer.deserializer_fd(struct)}}
-{%- else %}
-{{serializer.deserializer_no_fd(struct)}}
-{{serializer.deserializer_fd_simple(struct)}}
-{%- endif %}
+{{- serializer.deserializer(struct)}}
};
{% endfor %}
diff --git a/utils/codegen/ipc/generators/libcamera_templates/serializer.tmpl b/utils/codegen/ipc/generators/libcamera_templates/serializer.tmpl
index 114e349c..d07836cc 100644
--- a/utils/codegen/ipc/generators/libcamera_templates/serializer.tmpl
+++ b/utils/codegen/ipc/generators/libcamera_templates/serializer.tmpl
@@ -317,3 +317,17 @@
return ret;
}
{%- endmacro %}
+
+{#
+ # \brief Deserialize a struct
+ #
+ # Generate code for IPADataSerializer specialization, for deserializing \a struct.
+ #}
+{%- macro deserializer(struct) %}
+{%- if struct|has_fd %}
+{{deserializer_fd(struct)}}
+{%- else %}
+{{deserializer_no_fd(struct)}}
+{{deserializer_fd_simple(struct)}}
+{%- endif %}
+{%- endmacro %}