xref: /aosp_15_r20/system/media/camera/docs/ndk_camera_metadata_asserts.mako (revision b9df5ad1c9ac98a7fefaac271a55f7ae3db05414)
1## -*- coding: utf-8 -*-
2/*
3 * Copyright (C) ${copyright_year()} The Android Open Source Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18/**
19 * ! Do not edit this file directly !
20 *
21 * Generated automatically from ndk_camera_metadata_asserts.mako
22 */
23
24#include <camera/NdkCameraMetadataTags.h>
25#include <system/camera_metadata_tags.h>
26
27#include <stdint.h>
28<%
29def annotated_enum_type(entry):
30  if entry.type == 'int64' and entry.container == 'array':
31    type = 'int64_t'
32  else:
33    type = 'int32_t'
34  return type
35%>
36
37% for sec in find_all_sections_filtered(metadata, ('extension')):
38static_assert(static_cast<int>(${path_name(sec) | csym})
39        == static_cast<int>(${ndk(path_name(sec)) | csym}));
40% endfor
41
42% for sec in find_all_sections_filtered(metadata, ('extension')):
43static_assert(static_cast<int>(${path_name(sec) + '.start' | csym})
44        == static_cast<int>(${csym(ndk(path_name(sec)) + '.start')}));
45% endfor
46
47% for sec in find_all_sections_filtered(metadata, ('extension')):
48  % for idx,entry in enumerate(remove_hal_non_visible(find_unique_entries(sec))):
49        % if entry.applied_ndk_visible != "true":
50<%
51            continue
52%>
53        % endif
54
55static_assert(static_cast<int>(${csym(entry.name)})
56        == static_cast<int>(${csym(ndk(entry.name))}));
57  % endfor
58% endfor
59
60% for sec in find_all_sections_filtered(metadata, ('extension')):
61  % for entry in remove_hal_non_visible(find_unique_entries(sec)):
62    % if entry.enum:
63        % if entry.applied_ndk_visible != "true":
64<%
65            continue
66%>
67        % endif
68      % for val in aidl_enum_values(entry):
69              % if val.ndk_hidden:
70<%
71            continue
72%>
73        % endif
74static_assert(static_cast<${annotated_enum_type(entry)}>(${csym(entry.name)}_${val.name})
75        == static_cast<${annotated_enum_type(entry)}>(${csym(ndk(entry.name))}_${val.name}));
76      % endfor
77    % endif
78  % endfor
79
80% endfor