1 /* 2 * Copyright (C) 2017 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 18 #ifndef ANDROID_VINTF_TRANSPORT_ARCH_H 19 #define ANDROID_VINTF_TRANSPORT_ARCH_H 20 21 #include "Arch.h" 22 #include "Transport.h" 23 24 namespace android { 25 namespace vintf { 26 27 struct TransportArch { 28 Transport transport = Transport::EMPTY; 29 Arch arch = Arch::ARCH_EMPTY; 30 31 TransportArch() = default; TransportArchTransportArch32 TransportArch(Transport t, Arch a) : transport(t), arch(a) {} 33 34 inline bool operator==(const TransportArch& other) const { 35 return transport == other.transport && arch == other.arch; 36 } 37 inline bool operator<(const TransportArch& other) const { 38 if (transport < other.transport) return true; 39 if (transport > other.transport) return false; 40 return arch < other.arch; 41 } 42 43 private: 44 friend struct TransportArchConverter; 45 friend struct ManifestHalConverter; 46 friend struct ManifestHal; 47 friend bool parse(const std::string &s, TransportArch *ta); 48 bool empty() const; 49 // Valid combinations: 50 // <transport arch="32">passthrough</transport> 51 // <transport arch="64">passthrough</transport> 52 // <transport arch="32+64">passthrough</transport> 53 // <transport>hwbinder</transport> 54 // Element doesn't exist 55 bool isValid() const; 56 }; 57 58 59 } // namespace vintf 60 } // namespace android 61 62 #endif // ANDROID_VINTF_TRANSPORT_ARCH_H 63