[RFC,v1,2/3] utils: codegen: ipc: Default special member ops
diff mbox series

Message ID 20250806154842.597155-2-barnabas.pocze@ideasonboard.com
State Superseded
Headers show
Series
  • [RFC,v1,1/3] utils: codegen: ipc: Put default values in declaration
Related show

Commit Message

Barnabás Pőcze Aug. 6, 2025, 3:48 p.m. UTC
Default the copy/move constructor/assignment operators so that
they are available if possible. This can allow more efficient
passing and construction of these objects.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
---
 .../libcamera_templates/definition_functions.tmpl           | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Paul Elder Aug. 14, 2025, 6:46 a.m. UTC | #1
Quoting Barnabás Pőcze (2025-08-07 00:48:41)
> Default the copy/move constructor/assignment operators so that
> they are available if possible. This can allow more efficient
> passing and construction of these objects.
> 
> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

> ---
>  .../libcamera_templates/definition_functions.tmpl           | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/utils/codegen/ipc/generators/libcamera_templates/definition_functions.tmpl b/utils/codegen/ipc/generators/libcamera_templates/definition_functions.tmpl
> index 16d11c309..3a57a3c2c 100644
> --- a/utils/codegen/ipc/generators/libcamera_templates/definition_functions.tmpl
> +++ b/utils/codegen/ipc/generators/libcamera_templates/definition_functions.tmpl
> @@ -39,6 +39,12 @@ public:
>  {%- endfor %}
>         {
>         }
> +
> +       {{struct.mojom_name}}(const {{struct.mojom_name}} &) = default;
> +       {{struct.mojom_name}} &operator=(const {{struct.mojom_name}} &) = default;
> +       {{struct.mojom_name}}({{struct.mojom_name}} &&) = default;
> +       {{struct.mojom_name}} &operator=({{struct.mojom_name}} &&) = default;
> +       ~{{struct.mojom_name}}() = default;
>  #endif
>  
>  {% for field in struct.fields %}
> -- 
> 2.50.1
>

Patch
diff mbox series

diff --git a/utils/codegen/ipc/generators/libcamera_templates/definition_functions.tmpl b/utils/codegen/ipc/generators/libcamera_templates/definition_functions.tmpl
index 16d11c309..3a57a3c2c 100644
--- a/utils/codegen/ipc/generators/libcamera_templates/definition_functions.tmpl
+++ b/utils/codegen/ipc/generators/libcamera_templates/definition_functions.tmpl
@@ -39,6 +39,12 @@  public:
 {%- endfor %}
 	{
 	}
+
+	{{struct.mojom_name}}(const {{struct.mojom_name}} &) = default;
+	{{struct.mojom_name}} &operator=(const {{struct.mojom_name}} &) = default;
+	{{struct.mojom_name}}({{struct.mojom_name}} &&) = default;
+	{{struct.mojom_name}} &operator=({{struct.mojom_name}} &&) = default;
+	~{{struct.mojom_name}}() = default;
 #endif
 
 {% for field in struct.fields %}