/* * Copyright (C) 2024 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. */ #pragma once #include #include #include #include using android::hardware::MQFlavor; typedef uint64_t RingBufferPosition; namespace android { template struct FlavorTypeToValue; /* * AIDL parcelables will have the typedef fixed_size. It is std::true_type when the * parcelable is annotated with @FixedSize, and std::false_type when not. Other types * should not have the fixed_size typedef, so they will always resolve to std::false_type. */ template struct has_typedef_fixed_size : std::false_type {}; template struct has_typedef_fixed_size> : T::fixed_size {}; #define STATIC_AIDL_TYPE_CHECK(T) \ static_assert(has_typedef_fixed_size::value == true || std::is_fundamental::value || \ std::is_enum::value, \ "Only fundamental types, enums, and AIDL parcelables annotated with @FixedSize " \ "and built for the NDK backend are supported as payload types(T)."); template