## -*- coding: utf-8 -*- /* * Copyright (C) ${copyright_year()} The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * ! Do not edit this file directly ! * * Generated automatically from camera_metadata_asserts.mako */ <% def annotated_enum_type(entry): if entry.type == 'int64' and entry.container == 'array': type = 'int64_t' else: type = 'int32_t' return type def aidl_namespace(path): return "::aidl::android::hardware::camera::metadata::" + path def aidl_camera_metadata_section(id): return aidl_namespace("CameraMetadataSection::" + id) def aidl_camera_metadata_section_start(id): return aidl_namespace("CameraMetadataSectionStart::" + id) def aidl_camera_metadata_tag(id): return aidl_namespace("CameraMetadataTag::" + id) def aidl_enum_name(entry): enum_name = entry.name.removeprefix("android.") s = enum_name.split(".") s = [x[0].capitalize() + x[1:] for x in s] return ''.join(s) %> #include #include #include % for sec in find_all_sections(metadata): % for entry in remove_hal_non_visible(find_unique_entries(sec)): % if entry.enum: #include % endif % endfor % endfor #include % for sec in find_all_sections(metadata): static_assert(static_cast(${path_name(sec) | csym}) == static_cast(${aidl_camera_metadata_section(csym(path_name(sec)))})); % endfor static_assert(static_cast(VENDOR_SECTION) == static_cast(${aidl_camera_metadata_section("VENDOR_SECTION")})); % for sec in find_all_sections(metadata): static_assert(static_cast(${path_name(sec) + '.start' | csym}) == static_cast(${aidl_camera_metadata_section_start(csym(path_name(sec) + '.start'))})); % endfor static_assert(static_cast(VENDOR_SECTION_START) == static_cast(${aidl_camera_metadata_section_start("VENDOR_SECTION_START")})); % for sec in find_all_sections(metadata): % for idx,entry in enumerate(remove_hal_non_visible(find_unique_entries(sec))): static_assert(static_cast(${csym(entry.name)}) == static_cast(${aidl_camera_metadata_tag(csym(entry.name))})); % endfor % endfor % for sec in find_all_sections(metadata): % for entry in remove_hal_non_visible(find_unique_entries(sec)): % if entry.enum: % for val in aidl_enum_values(entry): static_assert(static_cast<${annotated_enum_type(entry)}>(${csym(entry.name)}_${val.name}) == static_cast<${annotated_enum_type(entry)}>(${aidl_namespace(aidl_enum_name(entry) + "::" + aidl_enum_value_name(csym(entry.name) + "_" + val.name))})); % endfor % endif % endfor % endfor