• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2018 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 #ifndef ANDROID_VINTF_MANIFEST_INSTANCE_H
18 #define ANDROID_VINTF_MANIFEST_INSTANCE_H
19 
20 #include <string>
21 
22 #include <hidl-util/FqInstance.h>
23 
24 #include "HalFormat.h"
25 #include "TransportArch.h"
26 #include "Version.h"
27 
28 namespace android {
29 namespace vintf {
30 
31 class ManifestInstance {
32    public:
33     ManifestInstance();
34     ManifestInstance(const ManifestInstance&);
35     ManifestInstance(ManifestInstance&&) noexcept;
36     ManifestInstance& operator=(const ManifestInstance&);
37     ManifestInstance& operator=(ManifestInstance&&) noexcept;
38 
39     using VersionType = Version;
40     ManifestInstance(FqInstance&& fqInstance, TransportArch&& ta, HalFormat fmt);
41     ManifestInstance(const FqInstance& fqInstance, const TransportArch& ta, HalFormat fmt);
42     const std::string& package() const;
43     Version version() const;
44     const std::string& interface() const;
45     const std::string& instance() const;
46     Transport transport() const;
47     Arch arch() const;
48     HalFormat format() const;
49 
50     bool operator==(const ManifestInstance& other) const;
51     bool operator<(const ManifestInstance& other) const;
52 
53     // Convenience methods.
54     // return package@version::interface/instance
55     const FqInstance& getFqInstance() const;
56     // return @version::interface/instance
57     FqInstance getFqInstanceNoPackage() const;
58 
59    private:
60     FqInstance mFqInstance;
61     TransportArch mTransportArch;
62     HalFormat mHalFormat;
63 };
64 
65 }  // namespace vintf
66 }  // namespace android
67 
68 #endif  // ANDROID_VINTF_MANIFEST_INSTANCE_H
69