• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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     inline bool operator==(const TransportArch& other) const {
32         return transport == other.transport && arch == other.arch;
33     }
34     inline bool operator<(const TransportArch& other) const {
35         if (transport < other.transport) return true;
36         if (transport > other.transport) return false;
37         return arch < other.arch;
38     }
39 
40    private:
41     friend struct TransportArchConverter;
42     friend struct ManifestHalConverter;
43     friend struct ManifestHal;
44     friend bool parse(const std::string &s, TransportArch *ta);
45     bool empty() const;
46     // Valid combinations:
47     // <transport arch="32">passthrough</transport>
48     // <transport arch="64">passthrough</transport>
49     // <transport arch="32+64">passthrough</transport>
50     // <transport>hwbinder</transport>
51     // Element doesn't exist
52     bool isValid() const;
53 };
54 
55 
56 } // namespace vintf
57 } // namespace android
58 
59 #endif // ANDROID_VINTF_TRANSPORT_ARCH_H
60